Red5 server Integration with C application - streaming

I am newbie to Red5 server. I have a C command-line application which outputs RTMP stream to given ingestion point. Now I am writing a wrapper application to automate (on the fly) Red5 application creation/configuration and RTMP stream ingestion in a single command. Here are my query:
Once I create/Configure Red5 application do I need to restart Red5 server to publish streams or it will be published automatically??
More queries on the way. Many thanks in advance.

I explored further about Red5 and found that applications can be deployed without having to restart Red5 server. Here are the steps to do that:
Create/Configure Red5 application as per your requirement.
Create a war file out of your config directory.
place the generated war file under /webapps/
Red5 uses a War deployment Bean which can be identified as the warDeployService. This is a scheduler service with watches for new Red5 applications in the webapps directory. New applications must be deployed as .war files. When the warDeployService discovers a new .war file candidate it attempts to extract it automatically and install the Red5 application in less than 10 minutes.The warDeployService checks for new war files as defined by the bean descriptor(checkInterval).The service may fail if your .war file is not packed in appropriate structure.
Note: Packaging .war file of your application may not be same as “Export as War” feature in eclipse, due to difference in application structure.
The Red5 warDeployService bean can be found in the file /conf/red5-common.xml located in Conf directory as shown below.
<!-- War deployer -->
<bean id="warDeployService" class="org.red5.server.service.WarDeployer" init-method="init" destroy-method="shutdown">
<property name="scheduler" ref="schedulingService"/>
<property name="checkInterval" value="${war.deploy.server.check.interval}"/>
<property name="deploymentDirectory" value="${red5.root}/webapps"/>
</bean>
War file polling time is 10 Mins(600000 in milliseconds) by default. It can be configured in /conf/red5.properties file.
war.deploy.server.check.interval=600000

Related

JBoss 7 as deploys automatically

I put my jboss on the linux server, exported the war file and placed it on the deployments folder and it automatically deployed. I didn't even had to do it via command line. How is this working?
My jboss has ssl to it.
From the Application Deployment documentation:
The standalone/deployments directory in the JBoss Application Server 7 distribution is the location end users can place their deployment content (e.g. war, ear, jar, sar files) to have it automically deployed into the server runtime.
So, if you put a war file in standalone/deployments, JBoss will detect it and act as if you had manually deployed it. The documentation page has a lot more info about configuration if you want to change the defaults.

How to deploy Java web application project from Eclipse to live Tomcat server?

