Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support redis in create_app.sh script #5349

Closed
Mohit-3196 opened this issue Jul 10, 2023 · 14 comments
Closed

Support redis in create_app.sh script #5349

Mohit-3196 opened this issue Jul 10, 2023 · 14 comments
Assignees

Comments

@Mohit-3196
Copy link
Contributor

No description provided.

@Mohit-3196 Mohit-3196 self-assigned this Jul 10, 2023
@Mohit-3196
Copy link
Contributor Author

@muratugureminoglu
Copy link
Collaborator

Thanks, @Mohit-3196

It would be better if we make it compatible as follows. There is no need to use separate parameters for username/password and port.

./create_app.sh -n test -c true -r redis://antmedia:antmedia@127.0.0.1:6379

@Mohit-3196
Copy link
Contributor Author

Thank you @muratugureminoglu abi for your input.
I have made the changes in the script and also updated the readme file. Please let me know if it requires any more changes or if anything is breaking.
https://github.com/Mohit-3196/create-app/blob/main/create_app.sh

Thank you

@muratugureminoglu
Copy link
Collaborator

Thank you, @Mohit-3196. Please send this as a pull request to our repository so that we can review the changes you made.

@Mohit-3196
Copy link
Contributor Author

#5412

@Mohit-3196
Copy link
Contributor Author

The PR is not passing the CI, please help me with resolving this @muratugureminoglu abi.
Thank you

@muratugureminoglu
Copy link
Collaborator

muratugureminoglu commented Jul 31, 2023

Thanks, @Mohit-3196

There is no change in the red5.properties file. Please check the following line.

# Update other properties in red5-web.properties
sed -i $SED_COMPATIBILITY 's#webapp.dbName=.*#webapp.dbName='$APP_NAME_LOWER'.db#' $RED5_PROPERTIES_FILE
sed -i $SED_COMPATIBILITY 's#webapp.contextPath=.*#webapp.contextPath=/'$APP_NAME'#' $RED5_PROPERTIES_FILE
sed -i $SED_COMPATIBILITY 's#db.app.name=.*#db.app.name='$APP_NAME'#' $RED5_PROPERTIES_FILE
sed -i $SED_COMPATIBILITY 's#db.name=.*#db.name='$APP_NAME_LOWER'#' $RED5_PROPERTIES_FILE

@Mohit-3196
Copy link
Contributor Author

OK.
Thank you @muratugureminoglu

@Mohit-3196
Copy link
Contributor Author

I'm still working on the script to finalize it.

FYI Please

@muratugureminoglu
Copy link
Collaborator

#5461

@Mohit-3196
Copy link
Contributor Author

Works fine.

Thank you

@Mohit-3196
Copy link
Contributor Author

I made some more detailed tests and below are the results for each case:

  • Standalone mode:
  1. Created application from the dashboard

  2. Uploaded the war file from the dashboard

  3. Created application from the terminal

  4. Created application by passing mongoDB credentials from the terminal like:
    sudo ./create_app.sh -n test03 -m mongo -u username -s password
    Application test03 is created but it is created locally on the server and I cannot see it on the MongoDB database, instead, the application DB file is created locally.

  5. Created application by using MongoDB without username and password. The application DB file is created locally.

  6. Created application using redis with authentication
    sudo ./create_app.sh -n test05 redis://default:password@localhost:6379
    Application db file is created locally

  7. Created application using redis without authentication
    sudo ./create_app.sh -n test06 redis@localhost:6379
    Application db file is created locally

  • Cluster mode with MongoDB as database:
  1. Created application from the dashboard
    The application .db file is saved in the database and not visible under /usr/local/antmedia

  2. Uploaded war file from dashboard and db file is created in the database

  3. Created application by passing MongoDB username and password:
    sudo ./create_app.sh -n test08 -c true -m mongo -u username -s
    password
    The application db file is located in the database

  4. Created application using redis with username and password
    sudo ./create_app.sh -n test12 -c true redis://default:password@localhost:6379
    application is created but the db file is available locally

  5. Created application without username and password
    application is available locally

  • Cluster with redis as database:
  1. Created application using MongoDB database and application db file is created in the MongoDB database

  2. Creating an application from the web panel:
    2023-08-28 10:28:22,431 [https-jsse-nio2-0.0.0.0-5443-exec-7] INFO o.r.s.a.MultiThreadedApplicationAdapter - Running create app script, war file name (null if default): null, app name: test17 2023-08-28 10:28:22,448 [https-jsse-nio2-0.0.0.0-5443-exec-7] INFO i.antmedia.console.AdminApplication - Creating application with command: /bin/bash create_app.sh -n test17 -w true -p /usr/local/antmedia -c true -m redis://default:password@localhost:6379 -u -s 2023-08-28 10:28:23,841 [vert.x-worker-thread-1] INFO org.red5.server.tomcat.WarDeployer - Deploy wars with app start 2023-08-28 10:28:24,209 [vert.x-worker-thread-1] INFO org.red5.server.tomcat.TomcatLoader - Starting Tomcat - Web application 2023-08-28 10:28:24,209 [vert.x-worker-thread-1] INFO org.red5.server.tomcat.TomcatLoader - Application root: /usr/local/antmedia/webapps 2023-08-28 10:28:24,221 [vert.x-worker-thread-1] INFO o.a.catalina.loader.WebappLoader - Unknown loader jdk.internal.loader.ClassLoaders$AppClassLoader@6a6824be class jdk.internal.loader.ClassLoaders$AppClassLoader 2023-08-28 10:28:24,233 [vert.x-worker-thread-1] INFO o.a.c.c.C.[.[0.0.0.0].[/test17] - No Spring WebApplicationInitializer types detected on classpath 2023-08-28 10:28:24,236 [vert.x-worker-thread-1] INFO ROOT - Starting up context: test17 2023-08-28 10:28:24,331 [vert.x-worker-thread-1] ERROR o.g.j.s.s.SpringComponentProvider - Spring context lookup failed, skipping spring component provider initialization. 2023-08-28 10:28:24,485 [Launcher:/test17] INFO org.red5.server.Context - Deployment type: bootstrap 2023-08-28 10:28:24,487 [Launcher:/test17] INFO io.antmedia.datastore.db.MongoStore - uri:mongodb://redis://default:mohit@localhost:6379 2023-08-28 10:28:24,488 [Launcher:/test17] WARN o.s.w.c.s.XmlWebApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'web.scope' defined in ServletContext resource [/WEB-INF/red5-web.xml]: Cannot resolve reference to bean 'web.handler' while setting bean property 'handler'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'web.handler' defined in ServletContext resource [/WEB-INF/red5-web.xml]: Cannot resolve reference to bean 'dataStoreFactory' while setting bean property 'dataStoreFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataStoreFactory' defined in ServletContext resource [/WEB-INF/red5-web.xml]: Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: The connection string contains an invalid host 'redis:'. The port '' is not a valid, it must be an integer between 0 and 65535
    When creating an application using -c true flag for the cluster, even when MongoDB credentials are not passed, there's no warning message.