I have developed an web application using HTML, Java Servlet and all. While developing I was using Tomcat to deploy it in order to test it.
Now my development is done and I want to make it live. For that we have live server but as I am new to all this I dont know how to deploy my java web application on live server?
So please help me if you know to answer?
My Project Structure
ProjectName
->src
->beanClass
->class1
->Class2
->easyServlet
->Servlet1
->Servlet2
->Servlet3
->easyTrans
->Class1
->Class2
->Class3
->Class4
->build
->WebContent
->META-INF
->MENIFEST.mf
->WEB-INF
->lib(contain javascript files)
->web.xml
->html1
->html2
->html3
->html4
->html5
I am also using MySql so what I have to about it..
You will have to build a WAR of the project.
You can do this
in eclipse: right click on the project, Click "Export", and choose war file in the dialog (and mention, the destination, name and all)
via ant using the war task
The ant option is better because when you have multiple developers on the project and the code is in version control, it is easier to get the project automatically (using ant) and build a war. (you have version control, don't you?)
But this is more of an operational difference (albeit an important one) but the war created in either way are same
Deploy the war to the server
You can manually copy the war file to the $TOMCAT_HOME/webapps directory (See the "Creating and Deploying a WAR File" section on this article)
You can use the Tomcat 6 "Manager" application.
Update
You said that you are using MySql also. MySql should be installed on a server (it can be on the same server) and the configuration should be changed (username, password, server details) so that the application connects to the same database (I am sure you are not hard coding database details and credentials in your application and reading them from some configuration, this is the configuration that has to be changed)
For that we have live server but as I am new to all this I dont know how to deploy my java web application on live server?
I assume by this you meant , you have a public IP assigned to a server. Now you can install tomcat into this server and open the tomcat port for public and you will be able to access.
Now build a war file of your webapplication and put it into web-apps dir of the tomcat and start the server
Making a few assumptions here. You need
A tomcat instance running on your production server
Permissions to make changes to the tomcat instance
A war file that bundles your application
If you have both, then you need to navigate to the Tomcat manager page and follow the instructions to upload your war file.
Deploy the war to the server
You can manually copy the war file to the $TOMCAT_HOME/webapps directory.
You can use the Tomcat 6 "Manager" application.

How to run .ear file in JBoss 6?

I have created myProj.ear file and copied it into the deploy folder of the JBoss server.. How to run my project after starting the jBoss server?
I have been using war file and
deploying it in Tomcat till now to run
my project.... I am having a new
requirement to run the project in
JBoss. So, I converted my war file
into an ear file using the command Jar
-cvf myProj.ear ., Should I change anything in my project to run
the application in JBoss or just
copying my .ear file in to the jBoss
deploy folder is enough?
JBoss normally support hot deployment - meaning that if your application was deployed correctly (watch the console), it can be accessed via the browser (if you have a UI) or via web services, managed beans or any other interface you have provided.You can see the status of your application on the JBoss Admin Console. You can reach it by typing the URL of your JBoss installation. If you run your vanilla JBoss locally, you should be able to find the console under http://127.0.0.1:8080/admin-console
To reiterate: there is no explicit startup necessary, JBoss handles it for you.
Deploying an application in JBoss is pretty straightforward. You just have to copy the EAR file to the deploy directory in the 'server configuration' directory of your choice. Most people deploy it to the 'default' configuration, by copying the EAR file to the JBOSS_DIR/jboss-as/server/default/deploy directory.
Once copied, just run run.sh from bin, you can use the following params to bind it to an ip (-b) or binding it to anything other port (-Djboss.service.binding.set)
./run.sh -b 9.xxx.xxx.xxx -Djboss.service.binding.set=ports-01
Once you run it, Look at the console for error message. If everything goes fine you'd see "Started J2EE application" after couple of seconds.
If there are any errors or exceptions, make a note of the error message. Check that the EAR is complete and inspect the WAR file and the EJB jar files to make sure they contain all the necessary components (classes, descriptors,
jboss-deployment-structure.xml etc.).
You can safely redeploy the application if it is already deployed. To undeploy it you just have to remove the archive from the deploy directory. There’s no need to restart the server in either case. If everything seems to have gone OK, then point your browser at the application URL.
http://localhost:8080/xyz

How to deploy EAR into web configuration in JBoss?

We use "web" configuration of JBoss.
Now we deploy war files only.
But we are going to deploy ear to JBoss.
As far as I can see it is impossible to deploy ear on web configuration because there is no ear deployer in web configuration.
Will it be enough just to copy file default\deployers\ear-deployer-jboss-beans.xml to web\deployers directory?
Or some additional files should be copied too?
Instead of starting with the web configuration I will suggest to use the "default" configuration and trim it. For example, remove JMS.

Deployment of Web Application to a Running Tomcat

I would like to collect some best-practices on deployment of a web-application to a running Tomcat. Not long ago I had to describe the deployment process of our web-application and the process appeared rather confusing.
Say, we have an application in a WAR file (foo.war) correctly configured and not requiring additional configuration. In this case, the deployment process is rather easy:
Copy the foo.war file to the $CATALINA_HOME/webapps directory. If the application starts correctly, the application will automatically deploy to $CATALINA_HOME/webapps/foo directory.
To undeploy the application:
Remove the foo.war file from the $CATALINA_HOME/webapps. If the application unloads correctly, it will be unloaded and the $CATALINA_HOME/webapps/foo will be removed.
Now I want to override some context parameters in my running application. Having read the docs, all I need to do:
Create a context.xml file called foo.xml
Copy the file to the $CATALINA_BASE/conf/[enginename]/[hostname]/ directory.
Unfortunately, that did not work: the application would not restart. Empirically, we found out that the only working solution is when the war file is deployed to a location outside the $CATALINA_HOME/webapps.
Besides, the default values of the configurable context parameters in the WAR file should be specified in the web.xml, since context.xml in the WAR file is not read when there is a context.xml outside.
Here is an easy example of the foo.xml:
<?xml version='1.0' encoding='utf-8'?>
<Context docBase="/path-to-deployment-directory/foo.war">
<Parameter name="myparam" value="newvalue" override="false"/>
</Context>
Be sure to specify override=false for the parameter if you want the 'newvalue' to override the value specified in the WAR's web.xml. This was not obvious for us.
Thus, to deploy an aplication to a running Tomcat:
Create a context.xml file called foo.xml
Copy the file to the $CATALINA_BASE/conf/[enginename]/[hostname]/ directory.
Copy the foo.war to the location specified in the docBase of the foo.xml; the application will deploy automatically.
To apply new context parameters:
Add the parameter values to the foo.xml and save the file; the application will re-deploy automatically.
To undeploy the application:
Remove the foo.xml from the $CATALINA_BASE/conf/[enginename]/[hostname]/ directory
Note that removing the foo.war will also work, but will remove the foo.xml as well.
By now, I have the following questions:
Is it a best-practice at all to deploy a web-application without stopping the tomcat? I heard an opinion that deployment to a running tomcat is never needed since people run each application in a separate tomcat.
Is it a good idea to copy WAR files to $CATALINA_HOME/webapps or they should better be kept in a separate location?
How can I configure an application deployed to $CATALINA_HOME/webapps
Why there is no INFO line in the catalina.out for deployment of an application and there is one for undeployment? Is it configurable?
On question (1), Tomcat works great for deploying servlets into a running server. There may be concerns w.r.t. security or possibly D.O.S. or provisioning reasons why you would have separate server instances.
You have the flexibility to do either way, but it is often more convenient to deploy to an already running server. This is a BUILT-IN feature in the servlet architecture. :)
For (2), again it is at your discretion where you you want to put WARs. It sounds like you already have it configured a non-standard (non-default I should say) way. Check your server.xml file for the settings in your server instance(s). Check for attributes like unpackWARs and autoDeploy.
For (3) and (4), plus your (1,2) questions, it might be a good idea to consult the Tomcat docs for your version of Tomcat on its deployment model. You should be able to use the same docs to figure out how your server has been configured.
See Tomcat Web Application Deployment in the Tomcat manual, adjusting for your version of Tomcat.
One solution would be to use the manager application. If you decide that is safe to use it, then you can easily deploy, start, stop and undeploy applications:
http://localhost:8080/manager/deploy?path=[context_path]
http://localhost:8080/manager/start?path=[context_path]
http://localhost:8080/manager/stop?path=[context_path]
http://localhost:8080/manager/undeploy?path=[context_path]
There are ant tasks that can help you with these.
I am guessing, but do not know for sure, that stopping and starting an application will make it reread the context.xml.
Regarding your second question, I believe it is better for maintenance reasons to keep the war files in the webapps directory.