@muratugureminoglu
Copy link
Collaborator

When I checked it 's working if you add -h parameter as follows.

sudo ./create_app.sh -n test12 -c true -h redis://default:password@localhost:6379

@Mohit-3196
Copy link
Contributor Author

Yes, it's fine abi. Thank you for your help.

There's a new issue that I see and here's how to reproduce it:

  1. Run as a cluster with the redis database.
  2. Try creating an application from the panel

Result
The application is not created and it gets stuck in the creating state.

Error logs:
2023-09-11 06:39:55,766 [https-jsse-nio2-0.0.0.0-5443-exec-9] INFO i.antmedia.console.AdminApplication - Creating application with command: /bin/bash create_app.sh -n test01 -w true -p /usr/local/antmedia -c true -m redis://default:mohit@localhost:6379 -u -s
2023-09-11 06:39:57,140 [vert.x-worker-thread-7] INFO org.red5.server.tomcat.WarDeployer - Deploy wars with app start
2023-09-11 06:39:57,526 [vert.x-worker-thread-7] INFO org.red5.server.tomcat.TomcatLoader - Starting Tomcat - Web application
2023-09-11 06:39:57,526 [vert.x-worker-thread-7] INFO org.red5.server.tomcat.TomcatLoader - Application root: /usr/local/antmedia/webapps
2023-09-11 06:39:57,539 [vert.x-worker-thread-7] INFO o.a.catalina.loader.WebappLoader - Unknown loader jdk.internal.loader.ClassLoaders$AppClassLoader@6a6824be class jdk.internal.loader.ClassLoaders$AppClassLoader
2023-09-11 06:39:57,552 [vert.x-worker-thread-7] INFO o.a.c.c.C.[.[0.0.0.0].[/test01] - No Spring WebApplicationInitializer types detected on classpath
2023-09-11 06:39:57,555 [vert.x-worker-thread-7] INFO ROOT - Starting up context: test01
2023-09-11 06:39:57,664 [vert.x-worker-thread-7] ERROR o.g.j.s.s.SpringComponentProvider - Spring context lookup failed, skipping spring component provider initialization.
2023-09-11 06:39:57,852 [Launcher:/test01] INFO org.red5.server.Context - Deployment type: bootstrap
2023-09-11 06:39:57,857 [Launcher:/test01] INFO io.antmedia.datastore.db.MongoStore - uri:mongodb://redis://default:mohit@localhost:6379
2023-09-11 06:39:57,860 [Launcher:/test01] WARN o.s.w.c.s.XmlWebApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'web.scope' defined in ServletContext resource [/WEB-INF/red5-web.xml]: Cannot resolve reference to bean 'web.handler' while setting bean property 'handler'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'web.handler' defined in ServletContext resource [/WEB-INF/red5-web.xml]: Cannot resolve reference to bean 'dataStoreFactory' while setting bean property 'dataStoreFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataStoreFactory' defined in ServletContext resource [/WEB-INF/red5-web.xml]: Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: The connection string contains an invalid host 'redis:'. The port '' is not a valid, it must be an integer between 0 and 65535

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

4 participants