http://wiki3.caucho.com/api.php?action=feedcontributions&user=Rickhigh&feedformat=atomResin 3.0 - User contributions [en]2024-03-29T12:27:37ZUser contributionsMediaWiki 1.18.0http://wiki3.caucho.com/ActiveMQActiveMQ2013-02-06T00:00:00Z<p>Rickhigh: </p>
<hr />
<div>{{Cleanup}} <br />
<br />
== See Also ==<br />
<br />
General documentation is available about [http://caucho.com/resin/doc/resin-messaging.xtp Resin Messaging]. <br />
<br />
== JCA ==<br />
<br />
<br />
== Resin, ActiveMQ and JCA ==<br />
<br />
ActiveMQ can be configured in Resin using ActiveMQ's JCA adapter. The .rar file is in apache-activemq-5.0.0/lib/options/activemq-rar-5.0.0.rar<br />
<br />
In the resin.conf, you'll need to add a <resource-deploy> tag to tell Resin where to look for resources:<br />
<code><pre><br />
<resin xmlns="http://caucho.com/ns/resin"><br />
<cluster id=""><br />
<host id=""><br />
<resource-deploy path="deploy"/><br />
...<br />
</host><br />
</cluster><br />
</resin><br />
</pre></code><br />
<br />
Then, in your resin-web.xml, you'll need to configure the connector. It will look like:<br />
<code><pre><br />
<web-app xmlns="http://caucho.com/ns/resin"><br />
<br />
<resource-adapter uri="activemq:"><br />
<init server-url="vm://localhost"/><br />
</resource-adapter><br />
<br />
<connection-factory uri="activemq:" name="activemq"/><br />
<br />
<jms-queue uri="activemq:" name="test"><br />
<init physical-name="queue.test"/><br />
</jms-queue><br />
</web-app><br />
</pre></code><br />
<br />
* The <resource-adapter> configures a JCA resource-adapter. <br />
* The uri="activemq:" is an alias for class="org.apache.activemq.ra.ActiveMQResourceAdapter" (contained in resin-support.jar) <br />
* The <init> block configures the resource adapter parameters.<br />
* The <connection-factory> configures the outbound factory<br />
* The <bean> configures the Queue (i.e. the adminobject)<br />
<br />
<code><pre><br />
package demo;<br />
<br />
import javax.jms.*;<br />
import javax.servlet.*;<br />
import javax.webbeans.*;<br />
<br />
public class DemoServlet extends GenericServlet {<br />
@In ConnectionFactory _factory;<br />
@Named("test") Queue _queue;<br />
<br />
public void service(...)<br />
{<br />
...<br />
Connection conn = _factory.createConnection();<br />
Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);<br />
session.send(_queue, session.createTextMessage("test"));<br />
...<br />
}<br />
}<br />
</pre></code></div>Rickhighhttp://wiki3.caucho.com/ActiveMQActiveMQ2013-02-06T00:00:00Z<p>Rickhigh: </p>
<hr />
<div>{{Cleanup}} <br />
<br />
== See Also ==<br />
<br />
General documentation is available about [http://caucho.com/resin/doc/resin-messaging.xtp Resin Messaging]. <br />
<br />
== JCA ==<br />
<br />
ActiveMQ can be configured in Resin using ActiveMQ's JCA adapter. <br />
<br />
You can get the ActiveMQ RAR file at:<br />
<br />
http://repo1.maven.org/maven2/org/apache/activemq/activemq-rar/5.7.0/activemq-rar-5.7.0.rar<br />
<br />
In the resin.xml, you'll need to add a <resource-deploy> tag to tell Resin where to look for resources:<br />
<code><pre><br />
<resin xmlns="http://caucho.com/ns/resin"><br />
<cluster id=""><br />
<host id=""><br />
<resource-deploy path="/somedir/that/has/jca-rar/files/deploy"/><br />
...<br />
</host><br />
</cluster><br />
</resin><br />
</pre></code><br />
<br />
Then, in your resin-web.xml (under WEB-INF of your webapp), you'll need to configure the connector. It will look like:<br />
<code><pre><br />
<?xml version="1.0" encoding="UTF-8" ?><br />
<web-app xmlns="http://caucho.com/ns/resin"><br />
<br />
<resource-adapter class="org.apache.activemq.ra.ActiveMQResourceAdapter"><br />
<init server-url="vm://localhost" /><br />
</resource-adapter><br />
<br />
<connection-factory class="org.apache.activemq.ra.ActiveMQManagedConnectionFactory" name="activemq" /><br />
<jms-queue class="org.apache.activemq.command.ActiveMQQueue" name="test"><br />
<init physical-name="queue.test" /><br />
</jms-queue><br />
</web-app><br />
</pre></code><br />
<br />
* The <resource-adapter> configures a JCA resource-adapter. <br />
* The <init> block configures the resource adapter parameters. Refer to ActiveMQ or the ra.xml file of the expanded rar file to see what parameters you can configure.<br />
* The <connection-factory> configures the outbound factory<br />
* The <jms-queue> configures the Queue (i.e. the adminobject)<br />
<br />
<code><pre><br />
package com.example;<br />
<br />
import java.io.IOException;<br />
<br />
import javax.inject.Inject;<br />
import javax.inject.Named;<br />
import javax.jms.JMSException;<br />
import javax.jms.Queue;<br />
import javax.jms.QueueConnection;<br />
import javax.jms.QueueConnectionFactory;<br />
import javax.jms.QueueSender;<br />
import javax.jms.QueueSession;<br />
import javax.servlet.ServletException;<br />
import javax.servlet.annotation.WebServlet;<br />
import javax.servlet.http.HttpServlet;<br />
import javax.servlet.http.HttpServletRequest;<br />
import javax.servlet.http.HttpServletResponse;<br />
<br />
/**<br />
* Servlet implementation class Sender<br />
*/<br />
@WebServlet("/Sender")<br />
public class Sender extends HttpServlet {<br />
<br />
@Inject @Named("activemq")<br />
QueueConnectionFactory _factory;<br />
@Inject @Named("test")<br />
Queue _queue;<br />
<br />
protected void doGet(HttpServletRequest request,<br />
HttpServletResponse response) throws ServletException, IOException {<br />
<br />
QueueConnection conn = null;<br />
QueueSession session = null;<br />
QueueSender sender = null;<br />
<br />
try {<br />
<br />
conn = _factory.createQueueConnection();<br />
session = conn.createQueueSession(false,<br />
QueueSession.AUTO_ACKNOWLEDGE);<br />
sender = session.createSender(_queue);<br />
sender.send(_queue, session.createTextMessage("test"));<br />
response.getWriter().println("SENT");<br />
<br />
} catch (JMSException e) {<br />
throw new ServletException(e);<br />
} finally {<br />
try {<br />
conn.close();<br />
session.close();<br />
sender.close();<br />
} catch (JMSException e) {<br />
throw new ServletException(e);<br />
}<br />
}<br />
}<br />
<br />
}<br />
<br />
</pre></code></div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_deployment_with_AmazonResin Cloud deployment with Amazon2012-01-25T00:00:00Z<p>Rickhigh: </p>
<hr />
<div>[[Category: Cookbook]] [[Category:Cloud]]<br />
<br />
This tutorial is going to cover the basics of using Resin with Amazon Web Services for cloud deployment. If you are new to cloud computing and IaaS ([http:///en.wikipedia.org/wiki/Cloud_computing#Infrastructure Infrastructure as a Service]), follow along and you will soon be deploying Java web applications in the cloud. You wil create an EC2 instance. You will download and install Resin on Ubuntu on a local machine. You will install Resin on an Amazon Linux AMI instance (EC2 instance). You will use Roo to create a simple application and deploy it.<br />
<br />
We use [http://www.springsource.org/spring-roo Roo because Spring] is fairly widely used, and Roo is a quick way to generate a sample app. Future tutorials will use other common Java tools as well as show you how to configure and manage a complete Resin cluster. Think of this as the first tutorial in a series of tutorials.<br />
<br />
<br />
For this tutorial you will need Resin 4.0.24 or later. Check back periodically because as we are going to expand the tutorial and improve Resin's support of cloud deployments. The Resin engineering team plans on improving cloud support continuously.<br />
<br />
Many of the steps in this tutorial would be similar even if you were using [http://www.eucalyptus.com/ Eucalyptus], [http://cloudstack.com/ CloudStack] with [http://cloudstack.org/download.html CloudBridge], [http://www.rightscale.com/products/plans-pricing/mycloud.php RightScale myCloud] or even [http://opennebula.org/documentation:rel3.0:ec2qcg OpenNebula] this guide should help you along as they all support the Amazon EC2 REST APIs. Also any cloud computing environment (private or public, on premises or hosted) will have similar characteristics. Thus even if you are using a private cloud using [http://www.openstack.org/ OpenStack] like [http://deliver.citrix.com/projectolympus Project Olympus], the principles will be the same. In fact even using remote servers deployed in a datacenter or virtualized servers with [http://www.citrix.com/English/ps2/products/subfeature.asp?contentID=2300456 Xen Server], [http://xen.org/products/cloudxen.html Xen Cloud] or [http://www.vmware.com/products/vsphere/overview.html VMWare vSphere] the steps will be very similar.<br />
<br />
<br />
For this tutorial we expect you are familiar with starting, and stopping Amazon WS instances. If you are not, go through this [http://docs.amazonwebservices.com/AWSEC2/latest/GettingStartedGuide/ tutorial from Amazon WS]. You will need an Amazon WS account. Amazon WS allows you to have [http://aws.amazon.com/free/ free tier so you can learn Amazon WS (EC2, S3, Elastic Load Balancer, Block Storage, SimpleDB, Simple Queue Service, Simple Notification Service)].<br />
<br />
<br />
==Fire up an Amazon Instance==<br />
<br />
Fire up an Amazon Instance using Amazon Linux (basically CentOS 5.4). <br />
<br />
http://s3.amazonaws.com/wiki4/cloud_deploy/aws_create_new_instance.png<br />
<br />
<br />
<br />
Then [http://caucho.com/resin-4.0/changes/resin-4.0.24.xtp#RPM install Resin as follows using RPM]:<br />
<br />
<code> <pre><br />
<br />
$ sudo rpm --import http://caucho.com/download/rpm/RPM-GPG-KEY-caucho<br />
$ sudo yum install http://caucho.com/download/rpm/4.0.25/x86_64/resin-pro-4.0.25-1.x86_64.rpm<br />
<br />
</pre></code><br />
<br />
<br />
==Install Resin on a Local Box==<br />
<br />
Install <br />
[http://caucho.com/resin-4.0/admin/starting-resin-install.xtp#InstallingResinusingthedebpackageonUbuntuandDebian Resin] locally so you test locally and deploy. [http://caucho.com/resin-4.0/admin/starting-resin-install.xtp Feel free to install it on any supported OS].<br />
<br />
<br />
Add Caucho's Debian repository to your system's repositories to use automated update tools like Synaptic and apt-get. To do this, add the following line to your /etc/apt/sources.list<br />
<br />
<code> <pre><br />
deb http://caucho.com/download/debian unstable multiverse<br />
</pre></code><br />
<br />
<br />
Then install Resin as follows:<br />
<br />
<code> <pre><br />
$ sudo apt-get update<br />
$ sudo apt-get install resin-pro<br />
</pre></code><br />
<br />
It is a good idea to make sure the version you install on Amazon AMI matches the version you install locally.<br />
<br />
You can see that Resin is installed as follows:<br />
<br />
<code> <pre><br />
$ ls /etc/resin<br />
app-default.xml local.d resin.properties resin.xml<br />
<br />
$ ls /var/www/<br />
doc licenses log resin-data watchdog-data webapps<br />
<br />
$ ls /etc/init.d/resin<br />
/etc/init.d/resin<br />
<br />
$ ls -l /usr/local/share/resin<br />
lrwxrwxrwx 1 root root 16 2011-11-18 09:03 /usr/local/share/resin -> resin-pro-4.0.24<br />
<br />
</pre></code><br />
<br />
<br />
Also at this point, Resin should be running as well, and you can verify this with resinctl status:<br />
<br />
<code> <pre><br />
$ resinctl status<br />
Resin/4.0.24 status for watchdog at 127.0.0.1:6600<br />
<br />
watchdog:<br />
watchdog-pid: 7383<br />
<br />
server 'app-0' : ACTIVE<br />
password: missing<br />
watchdog-user: root<br />
user: www-data(www-data)<br />
root: /var/www<br />
conf: /etc/resin/resin.xml<br />
pid: 7590<br />
uptime: 0 days 00h19<br />
<br />
</pre></code><br />
<br />
== Install Maven 3 (Optional, for Roo example) ==<br />
<br />
If you already have a test .war file, you can skip to the deploy section and deploy your own war.<br />
<br />
Install maven. Maven is not in the public Ubuntu repository.<br />
<br />
<code><pre><br />
$ sudo add-apt-repository "deb http://build.discursive.com/apt/ lucid main"<br />
$ sudo apt-get update<br />
$ sudo apt-get install maven<br />
</pre></code><br />
<br />
Create a symbolic link:<br />
<code><pre><br />
$ sudo ln -s /usr/local/maven/bin/mvn /usr/local/bin/mvn<br />
</pre></code><br />
<br />
<br />
== Install Spring Roo (Optional) ==<br />
<br />
If you already have a test .war file, you can skip to the deploy section and deploy your own war.<br />
<br />
[http://static.springsource.org/spring-roo/reference/html/intro.html#intro-installation Download and install Spring Roo using directions at the Spring Roo site].<br />
<br />
This is how I install roo:<br />
<br />
<code><pre><br />
$ unzip spring-roo-1.2.0.RC1.zip<br />
$ sudo mv spring-roo-1.2.0.RC1 /usr/local/share/<br />
$ sudo ln -s /usr/local/share/spring-roo-1.2.0.RC1/ /usr/local/share/spring-roo<br />
$ sudo ln -s /usr/local/share/spring-roo/bin/roo.sh /usr/bin/roo<br />
</pre></code><br />
<br />
At the roo prompt, type hint.<br />
<br />
<code><pre><br />
<br />
$ roo<br />
____ ____ ____ <br />
/ __ \/ __ \/ __ \ <br />
/ /_/ / / / / / / / <br />
/ _, _/ /_/ / /_/ / <br />
/_/ |_|\____/\____/ 1.2.0.RC1 [rev dcaa483]<br />
<br />
<br />
Welcome to Spring Roo. For assistance press TAB or type "hint" then hit ENTER.<br />
...<br />
roo> hint<br />
<br />
..<br />
<br />
</pre></code><br />
<br />
Hint should always let you know what you might want to do next. Please feel free to read the Roo docs for details or just follow along and read the Roo docs later.<br />
<br />
Create the project, this generates maven project files and Spring starter project.<br />
<br />
<code><pre><br />
<br />
roo> project --topLevelPackage com.example.blog<br />
<br />
Created ROOT/pom.xml<br />
Created SRC_MAIN_RESOURCES<br />
Created SRC_MAIN_RESOURCES/log4j.properties<br />
Created SPRING_CONFIG_ROOT<br />
Created SPRING_CONFIG_ROOT/applicationContext.xml<br />
<br />
</pre></code><br />
<br />
Next setup the database and JPA, keep it simple to minimize the amount of things we need to configure later.<br />
<br />
<code><pre><br />
<br />
roo> jpa setup --database H2_IN_MEMORY --provider HIBERNATE <br />
<br />
Created SPRING_CONFIG_ROOT/database.properties<br />
Updated SPRING_CONFIG_ROOT/applicationContext.xml<br />
Created SRC_MAIN_RESOURCES/META-INF/persistence.xml<br />
Updated ROOT/pom.xml [added dependencies com.h2database:h2:1.3.161, org.hibernate:hibernate-core:3.6.8.Final, ...]<br />
<br />
</pre></code><br />
<br />
Create a entity class called blog.<br />
<br />
<code><pre><br />
<br />
roo> entity jpa --class ~.domain.Blog<br />
Created SRC_MAIN_JAVA/com/example/blog/domain<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog.java<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_Configurable.aj<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_Jpa_ActiveRecord.aj<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_ToString.aj<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_Jpa_Entity.aj<br />
<br />
</pre></code><br />
<br />
<br />
Add two fields to the Blog class.<br />
<br />
<code><pre><br />
~.domain.Blog roo> field string --fieldName title<br />
Updated SRC_MAIN_JAVA/com/example/blog/domain/Blog.java<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_JavaBean.aj<br />
<br />
~.domain.Blog roo> field string --fieldName message<br />
Updated SRC_MAIN_JAVA/com/example/blog/domain/Blog.java<br />
Updated SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_JavaBean.aj<br />
</pre></code><br />
<br />
Create the web tier<br />
<code><pre><br />
~.domain.Blog roo> web mvc setup<br />
Created ROOT/src/main/webapp/WEB-INF/spring<br />
Created ROOT/src/main/webapp/WEB-INF/spring/webmvc-config.xml<br />
Created ROOT/src/main/webapp/WEB-INF/web.xml<br />
...<br />
Updated ROOT/src/main/webapp/WEB-INF/web.xml<br />
Updated ROOT/pom.xml [added dependencies org.springframework:spring-webmvc:${spring.version}, ...]<br />
Updated SRC_MAIN_WEBAPP/WEB-INF/views/footer.jspx<br />
</pre></code><br />
<br />
<br />
Generate the web tier. <br />
<br />
<code><pre><br />
~.domain.Blog roo> web mvc all --package ~.web<br />
<br />
Created SRC_MAIN_JAVA/com/example/blog/web<br />
Created SRC_MAIN_JAVA/com/example/blog/web/BlogController.java<br />
...<br />
Created SRC_MAIN_WEBAPP/WEB-INF/views/blogs<br />
Created SRC_MAIN_WEBAPP/WEB-INF/views/blogs/views.xml<br />
Updated SRC_MAIN_WEBAPP/WEB-INF/views/blogs/views.xml<br />
...<br />
Updated SRC_MAIN_WEBAPP/WEB-INF/views/blogs/views.xml<br />
...<br />
Created SRC_MAIN_WEBAPP/WEB-INF/views/blogs/update.jspx<br />
</pre></code><br />
<br />
Package our web app<br />
<br />
<code><pre><br />
roo> perform package<br />
</pre></code><br />
<br />
<br />
Exit roo.<br />
<code><pre><br />
roo> exit<br />
</pre></code><br />
<br />
== Deploy locally and test ==<br />
<br />
Deploy the example Roo app with Resin.<br />
<br />
<code><pre><br />
$ resinctl deploy target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog<br />
<br />
Deployed production/webapp/default/blog from target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
</pre></code><br />
<br />
<br />
You can see if the app was actually deployed:<br />
<br />
<code><pre><br />
$ resinctl deploy-list<br />
<br />
production/webapp/default/blog<br />
</pre></code><br />
<br />
Now you should be able to load the Roo blog example.<br />
<br />
http://localhost:8080/blog/<br />
<br />
<br />
==Create an Elastic IP and assign it to your Amazon WS Linux instance==<br />
<br />
Create an Elastic IP and assign it to the Amazon WS Linux instance using the [http://aws.amazon.com/console/ Amazon web console].<br />
<br />
I got this IP address.<br />
203.0.113.26<br />
<br />
<br />
==Create password==<br />
<br />
<br />
<code><pre><br />
$ resinctl generate-password -user admin -password roofoo<br />
<br />
admin_user : admin<br />
admin_password : {SSHA}BGBKQdCr0a5orH99eqIFwR/fffffffff<br />
<br />
</pre></code><br />
<br />
==Create a properties file and put it into user-data of Amazon AMI==<br />
<br />
[http://caucho.com/resin-4.0/changes/resin-4.0.24.xtp#resinproperties Resin properties].<br />
<br />
<br />
<code><pre><br />
log_level : info<br />
dev_mode : true<br />
resin_doc : true<br />
<br />
app_tier : 127.0.0.1<br />
web_tier :<br />
cache_tier :<br />
<br />
setuid_user : www-data<br />
setuid_group : www-data<br />
<br />
http : 8080<br />
https : 8443<br />
<br />
admin_user : admin<br />
admin_password : {SSHA}BGBKQdCr0a5orH99eqIFwR/ffffffff<br />
admin_external : true<br />
admin_remote_enable : true<br />
session_store : true<br />
<br />
</pre></code><br />
<br />
<br />
Create an amazon.xml <br />
<br />
<br />
<code><pre><br />
<resin xmlns="http://caucho.com/ns/resin"<br />
xmlns:resin="urn:java:com.caucho.resin"><br />
<br />
<resin:properties path="http://169.254.169.254/latest/user-data"<br />
optional="true"/><br />
<br />
</resin><br />
</pre></code><br />
<br />
<br />
Log into Amazon AMI instance and add the above to /etc/resin/local.d/amazon.xml.<br />
<br />
<br />
<code><pre><br />
$ ssh -i resin2.pem ec2-user@203.0.113.26 <br />
$ sudo nano /etc/resin/local.d/amazon.xml<br />
</pre></code><br />
<br />
From your local machine execute this command:<br />
<br />
<br />
<code><pre><br />
$ resinctl deploy target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -address 203.0.113.26 -port 8080 -user admin -password roofoo<br />
</pre></code><br />
<br />
<br />
Now it works in the cloud:<br />
<br />
http://203.0.113.26:8080/blog/<br />
<br />
<br />
Next step learn how to spin up instances with eucatools [[Resin Cloud deployment with Amazon WS EC2 and Euca Tools]].<br />
<br />
<br />
Next step learn how to use MySQL setup with Resin and Amazon RDS [[Resin MySQL and RDS setup with Amazon RDS]].<br />
<br />
<br />
[[Resin Cloud Deployment Reference]]</div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_deployment_with_AmazonResin Cloud deployment with Amazon2012-01-25T00:00:00Z<p>Rickhigh: </p>
<hr />
<div>[[Category: Cookbook]] [[Category:Cloud]]<br />
<br />
This tutorial is going to cover the basics of using Resin with Amazon Web Services for cloud deployment. If you are new to cloud computing and IaaS ([http:///en.wikipedia.org/wiki/Cloud_computing#Infrastructure Infrastructure as a Service]), follow along and you will soon be deploying Java web applications in the cloud. You wil create an EC2 instance. You will download and install Resin on Ubuntu on a local machine. You will install Resin on an Amazon Linux AMI instance (EC2 instance). You will use Roo to create a simple application and deploy it.<br />
<br />
We use [http://www.springsource.org/spring-roo Roo because Spring] is fairly widely used, and Roo is a quick way to generate a sample app. Future tutorials will use other common Java tools as well as show you how to configure and manage a complete Resin cluster. Think of this as the first tutorial in a series of tutorials.<br />
<br />
<br />
For this tutorial you will need Resin 4.0.24 or later. Check back periodically because as we are going to expand the tutorial and improve Resin's support of cloud deployments. The Resin engineering team plans on improving cloud support continuously.<br />
<br />
Many of the steps in this tutorial would be similar even if you were using [http://www.eucalyptus.com/ Eucalyptus], [http://cloudstack.com/ CloudStack] with [http://cloudstack.org/download.html CloudBridge], [http://www.rightscale.com/products/plans-pricing/mycloud.php RightScale myCloud] or even [http://opennebula.org/documentation:rel3.0:ec2qcg OpenNebula] this guide should help you along as they all support the Amazon EC2 REST APIs. Also any cloud computing environment (private or public, on premises or hosted) will have similar characteristics. Thus even if you are using a private cloud using [http://www.openstack.org/ OpenStack] like [http://deliver.citrix.com/projectolympus Project Olympus], the principles will be the same. In fact even using remote servers deployed in a datacenter or virtualized servers with [http://www.citrix.com/English/ps2/products/subfeature.asp?contentID=2300456 Xen Server], [http://xen.org/products/cloudxen.html Xen Cloud] or [http://www.vmware.com/products/vsphere/overview.html VMWare vSphere] the steps will be very similar.<br />
<br />
<br />
For this tutorial we expect you are familiar with starting, and stopping Amazon WS instances. If you are not, go through this [http://docs.amazonwebservices.com/AWSEC2/latest/GettingStartedGuide/ tutorial from Amazon WS]. You will need an Amazon WS account. Amazon WS allows you to have [http://aws.amazon.com/free/ free tier so you can learn Amazon WS (EC2, S3, Elastic Load Balancer, Block Storage, SimpleDB, Simple Queue Service, Simple Notification Service)].<br />
<br />
<br />
==Fire up an Amazon Instance==<br />
<br />
Fire up an Amazon Instance using Amazon Linux (basically CentOS 5.4). <br />
<br />
http://s3.amazonaws.com/wiki4/cloud_deploy/aws_create_new_instance.png<br />
<br />
<br />
<br />
Then [http://caucho.com/resin-4.0/changes/resin-4.0.24.xtp#RPM install Resin as follows using RPM]:<br />
<br />
<code> <pre><br />
<br />
$ sudo rpm --import http://caucho.com/download/rpm/RPM-GPG-KEY-caucho<br />
$ sudo yum install http://caucho.com/download/rpm/4.0.25/x86_64/resin-pro-4.0.25-1.x86_64.rpm<br />
<br />
</pre></code><br />
<br />
<br />
==Install Resin on a Local Box==<br />
<br />
Install <br />
[http://caucho.com/resin-4.0/admin/starting-resin-install.xtp#InstallingResinusingthedebpackageonUbuntuandDebian Resin] locally so you test locally and deploy. [http://caucho.com/resin-4.0/admin/starting-resin-install.xtp Feel free to install it on any supported OS].<br />
<br />
<br />
Add Caucho's Debian repository to your system's repositories to use automated update tools like Synaptic and apt-get. To do this, add the following line to your /etc/apt/sources.list<br />
<br />
<code> <pre><br />
deb http://caucho.com/download/debian unstable multiverse<br />
</pre></code><br />
<br />
<br />
Then install Resin as follows:<br />
<br />
<code> <pre><br />
apt-get update<br />
apt-get install resin-pro<br />
</pre></code><br />
<br />
It is a good idea to make sure the version you install on Amazon AMI matches the version you install locally.<br />
<br />
You can see that Resin is installed as follows:<br />
<br />
<code> <pre><br />
$ ls /etc/resin<br />
app-default.xml local.d resin.properties resin.xml<br />
<br />
$ ls /var/www/<br />
doc licenses log resin-data watchdog-data webapps<br />
<br />
$ ls /etc/init.d/resin<br />
/etc/init.d/resin<br />
<br />
$ ls -l /usr/local/share/resin<br />
lrwxrwxrwx 1 root root 16 2011-11-18 09:03 /usr/local/share/resin -> resin-pro-4.0.24<br />
<br />
</pre></code><br />
<br />
<br />
Also at this point, Resin should be running as well, and you can verify this with resinctl status:<br />
<br />
<code> <pre><br />
$ resinctl status<br />
Resin/4.0.24 status for watchdog at 127.0.0.1:6600<br />
<br />
watchdog:<br />
watchdog-pid: 7383<br />
<br />
server 'app-0' : ACTIVE<br />
password: missing<br />
watchdog-user: root<br />
user: www-data(www-data)<br />
root: /var/www<br />
conf: /etc/resin/resin.xml<br />
pid: 7590<br />
uptime: 0 days 00h19<br />
<br />
</pre></code><br />
<br />
== Install Maven 3 (Optional, for Roo example) ==<br />
<br />
If you already have a test .war file, you can skip to the deploy section and deploy your own war.<br />
<br />
Install maven. Maven is not in the public Ubuntu repository.<br />
<br />
<code><pre><br />
$ sudo add-apt-repository "deb http://build.discursive.com/apt/ lucid main"<br />
$ sudo apt-get update<br />
$ sudo apt-get install maven<br />
</pre></code><br />
<br />
Create a symbolic link:<br />
<code><pre><br />
$ sudo ln -s /usr/local/maven/bin/mvn /usr/local/bin/mvn<br />
</pre></code><br />
<br />
<br />
== Install Spring Roo (Optional) ==<br />
<br />
If you already have a test .war file, you can skip to the deploy section and deploy your own war.<br />
<br />
[http://static.springsource.org/spring-roo/reference/html/intro.html#intro-installation Download and install Spring Roo using directions at the Spring Roo site].<br />
<br />
This is how I install roo:<br />
<br />
<code><pre><br />
$ unzip spring-roo-1.2.0.RC1.zip<br />
$ sudo mv spring-roo-1.2.0.RC1 /usr/local/share/<br />
$ sudo ln -s /usr/local/share/spring-roo-1.2.0.RC1/ /usr/local/share/spring-roo<br />
$ sudo ln -s /usr/local/share/spring-roo/bin/roo.sh /usr/bin/roo<br />
</pre></code><br />
<br />
At the roo prompt, type hint.<br />
<br />
<code><pre><br />
<br />
$ roo<br />
____ ____ ____ <br />
/ __ \/ __ \/ __ \ <br />
/ /_/ / / / / / / / <br />
/ _, _/ /_/ / /_/ / <br />
/_/ |_|\____/\____/ 1.2.0.RC1 [rev dcaa483]<br />
<br />
<br />
Welcome to Spring Roo. For assistance press TAB or type "hint" then hit ENTER.<br />
...<br />
roo> hint<br />
<br />
..<br />
<br />
</pre></code><br />
<br />
Hint should always let you know what you might want to do next. Please feel free to read the Roo docs for details or just follow along and read the Roo docs later.<br />
<br />
Create the project, this generates maven project files and Spring starter project.<br />
<br />
<code><pre><br />
<br />
roo> project --topLevelPackage com.example.blog<br />
<br />
Created ROOT/pom.xml<br />
Created SRC_MAIN_RESOURCES<br />
Created SRC_MAIN_RESOURCES/log4j.properties<br />
Created SPRING_CONFIG_ROOT<br />
Created SPRING_CONFIG_ROOT/applicationContext.xml<br />
<br />
</pre></code><br />
<br />
Next setup the database and JPA, keep it simple to minimize the amount of things we need to configure later.<br />
<br />
<code><pre><br />
<br />
roo> jpa setup --database H2_IN_MEMORY --provider HIBERNATE <br />
<br />
Created SPRING_CONFIG_ROOT/database.properties<br />
Updated SPRING_CONFIG_ROOT/applicationContext.xml<br />
Created SRC_MAIN_RESOURCES/META-INF/persistence.xml<br />
Updated ROOT/pom.xml [added dependencies com.h2database:h2:1.3.161, org.hibernate:hibernate-core:3.6.8.Final, ...]<br />
<br />
</pre></code><br />
<br />
Create a entity class called blog.<br />
<br />
<code><pre><br />
<br />
roo> entity jpa --class ~.domain.Blog<br />
Created SRC_MAIN_JAVA/com/example/blog/domain<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog.java<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_Configurable.aj<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_Jpa_ActiveRecord.aj<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_ToString.aj<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_Jpa_Entity.aj<br />
<br />
</pre></code><br />
<br />
<br />
Add two fields to the Blog class.<br />
<br />
<code><pre><br />
~.domain.Blog roo> field string --fieldName title<br />
Updated SRC_MAIN_JAVA/com/example/blog/domain/Blog.java<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_JavaBean.aj<br />
<br />
~.domain.Blog roo> field string --fieldName message<br />
Updated SRC_MAIN_JAVA/com/example/blog/domain/Blog.java<br />
Updated SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_JavaBean.aj<br />
</pre></code><br />
<br />
Create the web tier<br />
<code><pre><br />
~.domain.Blog roo> web mvc setup<br />
Created ROOT/src/main/webapp/WEB-INF/spring<br />
Created ROOT/src/main/webapp/WEB-INF/spring/webmvc-config.xml<br />
Created ROOT/src/main/webapp/WEB-INF/web.xml<br />
...<br />
Updated ROOT/src/main/webapp/WEB-INF/web.xml<br />
Updated ROOT/pom.xml [added dependencies org.springframework:spring-webmvc:${spring.version}, ...]<br />
Updated SRC_MAIN_WEBAPP/WEB-INF/views/footer.jspx<br />
</pre></code><br />
<br />
<br />
Generate the web tier. <br />
<br />
<code><pre><br />
~.domain.Blog roo> web mvc all --package ~.web<br />
<br />
Created SRC_MAIN_JAVA/com/example/blog/web<br />
Created SRC_MAIN_JAVA/com/example/blog/web/BlogController.java<br />
...<br />
Created SRC_MAIN_WEBAPP/WEB-INF/views/blogs<br />
Created SRC_MAIN_WEBAPP/WEB-INF/views/blogs/views.xml<br />
Updated SRC_MAIN_WEBAPP/WEB-INF/views/blogs/views.xml<br />
...<br />
Updated SRC_MAIN_WEBAPP/WEB-INF/views/blogs/views.xml<br />
...<br />
Created SRC_MAIN_WEBAPP/WEB-INF/views/blogs/update.jspx<br />
</pre></code><br />
<br />
Package our web app<br />
<br />
<code><pre><br />
roo> perform package<br />
</pre></code><br />
<br />
<br />
Exit roo.<br />
<code><pre><br />
roo> exit<br />
</pre></code><br />
<br />
== Deploy locally and test ==<br />
<br />
Deploy the example Roo app with Resin.<br />
<br />
<code><pre><br />
$ resinctl deploy target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog<br />
<br />
Deployed production/webapp/default/blog from target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
</pre></code><br />
<br />
<br />
You can see if the app was actually deployed:<br />
<br />
<code><pre><br />
$ resinctl deploy-list<br />
<br />
production/webapp/default/blog<br />
</pre></code><br />
<br />
Now you should be able to load the Roo blog example.<br />
<br />
http://localhost:8080/blog/<br />
<br />
<br />
==Create an Elastic IP and assign it to your Amazon WS Linux instance==<br />
<br />
Create an Elastic IP and assign it to the Amazon WS Linux instance using the [http://aws.amazon.com/console/ Amazon web console].<br />
<br />
I got this IP address.<br />
203.0.113.26<br />
<br />
<br />
==Create password==<br />
<br />
<br />
<code><pre><br />
$ resinctl generate-password -user admin -password roofoo<br />
<br />
admin_user : admin<br />
admin_password : {SSHA}BGBKQdCr0a5orH99eqIFwR/fffffffff<br />
<br />
</pre></code><br />
<br />
==Create a properties file and put it into user-data of Amazon AMI==<br />
<br />
[http://caucho.com/resin-4.0/changes/resin-4.0.24.xtp#resinproperties Resin properties].<br />
<br />
<br />
<code><pre><br />
log_level : info<br />
dev_mode : true<br />
resin_doc : true<br />
<br />
app_tier : 127.0.0.1<br />
web_tier :<br />
cache_tier :<br />
<br />
setuid_user : www-data<br />
setuid_group : www-data<br />
<br />
http : 8080<br />
https : 8443<br />
<br />
admin_user : admin<br />
admin_password : {SSHA}BGBKQdCr0a5orH99eqIFwR/ffffffff<br />
admin_external : true<br />
admin_remote_enable : true<br />
session_store : true<br />
<br />
</pre></code><br />
<br />
<br />
Create an amazon.xml <br />
<br />
<br />
<code><pre><br />
<resin xmlns="http://caucho.com/ns/resin"<br />
xmlns:resin="urn:java:com.caucho.resin"><br />
<br />
<resin:properties path="http://169.254.169.254/latest/user-data"<br />
optional="true"/><br />
<br />
</resin><br />
</pre></code><br />
<br />
<br />
Log into Amazon AMI instance and add the above to /etc/resin/local.d/amazon.xml.<br />
<br />
<br />
<code><pre><br />
$ ssh -i resin2.pem ec2-user@203.0.113.26 <br />
$ sudo nano /etc/resin/local.d/amazon.xml<br />
</pre></code><br />
<br />
From your local machine execute this command:<br />
<br />
<br />
<code><pre><br />
$ resinctl deploy target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -address 203.0.113.26 -port 8080 -user admin -password roofoo<br />
</pre></code><br />
<br />
<br />
Now it works in the cloud:<br />
<br />
http://203.0.113.26:8080/blog/<br />
<br />
<br />
Next step learn how to spin up instances with eucatools [[Resin Cloud deployment with Amazon WS EC2 and Euca Tools]].<br />
<br />
<br />
Next step learn how to use MySQL setup with Resin and Amazon RDS [[Resin MySQL and RDS setup with Amazon RDS]].<br />
<br />
<br />
[[Resin Cloud Deployment Reference]]</div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_deployment_with_AmazonResin Cloud deployment with Amazon2012-01-25T00:00:00Z<p>Rickhigh: </p>
<hr />
<div>[[Category: Cookbook]] [[Category:Cloud]]<br />
<br />
This tutorial is going to cover the basics of using Resin with Amazon Web Services for cloud deployment. If you are new to cloud computing and IaaS ([http:///en.wikipedia.org/wiki/Cloud_computing#Infrastructure Infrastructure as a Service]), follow along and you will soon be deploying Java web applications in the cloud. You wil create an EC2 instance. You will download and install Resin on Ubuntu on a local machine. You will install Resin on an Amazon Linux AMI instance (EC2 instance). You will use Roo to create a simple application and deploy it.<br />
<br />
We use [http://www.springsource.org/spring-roo Roo because Spring] is fairly widely used, and Roo is a quick way to generate a sample app. Future tutorials will use other common Java tools as well as show you how to configure and manage a complete Resin cluster. Think of this as the first tutorial in a series of tutorials.<br />
<br />
<br />
For this tutorial you will need Resin 4.0.24 or later. Check back periodically because as we are going to expand the tutorial and improve Resin's support of cloud deployments. The Resin engineering team plans on improving cloud support continuously.<br />
<br />
Many of the steps in this tutorial would be similar even if you were using [http://www.eucalyptus.com/ Eucalyptus], [http://cloudstack.com/ CloudStack] with [http://cloudstack.org/download.html CloudBridge], [http://www.rightscale.com/products/plans-pricing/mycloud.php RightScale myCloud] or even [http://opennebula.org/documentation:rel3.0:ec2qcg OpenNebula] this guide should help you along as they all support the Amazon EC2 REST APIs. Also any cloud computing environment (private or public, on premises or hosted) will have similar characteristics. Thus even if you are using a private cloud using [http://www.openstack.org/ OpenStack] like [http://deliver.citrix.com/projectolympus Project Olympus], the principles will be the same. In fact even using remote servers deployed in a datacenter or virtualized servers with [http://www.citrix.com/English/ps2/products/subfeature.asp?contentID=2300456 Xen Server], [http://xen.org/products/cloudxen.html Xen Cloud] or [http://www.vmware.com/products/vsphere/overview.html VMWare vSphere] the steps will be very similar.<br />
<br />
<br />
For this tutorial we expect you are familiar with starting, and stopping Amazon WS instances. If you are not, go through this [http://docs.amazonwebservices.com/AWSEC2/latest/GettingStartedGuide/ tutorial from Amazon WS]. You will need an Amazon WS account. Amazon WS allows you to have [http://aws.amazon.com/free/ free tier so you can learn Amazon WS (EC2, S3, Elastic Load Balancer, Block Storage, SimpleDB, Simple Queue Service, Simple Notification Service)].<br />
<br />
<br />
==Fire up an Amazon Instance==<br />
<br />
Fire up an Amazon Instance using Amazon Linux (basically CentOS 5.4). <br />
<br />
http://s3.amazonaws.com/wiki4/cloud_deploy/aws_create_new_instance.png<br />
<br />
<br />
<br />
Then [http://caucho.com/resin-4.0/changes/resin-4.0.24.xtp#RPM install Resin as follows using RPM]:<br />
<br />
<code> <pre><br />
<br />
$ sudo rpm --import http://caucho.com/download/rpm/RPM-GPG-KEY-caucho<br />
$ sudo yum install http://caucho.com/download/rpm/4.0.24/x86_64/resin-pro-4.0.24-1.x86_64.rpm<br />
<br />
</pre></code><br />
<br />
<br />
==Install Resin on a Local Box==<br />
<br />
Install <br />
[http://caucho.com/resin-4.0/admin/starting-resin-install.xtp#InstallingResinusingthedebpackageonUbuntuandDebian Resin] locally so you test locally and deploy. [http://caucho.com/resin-4.0/admin/starting-resin-install.xtp Feel free to install it on any supported OS].<br />
<br />
<br />
Add Caucho's Debian repository to your system's repositories to use automated update tools like Synaptic and apt-get. To do this, add the following line to your /etc/apt/sources.list<br />
<br />
<code> <pre><br />
deb http://caucho.com/download/debian unstable multiverse<br />
</pre></code><br />
<br />
<br />
Then install Resin as follows:<br />
<br />
<code> <pre><br />
apt-get update<br />
apt-get install resin-pro<br />
</pre></code><br />
<br />
It is a good idea to make sure the version you install on Amazon AMI matches the version you install locally.<br />
<br />
You can see that Resin is installed as follows:<br />
<br />
<code> <pre><br />
$ ls /etc/resin<br />
app-default.xml local.d resin.properties resin.xml<br />
<br />
$ ls /var/www/<br />
doc licenses log resin-data watchdog-data webapps<br />
<br />
$ ls /etc/init.d/resin<br />
/etc/init.d/resin<br />
<br />
$ ls -l /usr/local/share/resin<br />
lrwxrwxrwx 1 root root 16 2011-11-18 09:03 /usr/local/share/resin -> resin-pro-4.0.24<br />
<br />
</pre></code><br />
<br />
<br />
Also at this point, Resin should be running as well, and you can verify this with resinctl status:<br />
<br />
<code> <pre><br />
$ resinctl status<br />
Resin/4.0.24 status for watchdog at 127.0.0.1:6600<br />
<br />
watchdog:<br />
watchdog-pid: 7383<br />
<br />
server 'app-0' : ACTIVE<br />
password: missing<br />
watchdog-user: root<br />
user: www-data(www-data)<br />
root: /var/www<br />
conf: /etc/resin/resin.xml<br />
pid: 7590<br />
uptime: 0 days 00h19<br />
<br />
</pre></code><br />
<br />
== Install Maven 3 (Optional, for Roo example) ==<br />
<br />
If you already have a test .war file, you can skip to the deploy section and deploy your own war.<br />
<br />
Install maven. Maven is not in the public Ubuntu repository.<br />
<br />
<code><pre><br />
$ sudo add-apt-repository "deb http://build.discursive.com/apt/ lucid main"<br />
$ sudo apt-get update<br />
$ sudo apt-get install maven<br />
</pre></code><br />
<br />
Create a symbolic link:<br />
<code><pre><br />
$ sudo ln -s /usr/local/maven/bin/mvn /usr/local/bin/mvn<br />
</pre></code><br />
<br />
<br />
== Install Spring Roo (Optional) ==<br />
<br />
If you already have a test .war file, you can skip to the deploy section and deploy your own war.<br />
<br />
[http://static.springsource.org/spring-roo/reference/html/intro.html#intro-installation Download and install Spring Roo using directions at the Spring Roo site].<br />
<br />
This is how I install roo:<br />
<br />
<code><pre><br />
$ unzip spring-roo-1.2.0.RC1.zip<br />
$ sudo mv spring-roo-1.2.0.RC1 /usr/local/share/<br />
$ sudo ln -s /usr/local/share/spring-roo-1.2.0.RC1/ /usr/local/share/spring-roo<br />
$ sudo ln -s /usr/local/share/spring-roo/bin/roo.sh /usr/bin/roo<br />
</pre></code><br />
<br />
At the roo prompt, type hint.<br />
<br />
<code><pre><br />
<br />
$ roo<br />
____ ____ ____ <br />
/ __ \/ __ \/ __ \ <br />
/ /_/ / / / / / / / <br />
/ _, _/ /_/ / /_/ / <br />
/_/ |_|\____/\____/ 1.2.0.RC1 [rev dcaa483]<br />
<br />
<br />
Welcome to Spring Roo. For assistance press TAB or type "hint" then hit ENTER.<br />
...<br />
roo> hint<br />
<br />
..<br />
<br />
</pre></code><br />
<br />
Hint should always let you know what you might want to do next. Please feel free to read the Roo docs for details or just follow along and read the Roo docs later.<br />
<br />
Create the project, this generates maven project files and Spring starter project.<br />
<br />
<code><pre><br />
<br />
roo> project --topLevelPackage com.example.blog<br />
<br />
Created ROOT/pom.xml<br />
Created SRC_MAIN_RESOURCES<br />
Created SRC_MAIN_RESOURCES/log4j.properties<br />
Created SPRING_CONFIG_ROOT<br />
Created SPRING_CONFIG_ROOT/applicationContext.xml<br />
<br />
</pre></code><br />
<br />
Next setup the database and JPA, keep it simple to minimize the amount of things we need to configure later.<br />
<br />
<code><pre><br />
<br />
roo> jpa setup --database H2_IN_MEMORY --provider HIBERNATE <br />
<br />
Created SPRING_CONFIG_ROOT/database.properties<br />
Updated SPRING_CONFIG_ROOT/applicationContext.xml<br />
Created SRC_MAIN_RESOURCES/META-INF/persistence.xml<br />
Updated ROOT/pom.xml [added dependencies com.h2database:h2:1.3.161, org.hibernate:hibernate-core:3.6.8.Final, ...]<br />
<br />
</pre></code><br />
<br />
Create a entity class called blog.<br />
<br />
<code><pre><br />
<br />
roo> entity jpa --class ~.domain.Blog<br />
Created SRC_MAIN_JAVA/com/example/blog/domain<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog.java<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_Configurable.aj<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_Jpa_ActiveRecord.aj<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_ToString.aj<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_Jpa_Entity.aj<br />
<br />
</pre></code><br />
<br />
<br />
Add two fields to the Blog class.<br />
<br />
<code><pre><br />
~.domain.Blog roo> field string --fieldName title<br />
Updated SRC_MAIN_JAVA/com/example/blog/domain/Blog.java<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_JavaBean.aj<br />
<br />
~.domain.Blog roo> field string --fieldName message<br />
Updated SRC_MAIN_JAVA/com/example/blog/domain/Blog.java<br />
Updated SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_JavaBean.aj<br />
</pre></code><br />
<br />
Create the web tier<br />
<code><pre><br />
~.domain.Blog roo> web mvc setup<br />
Created ROOT/src/main/webapp/WEB-INF/spring<br />
Created ROOT/src/main/webapp/WEB-INF/spring/webmvc-config.xml<br />
Created ROOT/src/main/webapp/WEB-INF/web.xml<br />
...<br />
Updated ROOT/src/main/webapp/WEB-INF/web.xml<br />
Updated ROOT/pom.xml [added dependencies org.springframework:spring-webmvc:${spring.version}, ...]<br />
Updated SRC_MAIN_WEBAPP/WEB-INF/views/footer.jspx<br />
</pre></code><br />
<br />
<br />
Generate the web tier. <br />
<br />
<code><pre><br />
~.domain.Blog roo> web mvc all --package ~.web<br />
<br />
Created SRC_MAIN_JAVA/com/example/blog/web<br />
Created SRC_MAIN_JAVA/com/example/blog/web/BlogController.java<br />
...<br />
Created SRC_MAIN_WEBAPP/WEB-INF/views/blogs<br />
Created SRC_MAIN_WEBAPP/WEB-INF/views/blogs/views.xml<br />
Updated SRC_MAIN_WEBAPP/WEB-INF/views/blogs/views.xml<br />
...<br />
Updated SRC_MAIN_WEBAPP/WEB-INF/views/blogs/views.xml<br />
...<br />
Created SRC_MAIN_WEBAPP/WEB-INF/views/blogs/update.jspx<br />
</pre></code><br />
<br />
Package our web app<br />
<br />
<code><pre><br />
roo> perform package<br />
</pre></code><br />
<br />
<br />
Exit roo.<br />
<code><pre><br />
roo> exit<br />
</pre></code><br />
<br />
== Deploy locally and test ==<br />
<br />
Deploy the example Roo app with Resin.<br />
<br />
<code><pre><br />
$ resinctl deploy target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog<br />
<br />
Deployed production/webapp/default/blog from target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
</pre></code><br />
<br />
<br />
You can see if the app was actually deployed:<br />
<br />
<code><pre><br />
$ resinctl deploy-list<br />
<br />
production/webapp/default/blog<br />
</pre></code><br />
<br />
Now you should be able to load the Roo blog example.<br />
<br />
http://localhost:8080/blog/<br />
<br />
<br />
==Create an Elastic IP and assign it to your Amazon WS Linux instance==<br />
<br />
Create an Elastic IP and assign it to the Amazon WS Linux instance using the [http://aws.amazon.com/console/ Amazon web console].<br />
<br />
I got this IP address.<br />
203.0.113.26<br />
<br />
<br />
==Create password==<br />
<br />
<br />
<code><pre><br />
$ resinctl generate-password -user admin -password roofoo<br />
<br />
admin_user : admin<br />
admin_password : {SSHA}BGBKQdCr0a5orH99eqIFwR/fffffffff<br />
<br />
</pre></code><br />
<br />
==Create a properties file and put it into user-data of Amazon AMI==<br />
<br />
[http://caucho.com/resin-4.0/changes/resin-4.0.24.xtp#resinproperties Resin properties].<br />
<br />
<br />
<code><pre><br />
log_level : info<br />
dev_mode : true<br />
resin_doc : true<br />
<br />
app_tier : 127.0.0.1<br />
web_tier :<br />
cache_tier :<br />
<br />
setuid_user : www-data<br />
setuid_group : www-data<br />
<br />
http : 8080<br />
https : 8443<br />
<br />
admin_user : admin<br />
admin_password : {SSHA}BGBKQdCr0a5orH99eqIFwR/ffffffff<br />
admin_external : true<br />
admin_remote_enable : true<br />
session_store : true<br />
<br />
</pre></code><br />
<br />
<br />
Create an amazon.xml <br />
<br />
<br />
<code><pre><br />
<resin xmlns="http://caucho.com/ns/resin"<br />
xmlns:resin="urn:java:com.caucho.resin"><br />
<br />
<resin:properties path="http://169.254.169.254/latest/user-data"<br />
optional="true"/><br />
<br />
</resin><br />
</pre></code><br />
<br />
<br />
Log into Amazon AMI instance and add the above to /etc/resin/local.d/amazon.xml.<br />
<br />
<br />
<code><pre><br />
$ ssh -i resin2.pem ec2-user@203.0.113.26 <br />
$ sudo nano /etc/resin/local.d/amazon.xml<br />
</pre></code><br />
<br />
From your local machine execute this command:<br />
<br />
<br />
<code><pre><br />
$ resinctl deploy target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -address 203.0.113.26 -port 8080 -user admin -password roofoo<br />
</pre></code><br />
<br />
<br />
Now it works in the cloud:<br />
<br />
http://203.0.113.26:8080/blog/<br />
<br />
<br />
Next step learn how to spin up instances with eucatools [[Resin Cloud deployment with Amazon WS EC2 and Euca Tools]].<br />
<br />
<br />
Next step learn how to use MySQL setup with Resin and Amazon RDS [[Resin MySQL and RDS setup with Amazon RDS]].<br />
<br />
<br />
[[Resin Cloud Deployment Reference]]</div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_deployment_with_AmazonResin Cloud deployment with Amazon2012-01-25T00:00:00Z<p>Rickhigh: </p>
<hr />
<div>[[Category: Cookbook]] [[Category:Cloud]]<br />
<br />
This tutorial is going to cover the basics of using Resin with Amazon Web Services for cloud deployment. If you are new to cloud computing and IaaS ([http:///en.wikipedia.org/wiki/Cloud_computing#Infrastructure Infrastructure as a Service]), follow along and you will soon be deploying Java web applications in the cloud. You wil create an EC2 instance. You will download and install Resin on Ubuntu on a local machine. You will install Resin on an Amazon Linux AMI instance (EC2 instance). You will use Roo to create a simple application and deploy it.<br />
<br />
We use [http://www.springsource.org/spring-roo Roo because Spring] is fairly widely used, and Roo is a quick way to generate a sample app. Future tutorials will use other common Java tools as well as show you how to configure and manage a complete Resin cluster. Think of this as the first tutorial in a series of tutorials.<br />
<br />
<br />
For this tutorial you will need Resin 4.0.24 or later. Check back periodically because as we are going to expand the tutorial and improve Resin's support of cloud deployments. The Resin engineering team plans on improving cloud support continuously.<br />
<br />
Many of the steps in this tutorial would be similar even if you were using [http://www.eucalyptus.com/ Eucalyptus], [http://cloudstack.com/ CloudStack] with [http://cloudstack.org/download.html CloudBridge], [http://www.rightscale.com/products/plans-pricing/mycloud.php RightScale myCloud] or even [http://opennebula.org/documentation:rel3.0:ec2qcg OpenNebula] this guide should help you along as they all support the Amazon EC2 REST APIs. Also any cloud computing environment (private or public, on premises or hosted) will have similar characteristics. Thus even if you are using a private cloud using [http://www.openstack.org/ OpenStack] like [http://deliver.citrix.com/projectolympus Project Olympus], the principles will be the same. In fact even using remote servers deployed in a datacenter or virtualized servers with [http://www.citrix.com/English/ps2/products/subfeature.asp?contentID=2300456 Xen Server], [http://xen.org/products/cloudxen.html Xen Cloud] or [http://www.vmware.com/products/vsphere/overview.html VMWare vSphere] the steps will be very similar.<br />
<br />
<br />
For this tutorial we expect you are familiar with starting, and stopping Amazon WS instances. If you are not, go through this [http://docs.amazonwebservices.com/AWSEC2/latest/GettingStartedGuide/ tutorial from Amazon WS]. You will need an Amazon WS account. Amazon WS allows you to have [http://aws.amazon.com/free/ free tier so you can learn Amazon WS (EC2, S3, Elastic Load Balancer, Block Storage, SimpleDB, Simple Queue Service, Simple Notification Service)].<br />
<br />
<br />
==Fire up an Amazon Instance==<br />
<br />
Fire up an Amazon Instance using Amazon Linux (basically CentOS 5.4). <br />
<br />
[[http://s3.amazonaws.com/wiki4/cloud_deploy/aws_create_new_instance.png|Creating Amazon Linux instance for Resin Application Server]]<br />
<br />
<br />
<br />
Then [http://caucho.com/resin-4.0/changes/resin-4.0.24.xtp#RPM install Resin as follows using RPM]:<br />
<br />
<code> <pre><br />
<br />
$ sudo rpm --import http://caucho.com/download/rpm/RPM-GPG-KEY-caucho<br />
$ sudo yum install http://caucho.com/download/rpm/4.0.24/x86_64/resin-pro-4.0.24-1.x86_64.rpm<br />
<br />
</pre></code><br />
<br />
<br />
==Install Resin on a Local Box==<br />
<br />
Install <br />
[http://caucho.com/resin-4.0/admin/starting-resin-install.xtp#InstallingResinusingthedebpackageonUbuntuandDebian Resin] locally so you test locally and deploy. [http://caucho.com/resin-4.0/admin/starting-resin-install.xtp Feel free to install it on any supported OS].<br />
<br />
<br />
Add Caucho's Debian repository to your system's repositories to use automated update tools like Synaptic and apt-get. To do this, add the following line to your /etc/apt/sources.list<br />
<br />
<code> <pre><br />
deb http://caucho.com/download/debian unstable multiverse<br />
</pre></code><br />
<br />
<br />
Then install Resin as follows:<br />
<br />
<code> <pre><br />
apt-get update<br />
apt-get install resin-pro<br />
</pre></code><br />
<br />
It is a good idea to make sure the version you install on Amazon AMI matches the version you install locally.<br />
<br />
You can see that Resin is installed as follows:<br />
<br />
<code> <pre><br />
$ ls /etc/resin<br />
app-default.xml local.d resin.properties resin.xml<br />
<br />
$ ls /var/www/<br />
doc licenses log resin-data watchdog-data webapps<br />
<br />
$ ls /etc/init.d/resin<br />
/etc/init.d/resin<br />
<br />
$ ls -l /usr/local/share/resin<br />
lrwxrwxrwx 1 root root 16 2011-11-18 09:03 /usr/local/share/resin -> resin-pro-4.0.24<br />
<br />
</pre></code><br />
<br />
<br />
Also at this point, Resin should be running as well, and you can verify this with resinctl status:<br />
<br />
<code> <pre><br />
$ resinctl status<br />
Resin/4.0.24 status for watchdog at 127.0.0.1:6600<br />
<br />
watchdog:<br />
watchdog-pid: 7383<br />
<br />
server 'app-0' : ACTIVE<br />
password: missing<br />
watchdog-user: root<br />
user: www-data(www-data)<br />
root: /var/www<br />
conf: /etc/resin/resin.xml<br />
pid: 7590<br />
uptime: 0 days 00h19<br />
<br />
</pre></code><br />
<br />
== Install Maven 3 (Optional, for Roo example) ==<br />
<br />
If you already have a test .war file, you can skip to the deploy section and deploy your own war.<br />
<br />
Install maven. Maven is not in the public Ubuntu repository.<br />
<br />
<code><pre><br />
$ sudo add-apt-repository "deb http://build.discursive.com/apt/ lucid main"<br />
$ sudo apt-get update<br />
$ sudo apt-get install maven<br />
</pre></code><br />
<br />
Create a symbolic link:<br />
<code><pre><br />
$ sudo ln -s /usr/local/maven/bin/mvn /usr/local/bin/mvn<br />
</pre></code><br />
<br />
<br />
== Install Spring Roo (Optional) ==<br />
<br />
If you already have a test .war file, you can skip to the deploy section and deploy your own war.<br />
<br />
[http://static.springsource.org/spring-roo/reference/html/intro.html#intro-installation Download and install Spring Roo using directions at the Spring Roo site].<br />
<br />
This is how I install roo:<br />
<br />
<code><pre><br />
$ unzip spring-roo-1.2.0.RC1.zip<br />
$ sudo mv spring-roo-1.2.0.RC1 /usr/local/share/<br />
$ sudo ln -s /usr/local/share/spring-roo-1.2.0.RC1/ /usr/local/share/spring-roo<br />
$ sudo ln -s /usr/local/share/spring-roo/bin/roo.sh /usr/bin/roo<br />
</pre></code><br />
<br />
At the roo prompt, type hint.<br />
<br />
<code><pre><br />
<br />
$ roo<br />
____ ____ ____ <br />
/ __ \/ __ \/ __ \ <br />
/ /_/ / / / / / / / <br />
/ _, _/ /_/ / /_/ / <br />
/_/ |_|\____/\____/ 1.2.0.RC1 [rev dcaa483]<br />
<br />
<br />
Welcome to Spring Roo. For assistance press TAB or type "hint" then hit ENTER.<br />
...<br />
roo> hint<br />
<br />
..<br />
<br />
</pre></code><br />
<br />
Hint should always let you know what you might want to do next. Please feel free to read the Roo docs for details or just follow along and read the Roo docs later.<br />
<br />
Create the project, this generates maven project files and Spring starter project.<br />
<br />
<code><pre><br />
<br />
roo> project --topLevelPackage com.example.blog<br />
<br />
Created ROOT/pom.xml<br />
Created SRC_MAIN_RESOURCES<br />
Created SRC_MAIN_RESOURCES/log4j.properties<br />
Created SPRING_CONFIG_ROOT<br />
Created SPRING_CONFIG_ROOT/applicationContext.xml<br />
<br />
</pre></code><br />
<br />
Next setup the database and JPA, keep it simple to minimize the amount of things we need to configure later.<br />
<br />
<code><pre><br />
<br />
roo> jpa setup --database H2_IN_MEMORY --provider HIBERNATE <br />
<br />
Created SPRING_CONFIG_ROOT/database.properties<br />
Updated SPRING_CONFIG_ROOT/applicationContext.xml<br />
Created SRC_MAIN_RESOURCES/META-INF/persistence.xml<br />
Updated ROOT/pom.xml [added dependencies com.h2database:h2:1.3.161, org.hibernate:hibernate-core:3.6.8.Final, ...]<br />
<br />
</pre></code><br />
<br />
Create a entity class called blog.<br />
<br />
<code><pre><br />
<br />
roo> entity jpa --class ~.domain.Blog<br />
Created SRC_MAIN_JAVA/com/example/blog/domain<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog.java<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_Configurable.aj<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_Jpa_ActiveRecord.aj<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_ToString.aj<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_Jpa_Entity.aj<br />
<br />
</pre></code><br />
<br />
<br />
Add two fields to the Blog class.<br />
<br />
<code><pre><br />
~.domain.Blog roo> field string --fieldName title<br />
Updated SRC_MAIN_JAVA/com/example/blog/domain/Blog.java<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_JavaBean.aj<br />
<br />
~.domain.Blog roo> field string --fieldName message<br />
Updated SRC_MAIN_JAVA/com/example/blog/domain/Blog.java<br />
Updated SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_JavaBean.aj<br />
</pre></code><br />
<br />
Create the web tier<br />
<code><pre><br />
~.domain.Blog roo> web mvc setup<br />
Created ROOT/src/main/webapp/WEB-INF/spring<br />
Created ROOT/src/main/webapp/WEB-INF/spring/webmvc-config.xml<br />
Created ROOT/src/main/webapp/WEB-INF/web.xml<br />
...<br />
Updated ROOT/src/main/webapp/WEB-INF/web.xml<br />
Updated ROOT/pom.xml [added dependencies org.springframework:spring-webmvc:${spring.version}, ...]<br />
Updated SRC_MAIN_WEBAPP/WEB-INF/views/footer.jspx<br />
</pre></code><br />
<br />
<br />
Generate the web tier. <br />
<br />
<code><pre><br />
~.domain.Blog roo> web mvc all --package ~.web<br />
<br />
Created SRC_MAIN_JAVA/com/example/blog/web<br />
Created SRC_MAIN_JAVA/com/example/blog/web/BlogController.java<br />
...<br />
Created SRC_MAIN_WEBAPP/WEB-INF/views/blogs<br />
Created SRC_MAIN_WEBAPP/WEB-INF/views/blogs/views.xml<br />
Updated SRC_MAIN_WEBAPP/WEB-INF/views/blogs/views.xml<br />
...<br />
Updated SRC_MAIN_WEBAPP/WEB-INF/views/blogs/views.xml<br />
...<br />
Created SRC_MAIN_WEBAPP/WEB-INF/views/blogs/update.jspx<br />
</pre></code><br />
<br />
Package our web app<br />
<br />
<code><pre><br />
roo> perform package<br />
</pre></code><br />
<br />
<br />
Exit roo.<br />
<code><pre><br />
roo> exit<br />
</pre></code><br />
<br />
== Deploy locally and test ==<br />
<br />
Deploy the example Roo app with Resin.<br />
<br />
<code><pre><br />
$ resinctl deploy target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog<br />
<br />
Deployed production/webapp/default/blog from target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
</pre></code><br />
<br />
<br />
You can see if the app was actually deployed:<br />
<br />
<code><pre><br />
$ resinctl deploy-list<br />
<br />
production/webapp/default/blog<br />
</pre></code><br />
<br />
Now you should be able to load the Roo blog example.<br />
<br />
http://localhost:8080/blog/<br />
<br />
<br />
==Create an Elastic IP and assign it to your Amazon WS Linux instance==<br />
<br />
Create an Elastic IP and assign it to the Amazon WS Linux instance using the [http://aws.amazon.com/console/ Amazon web console].<br />
<br />
I got this IP address.<br />
203.0.113.26<br />
<br />
<br />
==Create password==<br />
<br />
<br />
<code><pre><br />
$ resinctl generate-password -user admin -password roofoo<br />
<br />
admin_user : admin<br />
admin_password : {SSHA}BGBKQdCr0a5orH99eqIFwR/fffffffff<br />
<br />
</pre></code><br />
<br />
==Create a properties file and put it into user-data of Amazon AMI==<br />
<br />
[http://caucho.com/resin-4.0/changes/resin-4.0.24.xtp#resinproperties Resin properties].<br />
<br />
<br />
<code><pre><br />
log_level : info<br />
dev_mode : true<br />
resin_doc : true<br />
<br />
app_tier : 127.0.0.1<br />
web_tier :<br />
cache_tier :<br />
<br />
setuid_user : www-data<br />
setuid_group : www-data<br />
<br />
http : 8080<br />
https : 8443<br />
<br />
admin_user : admin<br />
admin_password : {SSHA}BGBKQdCr0a5orH99eqIFwR/ffffffff<br />
admin_external : true<br />
admin_remote_enable : true<br />
session_store : true<br />
<br />
</pre></code><br />
<br />
<br />
Create an amazon.xml <br />
<br />
<br />
<code><pre><br />
<resin xmlns="http://caucho.com/ns/resin"<br />
xmlns:resin="urn:java:com.caucho.resin"><br />
<br />
<resin:properties path="http://169.254.169.254/latest/user-data"<br />
optional="true"/><br />
<br />
</resin><br />
</pre></code><br />
<br />
<br />
Log into Amazon AMI instance and add the above to /etc/resin/local.d/amazon.xml.<br />
<br />
<br />
<code><pre><br />
$ ssh -i resin2.pem ec2-user@203.0.113.26 <br />
$ sudo nano /etc/resin/local.d/amazon.xml<br />
</pre></code><br />
<br />
From your local machine execute this command:<br />
<br />
<br />
<code><pre><br />
$ resinctl deploy target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -address 203.0.113.26 -port 8080 -user admin -password roofoo<br />
</pre></code><br />
<br />
<br />
Now it works in the cloud:<br />
<br />
http://203.0.113.26:8080/blog/<br />
<br />
<br />
Next step learn how to spin up instances with eucatools [[Resin Cloud deployment with Amazon WS EC2 and Euca Tools]].<br />
<br />
<br />
Next step learn how to use MySQL setup with Resin and Amazon RDS [[Resin MySQL and RDS setup with Amazon RDS]].<br />
<br />
<br />
[[Resin Cloud Deployment Reference]]</div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_deployment_with_AmazonResin Cloud deployment with Amazon2012-01-25T00:00:00Z<p>Rickhigh: </p>
<hr />
<div>[[Category: Cookbook]] [[Category:Cloud]]<br />
<br />
This tutorial is going to cover the basics of using Resin with Amazon Web Services for cloud deployment. If you are new to cloud computing and IaaS ([http:///en.wikipedia.org/wiki/Cloud_computing#Infrastructure Infrastructure as a Service]), follow along and you will soon be deploying Java web applications in the cloud. You wil create an EC2 instance. You will download and install Resin on Ubuntu on a local machine. You will install Resin on an Amazon Linux AMI instance (EC2 instance). You will use Roo to create a simple application and deploy it.<br />
<br />
We use [http://www.springsource.org/spring-roo Roo because Spring] is fairly widely used, and Roo is a quick way to generate a sample app. Future tutorials will use other common Java tools as well as show you how to configure and manage a complete Resin cluster. Think of this as the first tutorial in a series of tutorials.<br />
<br />
<br />
For this tutorial you will need Resin 4.0.24 or later. Check back periodically because as we are going to expand the tutorial and improve Resin's support of cloud deployments. The Resin engineering team plans on improving cloud support continuously.<br />
<br />
Many of the steps in this tutorial would be similar even if you were using [http://www.eucalyptus.com/ Eucalyptus], [http://cloudstack.com/ CloudStack] with [http://cloudstack.org/download.html CloudBridge], [http://www.rightscale.com/products/plans-pricing/mycloud.php RightScale myCloud] or even [http://opennebula.org/documentation:rel3.0:ec2qcg OpenNebula] this guide should help you along as they all support the Amazon EC2 REST APIs. Also any cloud computing environment (private or public, on premises or hosted) will have similar characteristics. Thus even if you are using a private cloud using [http://www.openstack.org/ OpenStack] like [http://deliver.citrix.com/projectolympus Project Olympus], the principles will be the same. In fact even using remote servers deployed in a datacenter or virtualized servers with [http://www.citrix.com/English/ps2/products/subfeature.asp?contentID=2300456 Xen Server], [http://xen.org/products/cloudxen.html Xen Cloud] or [http://www.vmware.com/products/vsphere/overview.html VMWare vSphere] the steps will be very similar.<br />
<br />
<br />
For this tutorial we expect you are familiar with starting, and stopping Amazon WS instances. If you are not, go through this [http://docs.amazonwebservices.com/AWSEC2/latest/GettingStartedGuide/ tutorial from Amazon WS]. You will need an Amazon WS account. Amazon WS allows you to have [http://aws.amazon.com/free/ free tier so you can learn Amazon WS (EC2, S3, Elastic Load Balancer, Block Storage, SimpleDB, Simple Queue Service, Simple Notification Service)].<br />
<br />
<br />
==Fire up an Amazon Instance==<br />
<br />
Fire up an Amazon Instance using Amazon Linux (basically CentOS 5.4). <br />
<br />
[[File:https://s3.amazonaws.com/wiki4/cloud_deploy/aws_create_new_instance.png|Creating Amazon Linux instance for Resin Application Server]]<br />
<br />
<br />
<br />
Then [http://caucho.com/resin-4.0/changes/resin-4.0.24.xtp#RPM install Resin as follows using RPM]:<br />
<br />
<code> <pre><br />
<br />
$ sudo rpm --import http://caucho.com/download/rpm/RPM-GPG-KEY-caucho<br />
$ sudo yum install http://caucho.com/download/rpm/4.0.24/x86_64/resin-pro-4.0.24-1.x86_64.rpm<br />
<br />
</pre></code><br />
<br />
<br />
==Install Resin on a Local Box==<br />
<br />
Install <br />
[http://caucho.com/resin-4.0/admin/starting-resin-install.xtp#InstallingResinusingthedebpackageonUbuntuandDebian Resin] locally so you test locally and deploy. [http://caucho.com/resin-4.0/admin/starting-resin-install.xtp Feel free to install it on any supported OS].<br />
<br />
<br />
Add Caucho's Debian repository to your system's repositories to use automated update tools like Synaptic and apt-get. To do this, add the following line to your /etc/apt/sources.list<br />
<br />
<code> <pre><br />
deb http://caucho.com/download/debian unstable multiverse<br />
</pre></code><br />
<br />
<br />
Then install Resin as follows:<br />
<br />
<code> <pre><br />
apt-get update<br />
apt-get install resin-pro<br />
</pre></code><br />
<br />
It is a good idea to make sure the version you install on Amazon AMI matches the version you install locally.<br />
<br />
You can see that Resin is installed as follows:<br />
<br />
<code> <pre><br />
$ ls /etc/resin<br />
app-default.xml local.d resin.properties resin.xml<br />
<br />
$ ls /var/www/<br />
doc licenses log resin-data watchdog-data webapps<br />
<br />
$ ls /etc/init.d/resin<br />
/etc/init.d/resin<br />
<br />
$ ls -l /usr/local/share/resin<br />
lrwxrwxrwx 1 root root 16 2011-11-18 09:03 /usr/local/share/resin -> resin-pro-4.0.24<br />
<br />
</pre></code><br />
<br />
<br />
Also at this point, Resin should be running as well, and you can verify this with resinctl status:<br />
<br />
<code> <pre><br />
$ resinctl status<br />
Resin/4.0.24 status for watchdog at 127.0.0.1:6600<br />
<br />
watchdog:<br />
watchdog-pid: 7383<br />
<br />
server 'app-0' : ACTIVE<br />
password: missing<br />
watchdog-user: root<br />
user: www-data(www-data)<br />
root: /var/www<br />
conf: /etc/resin/resin.xml<br />
pid: 7590<br />
uptime: 0 days 00h19<br />
<br />
</pre></code><br />
<br />
== Install Maven 3 (Optional, for Roo example) ==<br />
<br />
If you already have a test .war file, you can skip to the deploy section and deploy your own war.<br />
<br />
Install maven. Maven is not in the public Ubuntu repository.<br />
<br />
<code><pre><br />
$ sudo add-apt-repository "deb http://build.discursive.com/apt/ lucid main"<br />
$ sudo apt-get update<br />
$ sudo apt-get install maven<br />
</pre></code><br />
<br />
Create a symbolic link:<br />
<code><pre><br />
$ sudo ln -s /usr/local/maven/bin/mvn /usr/local/bin/mvn<br />
</pre></code><br />
<br />
<br />
== Install Spring Roo (Optional) ==<br />
<br />
If you already have a test .war file, you can skip to the deploy section and deploy your own war.<br />
<br />
[http://static.springsource.org/spring-roo/reference/html/intro.html#intro-installation Download and install Spring Roo using directions at the Spring Roo site].<br />
<br />
This is how I install roo:<br />
<br />
<code><pre><br />
$ unzip spring-roo-1.2.0.RC1.zip<br />
$ sudo mv spring-roo-1.2.0.RC1 /usr/local/share/<br />
$ sudo ln -s /usr/local/share/spring-roo-1.2.0.RC1/ /usr/local/share/spring-roo<br />
$ sudo ln -s /usr/local/share/spring-roo/bin/roo.sh /usr/bin/roo<br />
</pre></code><br />
<br />
At the roo prompt, type hint.<br />
<br />
<code><pre><br />
<br />
$ roo<br />
____ ____ ____ <br />
/ __ \/ __ \/ __ \ <br />
/ /_/ / / / / / / / <br />
/ _, _/ /_/ / /_/ / <br />
/_/ |_|\____/\____/ 1.2.0.RC1 [rev dcaa483]<br />
<br />
<br />
Welcome to Spring Roo. For assistance press TAB or type "hint" then hit ENTER.<br />
...<br />
roo> hint<br />
<br />
..<br />
<br />
</pre></code><br />
<br />
Hint should always let you know what you might want to do next. Please feel free to read the Roo docs for details or just follow along and read the Roo docs later.<br />
<br />
Create the project, this generates maven project files and Spring starter project.<br />
<br />
<code><pre><br />
<br />
roo> project --topLevelPackage com.example.blog<br />
<br />
Created ROOT/pom.xml<br />
Created SRC_MAIN_RESOURCES<br />
Created SRC_MAIN_RESOURCES/log4j.properties<br />
Created SPRING_CONFIG_ROOT<br />
Created SPRING_CONFIG_ROOT/applicationContext.xml<br />
<br />
</pre></code><br />
<br />
Next setup the database and JPA, keep it simple to minimize the amount of things we need to configure later.<br />
<br />
<code><pre><br />
<br />
roo> jpa setup --database H2_IN_MEMORY --provider HIBERNATE <br />
<br />
Created SPRING_CONFIG_ROOT/database.properties<br />
Updated SPRING_CONFIG_ROOT/applicationContext.xml<br />
Created SRC_MAIN_RESOURCES/META-INF/persistence.xml<br />
Updated ROOT/pom.xml [added dependencies com.h2database:h2:1.3.161, org.hibernate:hibernate-core:3.6.8.Final, ...]<br />
<br />
</pre></code><br />
<br />
Create a entity class called blog.<br />
<br />
<code><pre><br />
<br />
roo> entity jpa --class ~.domain.Blog<br />
Created SRC_MAIN_JAVA/com/example/blog/domain<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog.java<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_Configurable.aj<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_Jpa_ActiveRecord.aj<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_ToString.aj<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_Jpa_Entity.aj<br />
<br />
</pre></code><br />
<br />
<br />
Add two fields to the Blog class.<br />
<br />
<code><pre><br />
~.domain.Blog roo> field string --fieldName title<br />
Updated SRC_MAIN_JAVA/com/example/blog/domain/Blog.java<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_JavaBean.aj<br />
<br />
~.domain.Blog roo> field string --fieldName message<br />
Updated SRC_MAIN_JAVA/com/example/blog/domain/Blog.java<br />
Updated SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_JavaBean.aj<br />
</pre></code><br />
<br />
Create the web tier<br />
<code><pre><br />
~.domain.Blog roo> web mvc setup<br />
Created ROOT/src/main/webapp/WEB-INF/spring<br />
Created ROOT/src/main/webapp/WEB-INF/spring/webmvc-config.xml<br />
Created ROOT/src/main/webapp/WEB-INF/web.xml<br />
...<br />
Updated ROOT/src/main/webapp/WEB-INF/web.xml<br />
Updated ROOT/pom.xml [added dependencies org.springframework:spring-webmvc:${spring.version}, ...]<br />
Updated SRC_MAIN_WEBAPP/WEB-INF/views/footer.jspx<br />
</pre></code><br />
<br />
<br />
Generate the web tier. <br />
<br />
<code><pre><br />
~.domain.Blog roo> web mvc all --package ~.web<br />
<br />
Created SRC_MAIN_JAVA/com/example/blog/web<br />
Created SRC_MAIN_JAVA/com/example/blog/web/BlogController.java<br />
...<br />
Created SRC_MAIN_WEBAPP/WEB-INF/views/blogs<br />
Created SRC_MAIN_WEBAPP/WEB-INF/views/blogs/views.xml<br />
Updated SRC_MAIN_WEBAPP/WEB-INF/views/blogs/views.xml<br />
...<br />
Updated SRC_MAIN_WEBAPP/WEB-INF/views/blogs/views.xml<br />
...<br />
Created SRC_MAIN_WEBAPP/WEB-INF/views/blogs/update.jspx<br />
</pre></code><br />
<br />
Package our web app<br />
<br />
<code><pre><br />
roo> perform package<br />
</pre></code><br />
<br />
<br />
Exit roo.<br />
<code><pre><br />
roo> exit<br />
</pre></code><br />
<br />
== Deploy locally and test ==<br />
<br />
Deploy the example Roo app with Resin.<br />
<br />
<code><pre><br />
$ resinctl deploy target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog<br />
<br />
Deployed production/webapp/default/blog from target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
</pre></code><br />
<br />
<br />
You can see if the app was actually deployed:<br />
<br />
<code><pre><br />
$ resinctl deploy-list<br />
<br />
production/webapp/default/blog<br />
</pre></code><br />
<br />
Now you should be able to load the Roo blog example.<br />
<br />
http://localhost:8080/blog/<br />
<br />
<br />
==Create an Elastic IP and assign it to your Amazon WS Linux instance==<br />
<br />
Create an Elastic IP and assign it to the Amazon WS Linux instance using the [http://aws.amazon.com/console/ Amazon web console].<br />
<br />
I got this IP address.<br />
203.0.113.26<br />
<br />
<br />
==Create password==<br />
<br />
<br />
<code><pre><br />
$ resinctl generate-password -user admin -password roofoo<br />
<br />
admin_user : admin<br />
admin_password : {SSHA}BGBKQdCr0a5orH99eqIFwR/fffffffff<br />
<br />
</pre></code><br />
<br />
==Create a properties file and put it into user-data of Amazon AMI==<br />
<br />
[http://caucho.com/resin-4.0/changes/resin-4.0.24.xtp#resinproperties Resin properties].<br />
<br />
<br />
<code><pre><br />
log_level : info<br />
dev_mode : true<br />
resin_doc : true<br />
<br />
app_tier : 127.0.0.1<br />
web_tier :<br />
cache_tier :<br />
<br />
setuid_user : www-data<br />
setuid_group : www-data<br />
<br />
http : 8080<br />
https : 8443<br />
<br />
admin_user : admin<br />
admin_password : {SSHA}BGBKQdCr0a5orH99eqIFwR/ffffffff<br />
admin_external : true<br />
admin_remote_enable : true<br />
session_store : true<br />
<br />
</pre></code><br />
<br />
<br />
Create an amazon.xml <br />
<br />
<br />
<code><pre><br />
<resin xmlns="http://caucho.com/ns/resin"<br />
xmlns:resin="urn:java:com.caucho.resin"><br />
<br />
<resin:properties path="http://169.254.169.254/latest/user-data"<br />
optional="true"/><br />
<br />
</resin><br />
</pre></code><br />
<br />
<br />
Log into Amazon AMI instance and add the above to /etc/resin/local.d/amazon.xml.<br />
<br />
<br />
<code><pre><br />
$ ssh -i resin2.pem ec2-user@203.0.113.26 <br />
$ sudo nano /etc/resin/local.d/amazon.xml<br />
</pre></code><br />
<br />
From your local machine execute this command:<br />
<br />
<br />
<code><pre><br />
$ resinctl deploy target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -address 203.0.113.26 -port 8080 -user admin -password roofoo<br />
</pre></code><br />
<br />
<br />
Now it works in the cloud:<br />
<br />
http://203.0.113.26:8080/blog/<br />
<br />
<br />
Next step learn how to spin up instances with eucatools [[Resin Cloud deployment with Amazon WS EC2 and Euca Tools]].<br />
<br />
<br />
Next step learn how to use MySQL setup with Resin and Amazon RDS [[Resin MySQL and RDS setup with Amazon RDS]].<br />
<br />
<br />
[[Resin Cloud Deployment Reference]]</div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_deployment_with_AmazonResin Cloud deployment with Amazon2012-01-25T00:00:00Z<p>Rickhigh: </p>
<hr />
<div>[[Category: Cookbook]] [[Category:Cloud]]<br />
<br />
This tutorial is going to cover the basics of using Resin with Amazon Web Services for cloud deployment. If you are new to cloud computing and IaaS ([http:///en.wikipedia.org/wiki/Cloud_computing#Infrastructure Infrastructure as a Service]), follow along and you will soon be deploying Java web applications in the cloud. You wil create an EC2 instance. You will download and install Resin on Ubuntu on a local machine. You will install Resin on an Amazon Linux AMI instance (EC2 instance). You will use Roo to create a simple application and deploy it.<br />
<br />
We use [http://www.springsource.org/spring-roo Roo because Spring] is fairly widely used, and Roo is a quick way to generate a sample app. Future tutorials will use other common Java tools as well as show you how to configure and manage a complete Resin cluster. Think of this as the first tutorial in a series of tutorials.<br />
<br />
<br />
For this tutorial you will need Resin 4.0.24 or later. Check back periodically because as we are going to expand the tutorial and improve Resin's support of cloud deployments. The Resin engineering team plans on improving cloud support continuously.<br />
<br />
Many of the steps in this tutorial would be similar even if you were using [http://www.eucalyptus.com/ Eucalyptus], [http://cloudstack.com/ CloudStack] with [http://cloudstack.org/download.html CloudBridge], [http://www.rightscale.com/products/plans-pricing/mycloud.php RightScale myCloud] or even [http://opennebula.org/documentation:rel3.0:ec2qcg OpenNebula] this guide should help you along as they all support the Amazon EC2 REST APIs. Also any cloud computing environment (private or public, on premises or hosted) will have similar characteristics. Thus even if you are using a private cloud using [http://www.openstack.org/ OpenStack] like [http://deliver.citrix.com/projectolympus Project Olympus], the principles will be the same. In fact even using remote servers deployed in a datacenter or virtualized servers with [http://www.citrix.com/English/ps2/products/subfeature.asp?contentID=2300456 Xen Server], [http://xen.org/products/cloudxen.html Xen Cloud] or [http://www.vmware.com/products/vsphere/overview.html VMWare vSphere] the steps will be very similar.<br />
<br />
<br />
For this tutorial we expect you are familiar with starting, and stopping Amazon WS instances. If you are not, go through this [http://docs.amazonwebservices.com/AWSEC2/latest/GettingStartedGuide/ tutorial from Amazon WS]. You will need an Amazon WS account. Amazon WS allows you to have [http://aws.amazon.com/free/ free tier so you can learn Amazon WS (EC2, S3, Elastic Load Balancer, Block Storage, SimpleDB, Simple Queue Service, Simple Notification Service)].<br />
<br />
<br />
==Fire up an Amazon Instance==<br />
<br />
Fire up an Amazon Instance using Amazon Linux (basically CentOS 5.4). Then [http://caucho.com/resin-4.0/changes/resin-4.0.24.xtp#RPM install Resin as follows using RPM]:<br />
<br />
<code> <pre><br />
<br />
$ sudo rpm --import http://caucho.com/download/rpm/RPM-GPG-KEY-caucho<br />
$ sudo yum install http://caucho.com/download/rpm/4.0.24/x86_64/resin-pro-4.0.24-1.x86_64.rpm<br />
<br />
</pre></code><br />
<br />
<br />
==Install Resin on a Local Box==<br />
<br />
Install <br />
[http://caucho.com/resin-4.0/admin/starting-resin-install.xtp#InstallingResinusingthedebpackageonUbuntuandDebian Resin] locally so you test locally and deploy. [http://caucho.com/resin-4.0/admin/starting-resin-install.xtp Feel free to install it on any supported OS].<br />
<br />
<br />
Add Caucho's Debian repository to your system's repositories to use automated update tools like Synaptic and apt-get. To do this, add the following line to your /etc/apt/sources.list<br />
<br />
<code> <pre><br />
deb http://caucho.com/download/debian unstable multiverse<br />
</pre></code><br />
<br />
<br />
Then install Resin as follows:<br />
<br />
<code> <pre><br />
apt-get update<br />
apt-get install resin-pro<br />
</pre></code><br />
<br />
It is a good idea to make sure the version you install on Amazon AMI matches the version you install locally.<br />
<br />
You can see that Resin is installed as follows:<br />
<br />
<code> <pre><br />
$ ls /etc/resin<br />
app-default.xml local.d resin.properties resin.xml<br />
<br />
$ ls /var/www/<br />
doc licenses log resin-data watchdog-data webapps<br />
<br />
$ ls /etc/init.d/resin<br />
/etc/init.d/resin<br />
<br />
$ ls -l /usr/local/share/resin<br />
lrwxrwxrwx 1 root root 16 2011-11-18 09:03 /usr/local/share/resin -> resin-pro-4.0.24<br />
<br />
</pre></code><br />
<br />
<br />
Also at this point, Resin should be running as well, and you can verify this with resinctl status:<br />
<br />
<code> <pre><br />
$ resinctl status<br />
Resin/4.0.24 status for watchdog at 127.0.0.1:6600<br />
<br />
watchdog:<br />
watchdog-pid: 7383<br />
<br />
server 'app-0' : ACTIVE<br />
password: missing<br />
watchdog-user: root<br />
user: www-data(www-data)<br />
root: /var/www<br />
conf: /etc/resin/resin.xml<br />
pid: 7590<br />
uptime: 0 days 00h19<br />
<br />
</pre></code><br />
<br />
== Install Maven 3 (Optional, for Roo example) ==<br />
<br />
If you already have a test .war file, you can skip to the deploy section and deploy your own war.<br />
<br />
Install maven. Maven is not in the public Ubuntu repository.<br />
<br />
<code><pre><br />
$ sudo add-apt-repository "deb http://build.discursive.com/apt/ lucid main"<br />
$ sudo apt-get update<br />
$ sudo apt-get install maven<br />
</pre></code><br />
<br />
Create a symbolic link:<br />
<code><pre><br />
$ sudo ln -s /usr/local/maven/bin/mvn /usr/local/bin/mvn<br />
</pre></code><br />
<br />
<br />
== Install Spring Roo (Optional) ==<br />
<br />
If you already have a test .war file, you can skip to the deploy section and deploy your own war.<br />
<br />
[http://static.springsource.org/spring-roo/reference/html/intro.html#intro-installation Download and install Spring Roo using directions at the Spring Roo site].<br />
<br />
This is how I install roo:<br />
<br />
<code><pre><br />
$ unzip spring-roo-1.2.0.RC1.zip<br />
$ sudo mv spring-roo-1.2.0.RC1 /usr/local/share/<br />
$ sudo ln -s /usr/local/share/spring-roo-1.2.0.RC1/ /usr/local/share/spring-roo<br />
$ sudo ln -s /usr/local/share/spring-roo/bin/roo.sh /usr/bin/roo<br />
</pre></code><br />
<br />
At the roo prompt, type hint.<br />
<br />
<code><pre><br />
<br />
$ roo<br />
____ ____ ____ <br />
/ __ \/ __ \/ __ \ <br />
/ /_/ / / / / / / / <br />
/ _, _/ /_/ / /_/ / <br />
/_/ |_|\____/\____/ 1.2.0.RC1 [rev dcaa483]<br />
<br />
<br />
Welcome to Spring Roo. For assistance press TAB or type "hint" then hit ENTER.<br />
...<br />
roo> hint<br />
<br />
..<br />
<br />
</pre></code><br />
<br />
Hint should always let you know what you might want to do next. Please feel free to read the Roo docs for details or just follow along and read the Roo docs later.<br />
<br />
Create the project, this generates maven project files and Spring starter project.<br />
<br />
<code><pre><br />
<br />
roo> project --topLevelPackage com.example.blog<br />
<br />
Created ROOT/pom.xml<br />
Created SRC_MAIN_RESOURCES<br />
Created SRC_MAIN_RESOURCES/log4j.properties<br />
Created SPRING_CONFIG_ROOT<br />
Created SPRING_CONFIG_ROOT/applicationContext.xml<br />
<br />
</pre></code><br />
<br />
Next setup the database and JPA, keep it simple to minimize the amount of things we need to configure later.<br />
<br />
<code><pre><br />
<br />
roo> jpa setup --database H2_IN_MEMORY --provider HIBERNATE <br />
<br />
Created SPRING_CONFIG_ROOT/database.properties<br />
Updated SPRING_CONFIG_ROOT/applicationContext.xml<br />
Created SRC_MAIN_RESOURCES/META-INF/persistence.xml<br />
Updated ROOT/pom.xml [added dependencies com.h2database:h2:1.3.161, org.hibernate:hibernate-core:3.6.8.Final, ...]<br />
<br />
</pre></code><br />
<br />
Create a entity class called blog.<br />
<br />
<code><pre><br />
<br />
roo> entity jpa --class ~.domain.Blog<br />
Created SRC_MAIN_JAVA/com/example/blog/domain<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog.java<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_Configurable.aj<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_Jpa_ActiveRecord.aj<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_ToString.aj<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_Jpa_Entity.aj<br />
<br />
</pre></code><br />
<br />
<br />
Add two fields to the Blog class.<br />
<br />
<code><pre><br />
~.domain.Blog roo> field string --fieldName title<br />
Updated SRC_MAIN_JAVA/com/example/blog/domain/Blog.java<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_JavaBean.aj<br />
<br />
~.domain.Blog roo> field string --fieldName message<br />
Updated SRC_MAIN_JAVA/com/example/blog/domain/Blog.java<br />
Updated SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_JavaBean.aj<br />
</pre></code><br />
<br />
Create the web tier<br />
<code><pre><br />
~.domain.Blog roo> web mvc setup<br />
Created ROOT/src/main/webapp/WEB-INF/spring<br />
Created ROOT/src/main/webapp/WEB-INF/spring/webmvc-config.xml<br />
Created ROOT/src/main/webapp/WEB-INF/web.xml<br />
...<br />
Updated ROOT/src/main/webapp/WEB-INF/web.xml<br />
Updated ROOT/pom.xml [added dependencies org.springframework:spring-webmvc:${spring.version}, ...]<br />
Updated SRC_MAIN_WEBAPP/WEB-INF/views/footer.jspx<br />
</pre></code><br />
<br />
<br />
Generate the web tier. <br />
<br />
<code><pre><br />
~.domain.Blog roo> web mvc all --package ~.web<br />
<br />
Created SRC_MAIN_JAVA/com/example/blog/web<br />
Created SRC_MAIN_JAVA/com/example/blog/web/BlogController.java<br />
...<br />
Created SRC_MAIN_WEBAPP/WEB-INF/views/blogs<br />
Created SRC_MAIN_WEBAPP/WEB-INF/views/blogs/views.xml<br />
Updated SRC_MAIN_WEBAPP/WEB-INF/views/blogs/views.xml<br />
...<br />
Updated SRC_MAIN_WEBAPP/WEB-INF/views/blogs/views.xml<br />
...<br />
Created SRC_MAIN_WEBAPP/WEB-INF/views/blogs/update.jspx<br />
</pre></code><br />
<br />
Package our web app<br />
<br />
<code><pre><br />
roo> perform package<br />
</pre></code><br />
<br />
<br />
Exit roo.<br />
<code><pre><br />
roo> exit<br />
</pre></code><br />
<br />
== Deploy locally and test ==<br />
<br />
Deploy the example Roo app with Resin.<br />
<br />
<code><pre><br />
$ resinctl deploy target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog<br />
<br />
Deployed production/webapp/default/blog from target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
</pre></code><br />
<br />
<br />
You can see if the app was actually deployed:<br />
<br />
<code><pre><br />
$ resinctl deploy-list<br />
<br />
production/webapp/default/blog<br />
</pre></code><br />
<br />
Now you should be able to load the Roo blog example.<br />
<br />
http://localhost:8080/blog/<br />
<br />
<br />
==Create an Elastic IP and assign it to your Amazon WS Linux instance==<br />
<br />
Create an Elastic IP and assign it to the Amazon WS Linux instance using the [http://aws.amazon.com/console/ Amazon web console].<br />
<br />
I got this IP address.<br />
203.0.113.26<br />
<br />
<br />
==Create password==<br />
<br />
<br />
<code><pre><br />
$ resinctl generate-password -user admin -password roofoo<br />
<br />
admin_user : admin<br />
admin_password : {SSHA}BGBKQdCr0a5orH99eqIFwR/fffffffff<br />
<br />
</pre></code><br />
<br />
==Create a properties file and put it into user-data of Amazon AMI==<br />
<br />
[http://caucho.com/resin-4.0/changes/resin-4.0.24.xtp#resinproperties Resin properties].<br />
<br />
<br />
<code><pre><br />
log_level : info<br />
dev_mode : true<br />
resin_doc : true<br />
<br />
app_tier : 127.0.0.1<br />
web_tier :<br />
cache_tier :<br />
<br />
setuid_user : www-data<br />
setuid_group : www-data<br />
<br />
http : 8080<br />
https : 8443<br />
<br />
admin_user : admin<br />
admin_password : {SSHA}BGBKQdCr0a5orH99eqIFwR/ffffffff<br />
admin_external : true<br />
admin_remote_enable : true<br />
session_store : true<br />
<br />
</pre></code><br />
<br />
<br />
Create an amazon.xml <br />
<br />
<br />
<code><pre><br />
<resin xmlns="http://caucho.com/ns/resin"<br />
xmlns:resin="urn:java:com.caucho.resin"><br />
<br />
<resin:properties path="http://169.254.169.254/latest/user-data"<br />
optional="true"/><br />
<br />
</resin><br />
</pre></code><br />
<br />
<br />
Log into Amazon AMI instance and add the above to /etc/resin/local.d/amazon.xml.<br />
<br />
<br />
<code><pre><br />
$ ssh -i resin2.pem ec2-user@203.0.113.26 <br />
$ sudo nano /etc/resin/local.d/amazon.xml<br />
</pre></code><br />
<br />
From your local machine execute this command:<br />
<br />
<br />
<code><pre><br />
$ resinctl deploy target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -address 203.0.113.26 -port 8080 -user admin -password roofoo<br />
</pre></code><br />
<br />
<br />
Now it works in the cloud:<br />
<br />
http://203.0.113.26:8080/blog/<br />
<br />
<br />
Next step learn how to spin up instances with eucatools [[Resin Cloud deployment with Amazon WS EC2 and Euca Tools]].<br />
<br />
<br />
Next step learn how to use MySQL setup with Resin and Amazon RDS [[Resin MySQL and RDS setup with Amazon RDS]].<br />
<br />
<br />
[[Resin Cloud Deployment Reference]]</div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_deployment_with_AmazonResin Cloud deployment with Amazon2012-01-25T00:00:00Z<p>Rickhigh: </p>
<hr />
<div>[[Category: Cookbook]] [[Category:Cloud]]<br />
<br />
test<br />
<br />
This tutorial is going to cover the basics of using Resin with Amazon Web Services for cloud deployment. If you are new to cloud computing and IaaS ([http:///en.wikipedia.org/wiki/Cloud_computing#Infrastructure Infrastructure as a Service]), follow along and you will soon be deploying Java web applications in the cloud. You wil create an EC2 instance. You will download and install Resin on Ubuntu on a local machine. You will install Resin on an Amazon Linux AMI instance (EC2 instance). You will use Roo to create a simple application and deploy it.<br />
<br />
We use [http://www.springsource.org/spring-roo Roo because Spring] is fairly widely used, and Roo is a quick way to generate a sample app. Future tutorials will use other common Java tools as well as show you how to configure and manage a complete Resin cluster. Think of this as the first tutorial in a series of tutorials.<br />
<br />
<br />
For this tutorial you will need Resin 4.0.24 or later. Check back periodically because as we are going to expand the tutorial and improve Resin's support of cloud deployments. The Resin engineering team plans on improving cloud support continuously.<br />
<br />
Many of the steps in this tutorial would be similar even if you were using [http://www.eucalyptus.com/ Eucalyptus], [http://cloudstack.com/ CloudStack] with [http://cloudstack.org/download.html CloudBridge], [http://www.rightscale.com/products/plans-pricing/mycloud.php RightScale myCloud] or even [http://opennebula.org/documentation:rel3.0:ec2qcg OpenNebula] this guide should help you along as they all support the Amazon EC2 REST APIs. Also any cloud computing environment (private or public, on premises or hosted) will have similar characteristics. Thus even if you are using a private cloud using [http://www.openstack.org/ OpenStack] like [http://deliver.citrix.com/projectolympus Project Olympus], the principles will be the same. In fact even using remote servers deployed in a datacenter or virtualized servers with [http://www.citrix.com/English/ps2/products/subfeature.asp?contentID=2300456 Xen Server], [http://xen.org/products/cloudxen.html Xen Cloud] or [http://www.vmware.com/products/vsphere/overview.html VMWare vSphere] the steps will be very similar.<br />
<br />
<br />
For this tutorial we expect you are familiar with starting, and stopping Amazon WS instances. If you are not, go through this [http://docs.amazonwebservices.com/AWSEC2/latest/GettingStartedGuide/ tutorial from Amazon WS]. You will need an Amazon WS account. Amazon WS allows you to have [http://aws.amazon.com/free/ free tier so you can learn Amazon WS (EC2, S3, Elastic Load Balancer, Block Storage, SimpleDB, Simple Queue Service, Simple Notification Service)].<br />
<br />
<br />
==Fire up an Amazon Instance==<br />
<br />
Fire up an Amazon Instance using Amazon Linux (basically CentOS 5.4). Then [http://caucho.com/resin-4.0/changes/resin-4.0.24.xtp#RPM install Resin as follows using RPM]:<br />
<br />
<code> <pre><br />
<br />
$ sudo rpm --import http://caucho.com/download/rpm/RPM-GPG-KEY-caucho<br />
$ sudo yum install http://caucho.com/download/rpm/4.0.24/x86_64/resin-pro-4.0.24-1.x86_64.rpm<br />
<br />
</pre></code><br />
<br />
<br />
==Install Resin on a Local Box==<br />
<br />
Install <br />
[http://caucho.com/resin-4.0/admin/starting-resin-install.xtp#InstallingResinusingthedebpackageonUbuntuandDebian Resin] locally so you test locally and deploy. [http://caucho.com/resin-4.0/admin/starting-resin-install.xtp Feel free to install it on any supported OS].<br />
<br />
<br />
Add Caucho's Debian repository to your system's repositories to use automated update tools like Synaptic and apt-get. To do this, add the following line to your /etc/apt/sources.list<br />
<br />
<code> <pre><br />
deb http://caucho.com/download/debian unstable multiverse<br />
</pre></code><br />
<br />
<br />
Then install Resin as follows:<br />
<br />
<code> <pre><br />
apt-get update<br />
apt-get install resin-pro<br />
</pre></code><br />
<br />
It is a good idea to make sure the version you install on Amazon AMI matches the version you install locally.<br />
<br />
You can see that Resin is installed as follows:<br />
<br />
<code> <pre><br />
$ ls /etc/resin<br />
app-default.xml local.d resin.properties resin.xml<br />
<br />
$ ls /var/www/<br />
doc licenses log resin-data watchdog-data webapps<br />
<br />
$ ls /etc/init.d/resin<br />
/etc/init.d/resin<br />
<br />
$ ls -l /usr/local/share/resin<br />
lrwxrwxrwx 1 root root 16 2011-11-18 09:03 /usr/local/share/resin -> resin-pro-4.0.24<br />
<br />
</pre></code><br />
<br />
<br />
Also at this point, Resin should be running as well, and you can verify this with resinctl status:<br />
<br />
<code> <pre><br />
$ resinctl status<br />
Resin/4.0.24 status for watchdog at 127.0.0.1:6600<br />
<br />
watchdog:<br />
watchdog-pid: 7383<br />
<br />
server 'app-0' : ACTIVE<br />
password: missing<br />
watchdog-user: root<br />
user: www-data(www-data)<br />
root: /var/www<br />
conf: /etc/resin/resin.xml<br />
pid: 7590<br />
uptime: 0 days 00h19<br />
<br />
</pre></code><br />
<br />
== Install Maven 3 (Optional, for Roo example) ==<br />
<br />
If you already have a test .war file, you can skip to the deploy section and deploy your own war.<br />
<br />
Install maven. Maven is not in the public Ubuntu repository.<br />
<br />
<code><pre><br />
$ sudo add-apt-repository "deb http://build.discursive.com/apt/ lucid main"<br />
$ sudo apt-get update<br />
$ sudo apt-get install maven<br />
</pre></code><br />
<br />
Create a symbolic link:<br />
<code><pre><br />
$ sudo ln -s /usr/local/maven/bin/mvn /usr/local/bin/mvn<br />
</pre></code><br />
<br />
<br />
== Install Spring Roo (Optional) ==<br />
<br />
If you already have a test .war file, you can skip to the deploy section and deploy your own war.<br />
<br />
[http://static.springsource.org/spring-roo/reference/html/intro.html#intro-installation Download and install Spring Roo using directions at the Spring Roo site].<br />
<br />
This is how I install roo:<br />
<br />
<code><pre><br />
$ unzip spring-roo-1.2.0.RC1.zip<br />
$ sudo mv spring-roo-1.2.0.RC1 /usr/local/share/<br />
$ sudo ln -s /usr/local/share/spring-roo-1.2.0.RC1/ /usr/local/share/spring-roo<br />
$ sudo ln -s /usr/local/share/spring-roo/bin/roo.sh /usr/bin/roo<br />
</pre></code><br />
<br />
At the roo prompt, type hint.<br />
<br />
<code><pre><br />
<br />
$ roo<br />
____ ____ ____ <br />
/ __ \/ __ \/ __ \ <br />
/ /_/ / / / / / / / <br />
/ _, _/ /_/ / /_/ / <br />
/_/ |_|\____/\____/ 1.2.0.RC1 [rev dcaa483]<br />
<br />
<br />
Welcome to Spring Roo. For assistance press TAB or type "hint" then hit ENTER.<br />
...<br />
roo> hint<br />
<br />
..<br />
<br />
</pre></code><br />
<br />
Hint should always let you know what you might want to do next. Please feel free to read the Roo docs for details or just follow along and read the Roo docs later.<br />
<br />
Create the project, this generates maven project files and Spring starter project.<br />
<br />
<code><pre><br />
<br />
roo> project --topLevelPackage com.example.blog<br />
<br />
Created ROOT/pom.xml<br />
Created SRC_MAIN_RESOURCES<br />
Created SRC_MAIN_RESOURCES/log4j.properties<br />
Created SPRING_CONFIG_ROOT<br />
Created SPRING_CONFIG_ROOT/applicationContext.xml<br />
<br />
</pre></code><br />
<br />
Next setup the database and JPA, keep it simple to minimize the amount of things we need to configure later.<br />
<br />
<code><pre><br />
<br />
roo> jpa setup --database H2_IN_MEMORY --provider HIBERNATE <br />
<br />
Created SPRING_CONFIG_ROOT/database.properties<br />
Updated SPRING_CONFIG_ROOT/applicationContext.xml<br />
Created SRC_MAIN_RESOURCES/META-INF/persistence.xml<br />
Updated ROOT/pom.xml [added dependencies com.h2database:h2:1.3.161, org.hibernate:hibernate-core:3.6.8.Final, ...]<br />
<br />
</pre></code><br />
<br />
Create a entity class called blog.<br />
<br />
<code><pre><br />
<br />
roo> entity jpa --class ~.domain.Blog<br />
Created SRC_MAIN_JAVA/com/example/blog/domain<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog.java<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_Configurable.aj<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_Jpa_ActiveRecord.aj<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_ToString.aj<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_Jpa_Entity.aj<br />
<br />
</pre></code><br />
<br />
<br />
Add two fields to the Blog class.<br />
<br />
<code><pre><br />
~.domain.Blog roo> field string --fieldName title<br />
Updated SRC_MAIN_JAVA/com/example/blog/domain/Blog.java<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_JavaBean.aj<br />
<br />
~.domain.Blog roo> field string --fieldName message<br />
Updated SRC_MAIN_JAVA/com/example/blog/domain/Blog.java<br />
Updated SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_JavaBean.aj<br />
</pre></code><br />
<br />
Create the web tier<br />
<code><pre><br />
~.domain.Blog roo> web mvc setup<br />
Created ROOT/src/main/webapp/WEB-INF/spring<br />
Created ROOT/src/main/webapp/WEB-INF/spring/webmvc-config.xml<br />
Created ROOT/src/main/webapp/WEB-INF/web.xml<br />
...<br />
Updated ROOT/src/main/webapp/WEB-INF/web.xml<br />
Updated ROOT/pom.xml [added dependencies org.springframework:spring-webmvc:${spring.version}, ...]<br />
Updated SRC_MAIN_WEBAPP/WEB-INF/views/footer.jspx<br />
</pre></code><br />
<br />
<br />
Generate the web tier. <br />
<br />
<code><pre><br />
~.domain.Blog roo> web mvc all --package ~.web<br />
<br />
Created SRC_MAIN_JAVA/com/example/blog/web<br />
Created SRC_MAIN_JAVA/com/example/blog/web/BlogController.java<br />
...<br />
Created SRC_MAIN_WEBAPP/WEB-INF/views/blogs<br />
Created SRC_MAIN_WEBAPP/WEB-INF/views/blogs/views.xml<br />
Updated SRC_MAIN_WEBAPP/WEB-INF/views/blogs/views.xml<br />
...<br />
Updated SRC_MAIN_WEBAPP/WEB-INF/views/blogs/views.xml<br />
...<br />
Created SRC_MAIN_WEBAPP/WEB-INF/views/blogs/update.jspx<br />
</pre></code><br />
<br />
Package our web app<br />
<br />
<code><pre><br />
roo> perform package<br />
</pre></code><br />
<br />
<br />
Exit roo.<br />
<code><pre><br />
roo> exit<br />
</pre></code><br />
<br />
== Deploy locally and test ==<br />
<br />
Deploy the example Roo app with Resin.<br />
<br />
<code><pre><br />
$ resinctl deploy target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog<br />
<br />
Deployed production/webapp/default/blog from target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
</pre></code><br />
<br />
<br />
You can see if the app was actually deployed:<br />
<br />
<code><pre><br />
$ resinctl deploy-list<br />
<br />
production/webapp/default/blog<br />
</pre></code><br />
<br />
Now you should be able to load the Roo blog example.<br />
<br />
http://localhost:8080/blog/<br />
<br />
<br />
==Create an Elastic IP and assign it to your Amazon WS Linux instance==<br />
<br />
Create an Elastic IP and assign it to the Amazon WS Linux instance using the [http://aws.amazon.com/console/ Amazon web console].<br />
<br />
I got this IP address.<br />
203.0.113.26<br />
<br />
<br />
==Create password==<br />
<br />
<br />
<code><pre><br />
$ resinctl generate-password -user admin -password roofoo<br />
<br />
admin_user : admin<br />
admin_password : {SSHA}BGBKQdCr0a5orH99eqIFwR/fffffffff<br />
<br />
</pre></code><br />
<br />
==Create a properties file and put it into user-data of Amazon AMI==<br />
<br />
[http://caucho.com/resin-4.0/changes/resin-4.0.24.xtp#resinproperties Resin properties].<br />
<br />
<br />
<code><pre><br />
log_level : info<br />
dev_mode : true<br />
resin_doc : true<br />
<br />
app_tier : 127.0.0.1<br />
web_tier :<br />
cache_tier :<br />
<br />
setuid_user : www-data<br />
setuid_group : www-data<br />
<br />
http : 8080<br />
https : 8443<br />
<br />
admin_user : admin<br />
admin_password : {SSHA}BGBKQdCr0a5orH99eqIFwR/ffffffff<br />
admin_external : true<br />
admin_remote_enable : true<br />
session_store : true<br />
<br />
</pre></code><br />
<br />
<br />
Create an amazon.xml <br />
<br />
<br />
<code><pre><br />
<resin xmlns="http://caucho.com/ns/resin"<br />
xmlns:resin="urn:java:com.caucho.resin"><br />
<br />
<resin:properties path="http://169.254.169.254/latest/user-data"<br />
optional="true"/><br />
<br />
</resin><br />
</pre></code><br />
<br />
<br />
Log into Amazon AMI instance and add the above to /etc/resin/local.d/amazon.xml.<br />
<br />
<br />
<code><pre><br />
$ ssh -i resin2.pem ec2-user@203.0.113.26 <br />
$ sudo nano /etc/resin/local.d/amazon.xml<br />
</pre></code><br />
<br />
From your local machine execute this command:<br />
<br />
<br />
<code><pre><br />
$ resinctl deploy target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -address 203.0.113.26 -port 8080 -user admin -password roofoo<br />
</pre></code><br />
<br />
<br />
Now it works in the cloud:<br />
<br />
http://203.0.113.26:8080/blog/<br />
<br />
<br />
Next step learn how to spin up instances with eucatools [[Resin Cloud deployment with Amazon WS EC2 and Euca Tools]].<br />
<br />
<br />
Next step learn how to use MySQL setup with Resin and Amazon RDS [[Resin MySQL and RDS setup with Amazon RDS]].<br />
<br />
<br />
[[Resin Cloud Deployment Reference]]</div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_deployment_with_AmazonResin Cloud deployment with Amazon2011-12-23T23:13:26Z<p>Rickhigh: /* Create a properties file and put it into user-data of Amazon AMI */</p>
<hr />
<div>This tutorial is going to cover the basics of using Resin with Amazon Web Services for cloud deployment. If you are new to cloud computing and IaaS ([http:///en.wikipedia.org/wiki/Cloud_computing#Infrastructure Infrastructure as a Service]), follow along and you will soon be deploying Java web applications in the cloud. You wil create an EC2 instance. You will download and install Resin on Ubuntu on a local machine. You will install Resin on an Amazon Linux AMI instance (EC2 instance). You will use Roo to create a simple application and deploy it.<br />
<br />
We use [http://www.springsource.org/spring-roo Roo because Spring] is fairly widely used, and Roo is a quick way to generate a sample app. Future tutorials will use other common Java tools as well as show you how to configure and manage a complete Resin cluster. Think of this as the first tutorial in a series of tutorials.<br />
<br />
For this tutorial you will need Resin 4.0.24 or later. Check back periodically because as we are going to expand the tutorial and improve Resin's support of cloud deployments. The Resin engineering team plans on improving cloud support continuously.<br />
<br />
Many of the steps in this tutorial would be similar even if you were using [http://www.eucalyptus.com/ Eucalyptus], [http://cloudstack.com/ CloudStack] with [http://cloudstack.org/download.html CloudBridge], [http://www.rightscale.com/products/plans-pricing/mycloud.php RightScale myCloud] or even [http://opennebula.org/documentation:rel3.0:ec2qcg OpenNebula] this guide should help you along as they all support the Amazon EC2 REST APIs. Also any cloud computing environment (private or public, on premises or hosted) will have similar characteristics. Thus even if you are using a private cloud using [http://www.openstack.org/ OpenStack] like [http://deliver.citrix.com/projectolympus Project Olympus], the principles will be the same. In fact even using remote servers deployed in a datacenter or virtualized servers with [http://www.citrix.com/English/ps2/products/subfeature.asp?contentID=2300456 Xen Server], [http://xen.org/products/cloudxen.html Xen Cloud] or [http://www.vmware.com/products/vsphere/overview.html VMWare vSphere] the steps will be very similar.<br />
<br />
<br />
For this tutorial we expect you are familiar with starting, and stopping Amazon WS instances. If you are not, go through this [http://docs.amazonwebservices.com/AWSEC2/latest/GettingStartedGuide/ tutorial from Amazon WS]. You will need an Amazon WS account. Amazon WS allows you to have [http://aws.amazon.com/free/ free tier so you can learn Amazon WS (EC2, S3, Elastic Load Balancer, Block Storage, SimpleDB, Simple Queue Service, Simple Notification Service)].<br />
<br />
<br />
==Fire up an Amazon Instance==<br />
<br />
Fire up an Amazon Instance using Amazon Linux (basically CentOS 5.4). Then [http://caucho.com/resin-4.0/changes/resin-4.0.24.xtp#RPM install Resin as follows using RPM]:<br />
<br />
<code> <pre><br />
<br />
$ sudo rpm --import http://caucho.com/download/rpm/RPM-GPG-KEY-caucho<br />
$ sudo yum install http://caucho.com/download/rpm/4.0.24/x86_64/resin-pro-4.0.24-1.x86_64.rpm<br />
<br />
</pre></code><br />
<br />
<br />
==Install Resin on a Local Box==<br />
<br />
Install <br />
[http://caucho.com/resin-4.0/admin/starting-resin-install.xtp#InstallingResinusingthedebpackageonUbuntuandDebian Resin] locally so you test locally and deploy. [http://caucho.com/resin-4.0/admin/starting-resin-install.xtp Feel free to install it on any supported OS].<br />
<br />
<br />
Add Caucho's Debian repository to your system's repositories to use automated update tools like Synaptic and apt-get. To do this, add the following line to your /etc/apt/sources.list<br />
<br />
<code> <pre><br />
deb http://caucho.com/download/debian unstable multiverse<br />
</pre></code><br />
<br />
<br />
Then install Resin as follows:<br />
<br />
<code> <pre><br />
apt-get update<br />
apt-get install resin-pro<br />
</pre></code><br />
<br />
It is a good idea to make sure the version you install on Amazon AMI matches the version you install locally.<br />
<br />
You can see that Resin is installed as follows:<br />
<br />
<code> <pre><br />
$ ls /etc/resin<br />
app-default.xml local.d resin.properties resin.xml<br />
<br />
$ ls /var/www/<br />
doc licenses log resin-data watchdog-data webapps<br />
<br />
$ ls /etc/init.d/resin<br />
/etc/init.d/resin<br />
<br />
$ ls -l /usr/local/share/resin<br />
lrwxrwxrwx 1 root root 16 2011-11-18 09:03 /usr/local/share/resin -> resin-pro-4.0.24<br />
<br />
</pre></code><br />
<br />
<br />
Also at this point, Resin should be running as well, and you can verify this with resinctl status:<br />
<br />
<code> <pre><br />
$ resinctl status<br />
Resin/4.0.24 status for watchdog at 127.0.0.1:6600<br />
<br />
watchdog:<br />
watchdog-pid: 7383<br />
<br />
server 'app-0' : ACTIVE<br />
password: missing<br />
watchdog-user: root<br />
user: www-data(www-data)<br />
root: /var/www<br />
conf: /etc/resin/resin.xml<br />
pid: 7590<br />
uptime: 0 days 00h19<br />
<br />
</pre></code><br />
<br />
== Install Maven 3 (Optional, for Roo example) ==<br />
<br />
If you already have a test .war file, you can skip to the deploy section and deploy your own war.<br />
<br />
Install maven. Maven is not in the public Ubuntu repository.<br />
<br />
<code><pre><br />
$ sudo add-apt-repository "deb http://build.discursive.com/apt/ lucid main"<br />
$ sudo apt-get update<br />
$ sudo apt-get install maven<br />
</pre></code><br />
<br />
Create a symbolic link:<br />
<code><pre><br />
$ sudo ln -s /usr/local/maven/bin/mvn /usr/local/bin/mvn<br />
</pre></code><br />
<br />
<br />
== Install Spring Roo (Optional) ==<br />
<br />
If you already have a test .war file, you can skip to the deploy section and deploy your own war.<br />
<br />
[http://static.springsource.org/spring-roo/reference/html/intro.html#intro-installation Download and install Spring Roo using directions at the Spring Roo site].<br />
<br />
This is how I install roo:<br />
<br />
<code><pre><br />
$ unzip spring-roo-1.2.0.RC1.zip<br />
$ sudo mv spring-roo-1.2.0.RC1 /usr/local/share/<br />
$ sudo ln -s /usr/local/share/spring-roo-1.2.0.RC1/ /usr/local/share/spring-roo<br />
$ sudo ln -s /usr/local/share/spring-roo/bin/roo.sh /usr/bin/roo<br />
</pre></code><br />
<br />
At the roo prompt, type hint.<br />
<br />
<code><pre><br />
<br />
$ roo<br />
____ ____ ____ <br />
/ __ \/ __ \/ __ \ <br />
/ /_/ / / / / / / / <br />
/ _, _/ /_/ / /_/ / <br />
/_/ |_|\____/\____/ 1.2.0.RC1 [rev dcaa483]<br />
<br />
<br />
Welcome to Spring Roo. For assistance press TAB or type "hint" then hit ENTER.<br />
...<br />
roo> hint<br />
<br />
..<br />
<br />
</pre></code><br />
<br />
Hint should always let you know what you might want to do next. Please feel free to read the Roo docs for details or just follow along and read the Roo docs later.<br />
<br />
Create the project, this generates maven project files and Spring starter project.<br />
<br />
<code><pre><br />
<br />
roo> project --topLevelPackage com.example.blog<br />
<br />
Created ROOT/pom.xml<br />
Created SRC_MAIN_RESOURCES<br />
Created SRC_MAIN_RESOURCES/log4j.properties<br />
Created SPRING_CONFIG_ROOT<br />
Created SPRING_CONFIG_ROOT/applicationContext.xml<br />
<br />
</pre></code><br />
<br />
Next setup the database and JPA, keep it simple to minimize the amount of things we need to configure later.<br />
<br />
<code><pre><br />
<br />
roo> jpa setup --database H2_IN_MEMORY --provider HIBERNATE <br />
<br />
Created SPRING_CONFIG_ROOT/database.properties<br />
Updated SPRING_CONFIG_ROOT/applicationContext.xml<br />
Created SRC_MAIN_RESOURCES/META-INF/persistence.xml<br />
Updated ROOT/pom.xml [added dependencies com.h2database:h2:1.3.161, org.hibernate:hibernate-core:3.6.8.Final, ...]<br />
<br />
</pre></code><br />
<br />
Create a entity class called blog.<br />
<br />
<code><pre><br />
<br />
roo> entity jpa --class ~.domain.Blog<br />
Created SRC_MAIN_JAVA/com/example/blog/domain<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog.java<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_Configurable.aj<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_Jpa_ActiveRecord.aj<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_ToString.aj<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_Jpa_Entity.aj<br />
<br />
</pre></code><br />
<br />
<br />
Add two fields to the Blog class.<br />
<br />
<code><pre><br />
~.domain.Blog roo> field string --fieldName title<br />
Updated SRC_MAIN_JAVA/com/example/blog/domain/Blog.java<br />
Created SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_JavaBean.aj<br />
<br />
~.domain.Blog roo> field string --fieldName message<br />
Updated SRC_MAIN_JAVA/com/example/blog/domain/Blog.java<br />
Updated SRC_MAIN_JAVA/com/example/blog/domain/Blog_Roo_JavaBean.aj<br />
</pre></code><br />
<br />
Create the web tier<br />
<code><pre><br />
~.domain.Blog roo> web mvc setup<br />
Created ROOT/src/main/webapp/WEB-INF/spring<br />
Created ROOT/src/main/webapp/WEB-INF/spring/webmvc-config.xml<br />
Created ROOT/src/main/webapp/WEB-INF/web.xml<br />
...<br />
Updated ROOT/src/main/webapp/WEB-INF/web.xml<br />
Updated ROOT/pom.xml [added dependencies org.springframework:spring-webmvc:${spring.version}, ...]<br />
Updated SRC_MAIN_WEBAPP/WEB-INF/views/footer.jspx<br />
</pre></code><br />
<br />
<br />
Generate the web tier. <br />
<br />
<code><pre><br />
~.domain.Blog roo> web mvc all --package ~.web<br />
<br />
Created SRC_MAIN_JAVA/com/example/blog/web<br />
Created SRC_MAIN_JAVA/com/example/blog/web/BlogController.java<br />
...<br />
Created SRC_MAIN_WEBAPP/WEB-INF/views/blogs<br />
Created SRC_MAIN_WEBAPP/WEB-INF/views/blogs/views.xml<br />
Updated SRC_MAIN_WEBAPP/WEB-INF/views/blogs/views.xml<br />
...<br />
Updated SRC_MAIN_WEBAPP/WEB-INF/views/blogs/views.xml<br />
...<br />
Created SRC_MAIN_WEBAPP/WEB-INF/views/blogs/update.jspx<br />
</pre></code><br />
<br />
Package our web app<br />
<br />
<code><pre><br />
roo> perform package<br />
</pre></code><br />
<br />
<br />
Exit roo.<br />
<code><pre><br />
roo> exit<br />
</pre></code><br />
<br />
== Deploy locally and test ==<br />
<br />
Deploy the example Roo app with Resin.<br />
<br />
<code><pre><br />
$ resinctl deploy target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog<br />
<br />
Deployed production/webapp/default/blog from target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
</pre></code><br />
<br />
<br />
You can see if the app was actually deployed:<br />
<br />
<code><pre><br />
$ resinctl deploy-list<br />
<br />
production/webapp/default/blog<br />
</pre></code><br />
<br />
Now you should be able to load the Roo blog example.<br />
<br />
http://localhost:8080/blog/<br />
<br />
<br />
==Create an Elastic IP and assign it to your Amazon WS Linux instance==<br />
<br />
Create an Elastic IP and assign it to the Amazon WS Linux instance using the [http://aws.amazon.com/console/ Amazon web console].<br />
<br />
I got this IP address.<br />
203.0.113.26<br />
<br />
<br />
==Create password==<br />
<br />
<br />
<code><pre><br />
$ resinctl generate-password -user admin -password roofoo<br />
<br />
admin_user : admin<br />
admin_password : {SSHA}BGBKQdCr0a5orH99eqIFwR/fffffffff<br />
<br />
</pre></code><br />
<br />
==Create a properties file and put it into user-data of Amazon AMI==<br />
<br />
[http://caucho.com/resin-4.0/changes/resin-4.0.24.xtp#resinproperties Resin properties].<br />
<br />
<br />
<code><pre><br />
log_level : info<br />
dev_mode : true<br />
resin_doc : true<br />
<br />
app_tier : 127.0.0.1<br />
web_tier :<br />
cache_tier :<br />
<br />
setuid_user : www-data<br />
setuid_group : www-data<br />
<br />
http : 8080<br />
https : 8443<br />
<br />
admin_user : admin<br />
admin_password : {SSHA}BGBKQdCr0a5orH99eqIFwR/ffffffff<br />
admin_external : true<br />
admin_remote_enable : true<br />
session_store : true<br />
<br />
</pre></code><br />
<br />
<br />
Create an amazon.xml <br />
<br />
<br />
<code><pre><br />
<resin xmlns="http://caucho.com/ns/resin"<br />
xmlns:resin="urn:java:com.caucho.resin"><br />
<br />
<resin:properties path="http://169.254.169.254/latest/user-data"<br />
optional="true"/><br />
<br />
</resin><br />
</pre></code><br />
<br />
<br />
Log into Amazon AMI instance and add the above to /etc/resin/local.d/amazon.xml.<br />
<br />
<br />
<code><pre><br />
$ ssh -i resin2.pem ec2-user@203.0.113.26 <br />
$ sudo nano /etc/resin/local.d/amazon.xml<br />
</pre></code><br />
<br />
From your local machine execute this command:<br />
<br />
<br />
<code><pre><br />
$ resinctl deploy target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -address 203.0.113.26 -port 8080 -user admin -password roofoo<br />
</pre></code><br />
<br />
<br />
Now it works in the cloud:<br />
<br />
http://203.0.113.26:8080/blog/<br />
<br />
<br />
Next step learn how to spin up instances with eucatools [[Resin Cloud deployment with Amazon WS EC2 and Euca Tools]].<br />
<br />
<br />
Next step learn how to use MySQL setup with Resin and Amazon RDS [[Resin MySQL and RDS setup with Amazon RDS]].<br />
<br />
<br />
[[Resin Cloud Deployment Reference]]</div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-07T01:19:36Z<p>Rickhigh: /* Cluster deployment NOT IMPLEMENTED UNTIL Resin 4.0.25 (coming soon) */</p>
<hr />
<div># Deploying to a local server<br />
## Deploying to a staging server (locally)<br />
## Deploying to a preview staging server (locally)<br />
# Deploying to a remote server<br />
## Setting up a user and password<br />
## Deploying to a remote server<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
## license-add enabling Resin features<br />
# Deploy to a staging server<br />
## Setting up load balancer to not to deploy to staging server<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
## Installing mysql driver for a web application using config-deploy<br />
## Showing what is in remote config with config-list-ls and config-list-cat<br />
# web-app-deploy settings<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code><br />
<br />
<br />
== Deploying to a local server ==<br />
<br />
Deploy commands available <br />
<br />
<code><br />
<pre><br />
$ resinctl help deploy<br />
<br />
<br />
Output:<br />
usage: bin/resin.sh [-conf <file>] [-server <id>] deploy -user <user> \<br />
-password <password> [options] <war-file><br />
<br />
description:<br />
deploys application specified in a <war-file> to resin server<br />
<br />
options:<br />
-conf <file> : resin configuration file<br />
-server <id> : id of a server<br />
-address <address> : ip or host name of the server<br />
-port <port> : server http port<br />
-user <user> : user name used for authentication to the server<br />
-password <password> : password used for authentication to the server<br />
-host <host> : virtual host to make application available on<br />
-name <name> : name of the context to deploy to, defaults to war-file name<br />
-stage <stage> : stage to deploy application to, defaults to production<br />
-version <version> : version of application formatted as <major.minor.micro.qualifier><br />
-m <message> : commit message<br />
</pre><br />
</code><br />
<br />
Turning on versioning:<br />
<br />
<code><br />
<pre><br />
$ cat /etc/resin/resin.properties | grep deploy<br />
<br />
Output:<br />
deploy_versioning : true<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
<br />
$ sudo grep "web-app-deploy" -A 1 /etc/resin/resin.xml <br />
<br />
Output:<br />
<web-app-deploy path="webapps" versioning="${deploy_versioning}"<br />
expand-preserve-fileset="WEB-INF/work/**"/><br />
<br />
</pre><br />
</code><br />
<br />
"if true, use the web-app's numeric suffix as a version"<br />
<br />
Run deploy command passing location of war file.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.war -name blog <br />
<br />
Output:<br />
Deployed production/webapp/default/blog from \<br />
./target/blog-0.1.0.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
To see the deployed you can use resinctl deploy-list<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
<br />
Now undeploy it:<br />
<br />
<code><br />
<pre><br />
$ resinctl undeploy blog<br />
<br />
Output:<br />
Undeployed blog from hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
At this point there should be nothing<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
</pre><br />
</code><br />
<br />
Now deploy it with versioning:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -version 0.1.0 <br />
<br />
Output:<br />
Deployed production/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
</pre><br />
</code><br />
<br />
Blog application is under the version 0.1.0<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog-0.1.0<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
=== Deploying to a staging server ===<br />
<br />
Deploy to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogz -version 0.1.0 -stage staging<br />
<br />
Output<br />
Deployed staging/webapp/default/blogz-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
The staging name is logical. You can call it anything. The app will not be served unless<br />
the server is started with this staging name.<br />
<br />
Showing items deployed to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
production/webapp/default/blog-0.1.0<br />
staging/webapp/default/blogz-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
The /blog works but /blogz does not work because server is by default setup as production server.<br />
<br />
/blog works because server is setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blog<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
/blogz does not work because server is not setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogz<br />
...<br />
HTTP request sent, awaiting response... 404 Not Found<br />
</pre><br />
</code><br />
<br />
To run the server as a staging server do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ resinctl help start<br />
<br />
Output:<br />
usage: bin/resin.sh [-options] start<br />
<br />
where options include:<br />
-conf <file> : select a configuration file<br />
-data-directory <dir> : select a resin-data directory<br />
-join-cluster <cluster> : join a cluster as a dynamic server<br />
-log-directory <dir> : select a logging directory<br />
-resin-home <dir> : select a resin home directory<br />
-root-directory <dir> : select a root directory<br />
-server <id> : select a <server> to run<br />
-watchdog-port <port> : override the watchdog-port<br />
-verbose : print verbose starting information<br />
-preview : run as a preview server<br />
-debug-port <port> : configure a debug port<br />
-jmx-port <port> : configure an unauthenticated jmx port<br />
-stage <staging-name> : The stage the server is serving (default production)<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ sudo resinctl start -stage staging<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
<br />
$ wget localhost:8080/blogz<br />
...<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
<br />
=== Deploying to a preview staging server ===<br />
<br />
<br />
<code><br />
<pre><br />
<br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogp -version 0.1.0 -stage preview<br />
<br />
Output<br />
Deployed preview/webapp/default/blogp-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
$ resinctl deploy-list<br />
<br />
Output<br />
preview/webapp/default/blogp-0.1.0<br />
production/webapp/default/blog-0.1.0<br />
...<br />
</pre><br />
</code><br />
<br />
<br />
Restart the server in preview stage, since preview staging is a common thing, you can just use the -preview command.<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
$ sudo resinctl start -preview<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<br />
Now the preview blog site is available.<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogp<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
== Deploying to a Remote Server ==<br />
<br />
Setup the remote box (Install Resin)<br />
<br />
You need to create a user name and password.<br />
<br />
<code><br />
<pre><br />
REMOTE SERVER $ resinctl generate-password -user rick -password dogbones<br />
<br />
Output:<br />
admin_user : rick<br />
admin_password : {SSHA}JmojvNUU4OpTOw0/SESRsnpEHejxkhZZ<br />
</pre><br />
</code><br />
<br />
<br />
Modify resin.properties<br />
<br />
<code><br />
<pre><br />
<br />
REMOTE SERVER$ cat /etc/resin/resin.properties<br />
<br />
Output:<br />
admin_user : rick<br />
admin_password : {SSHA}JmojvNUU4OpTOw0/SESRsnpEHejxkhZZ<br />
admin_remote_enable : true<br />
...<br />
</pre><br />
</code><br />
<br />
Now from the local server deploy your app as follows:<br />
<br />
<code><br />
<pre><br />
LOCAL SERVER $ resinctl deploy target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogdb \ <br />
-address 192.168.248.168 -port 8080 -user rick -password dogbones<br />
</pre><br />
</code><br />
<br />
You can verify that the deploy worked as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -address 192.168.248.168 -port 8080 -user rick -password dogbones<br />
<br />
Output:<br />
production/webapp/default/blog<br />
...<br />
</pre><br />
</code><br />
<br />
<br />
<br />
== Working with deploy-copy to release, and rollback ==<br />
<br />
<br />
Deploy version to archive.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -stage archive -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
<br />
List versions deployed.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
archive/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
Copy deployment to production<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-copy -source blog -source-stage archive \<br />
-source-version 0.1.0 -target blog<br />
<br />
Output:<br />
copied archive/webapp/default/blog-0.1.0 to production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
archive/webapp/default/blog-0.1.0<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
<br />
When you deploy this way you must start the app as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-start blog<br />
<br />
Output:<br />
'production/webapp/default/blog' is started<br />
</pre><br />
</code><br />
<br />
Then you would deploy copy a different version to rollback or promote a different version to prod.<br />
<br />
In review of the above, we have decided to make the process a bit easier.<br />
<br />
The following section has not yet been implemented, but is slated for 4.0.25.<br />
<br />
<br />
<br />
<br />
== Proposed but not Implemented 4.0.25 Deploy and Rollback==<br />
<br />
<br />
''The following section has not yet been implemented, but is slated for 4.0.25.''<br />
<br />
<br />
Deploy version to archive.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
into production \<br />
</pre><br />
</code><br />
<br />
<br />
List versions deployed with all option.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -all<br />
<br />
Output:<br />
Tag Ver. DD-MM-YYYY-HH:MM:SS<br />
archive/webapp/default/blog-0.1.0 0.1.0 05-12-2011-13:00:00<br />
production/webapp/default/blog 0.1.0 05-12-2011-13:00:00<br />
</pre><br />
</code><br />
<br />
<br />
<br />
Later you decide to update to a new version likely after weeks or months of hard development.<br />
The line marked with production/webapp/default/blog is the /blog that is deployed in the running server.<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.2.0.BUILD-SNAPSHOT.war -name blog -version 0.2.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.2.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
deployed into production.<br />
</pre><br />
</code><br />
<br />
<br />
At this point the following will be deployed:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -all<br />
<br />
Output:<br />
Tag Ver. DD-MM-YYYY-HH:MM:SS<br />
archive/webapp/default/blog-0.1.0 0.1.0 05-12-2011-13:00:00<br />
archive/webapp/default/blog-0.2.0 0.2.0 05-01-2012-11:00:00<br />
production/webapp/default/blog 0.2.0 05-01-2012-11:00:00<br />
</pre><br />
</code><br />
<br />
<br />
Even after rigorous load testing and QA testing, a critical bug was found in 0.2.0 blog and now you need to quickly rollback to a previous version.<br />
<br />
<br />
To rollback to a previous version use the '''deploy-rollback''' as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-rollback blog -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 to hmux://127.0.0.1:6800 \<br />
into production <br />
<br />
</pre><br />
</code><br />
<br />
<br />
Alternatively you can use deploy-promote to accomplish the same thing.<br />
<br />
To rollback to a previous version use the '''deploy-promote''' as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-promote blog -stage archive -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 to hmux://127.0.0.1:6800 \<br />
into production <br />
<br />
</pre><br />
</code><br />
<br />
We specify the stage as archive (-stage archive) because deploy-promote defaults to working with the preview stage (more on this in the next section).<br />
<br />
Now after the rollback the deployed servers should look like this.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -all<br />
<br />
Output:<br />
Tag Ver. DD-MM-YYYY-HH:MM:SS<br />
archive/webapp/default/blog-0.1.0 0.1.0 05-12-2011-13:00:00<br />
archive/webapp/default/blog-0.2.0 0.2.0 05-01-2012-11:00:00<br />
production/webapp/default/blog 0.1.0 05-12-2011-13:00:00<br />
</pre><br />
</code><br />
<br />
<br />
Notice that 0.1.0 is now in production and 0.2.0 is not.<br />
<br />
==Promoting an app from preview mode to production==<br />
<br />
Options<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-promote blog <br />
<br />
Output:<br />
Deployed preview/webapp/default/blog to hmux://127.0.0.1:6800 \<br />
into production <br />
<br />
</pre><br />
</code><br />
<br />
Promotes blog that is currently in preview stage into production.<br />
<br />
== Cluster deployment NOT IMPLEMENTED UNTIL Resin 4.0.25 (coming soon) ==<br />
<br />
This section is slated for Resin 4.0.25 but not released yet and may change.<br />
<br />
Resin 4.0.25 adds the following config command line options to support remote configuration and cloud configuration of Resin servers.<br />
<br />
<code><br />
<pre><br />
resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-ls - list contents of config dir as a tree (ex. ./lib)<br />
config-cat - list contents of config file (must be text)<br />
config-undeploy - undeploys a config<br />
config-rollback - rollback to a different config<br />
config-promote - promotes a staged config to production<br />
</pre><br />
</code><br />
<br />
<br />
===Background on need===<br />
At times you need to include things like jar files that are available to more than one application.<br />
Resin allows you to deploy these to remote servers (which can be 1 to hundreds of servers) with one simple command.<br />
<br />
Let's say your /blog application that relies on MySQL.<br />
<br />
<br />
By default resin uses the /etc/resin/resin.properties file. You could add these properties to /etc/resin/resin.properties.<br />
<br />
'''/etc/resin/resin.properties on resin server'''<br />
<code><br />
<pre><br />
<br />
blogdb.url : blogdb.cvolnlau763z.us-east-1.rds.amazonaws.com<br />
blogdb.user : bloguser<br />
blogdb.password : roofoo<br />
<br />
</pre><br />
</code><br />
<br />
These properties will vary for dev, production, qa, etc. And once they are set, they will not change often.<br />
<br />
You could test locally by copying this file (blog-database.xml) to /etc/resin/resin.d/.<br />
<br />
<br />
'''/etc/resin/resin.d/database.xml''' blog-database.properties under /etc/resin/resin.d.<br />
<code><br />
<pre><br />
<resin xmlns="http://caucho.com/ns/resin"<br />
xmlns:resin="urn:java:com.caucho.resin"><br />
<br />
<database jndi-name="jdbc/blogdb"><br />
<driver type="com.mysql.jdbc.Driver"><br />
<url>jdbc:mysql://${blogdb.url}:3306/blogdb</url><br />
<user>${blogdb.user}</user><br />
<password>${blogdb.password}</password><br />
</driver><br />
</database><br />
</resin><br />
</pre><br />
</code><br />
<br />
<br />
The problem now is that you don't have a mysql.jar file and you will get a class not found exception when the apps starts up.<br />
<br />
<br />
<br />
If you are using maven locally you can copy mysql from the maven local repo as follows:<br />
<br />
Find and copy the mysql jar file from the maven local repo to Resin as follows:<br />
<br />
Find it:<br />
<br />
<code><br />
<pre><br />
$ find ~/.m2/repository/ -name "*mysql*.jar"<br />
/home/rick/.m2/repository/mysql/mysql-connector-java/5.1.18/mysql-connector-java-5.1.18.jar<br />
</pre><br />
</code><br />
<br />
<br />
Now deploy it<br />
<br />
<code><br />
<pre><br />
$ sudo cp ~/.m2/repository/mysql/mysql-connector-java/5.1.18/mysql-connector-java-5.1.18.jar \ <br />
/usr/local/share/resin/lib/<br />
<br />
</pre><br />
</code><br />
<br />
Or you can use yum to get the mysql driver as follows:<br />
<br />
Next install the mysql driver.<br />
$ sudo yum install mysql-connector-java<br />
$ sudo cp /usr/share/java/mysql-connector-java.jar /usr/local/share/resin/lib/<br />
<br />
<br />
The problem with this approach is that things work for you locally for /blog application if it relies on mysql being managed under jndi:jdbc/blogdb, but all of your remote deployments will fail unless you manually add the mysql jar to each server, manually add the blog-database.xml file to each server, and manually update each resin.properties file.<br />
<br />
=== Remote config deployment ===<br />
Resin 4.0.25 allows you to deploy configuration files not just applications. This allows you to change what jar files get loaded into the Resin classpath, config files and properties. If you are doing deployment to 1 remote server or to a triad for cloud deployment with 100's of servers, deploying mysql to them can be as easy as what we are going to describe.<br />
<br />
Ok assuming you have developed and tested the /blog app locally and now you want to push a blog to a remote server or set of servers, you can do the following:<br />
<br />
<br />
# Create a directory blog-database<br />
# Create a directory called blog-database/lib<br />
# Copy blog-database.xml into blog-database directory<br />
# Copy mysql.jar into blog-database/lib<br />
# Create a file called blog-database/resin.properties<br />
# Use resinctl config-deploy to deploy the configuration<br />
<br />
<br />
First create the dirs and copy the jar.<br />
<br />
<code><br />
<pre><br />
$ mkdir blog-database<br />
$ mkdir blog-database/lib<br />
$ cp /etc/resin/resin.d/blog-database.xml blog-database/<br />
$ cp /usr/local/share/resin/lib/mysql-connector*.jar blog-database/lib/<br />
</pre><br />
</code><br />
<br />
Instead of modifying every servers /etc/resin/resin.properties, you can add a resin.properties to blog-database dir that gets deployed with the config bundle as follows:<br />
<br />
'''./blog-database/resin.properties'''<br />
<code><br />
<pre><br />
blogdb.url : blogdb.cvolnlau763z.us-east-1.rds.amazonaws.com<br />
blogdb.user : bloguser<br />
blogdb.password : roofoo<br />
</pre><br />
</code><br />
<br />
It might make sense to deploy the database properties in a separate config deployment, but for simplicity we bundle together in one.<br />
<br />
'''NOTE: This works for dir/lib . We should allow dir/webapp-jars and it should work the same. <br />
The jars get loaded per webapp for dir/webapp-jars. END NOTE'''<br />
<br />
Next deploy to the remote server as follows:<br />
<code><br />
<pre><br />
$ resinctl config-deploy blog-database -version=0.1.0 -address=199.99.99.01 -port=8080<br />
</pre><br />
</code><br />
<br />
To see what is deployed you can do the following:<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl config-list -all -address=199.99.99.01 -port=8080<br />
<br />
Output:<br />
archive/config/default/blog-database-0.1.0 0.1.0 05-12-2011-13:00:00<br />
production/config/default/blog-database 0.1.0 05-12-2011-13:00:00<br />
</pre><br />
</code><br />
<br />
<br />
<br />
Or to see everything in the deployment use config-ls<br />
<code><br />
<pre><br />
$ resinctl config-ls blog-database -version=0.1.0 -address=199.99.99.01 -port=8080<br />
<br />
Output:<br />
blog-database.xml<br />
resin.properties<br />
lib/<br />
mysql-connector-java-5.1.18.jar<br />
</pre><br />
</code><br />
<br />
<br />
If you wanted to see exactly what was in blog-database/blog-database.xml you could do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl config-cat blog-database -file=./blog-database.xml -version=0.1.0 -address=199.99.99.01 -port=8080<br />
<br />
Output:<br />
<resin xmlns="http://caucho.com/ns/resin"<br />
xmlns:resin="urn:java:com.caucho.resin"><br />
<br />
<database jndi-name="jdbc/blogdb"><br />
<driver type="com.mysql.jdbc.Driver"><br />
<url>jdbc:mysql://${blogdb.url}:3306/blogdb</url><br />
<user>${blogdb.user}</user><br />
<password>${blogdb.password}</password><br />
</driver><br />
</database><br />
</resin><br />
<br />
</pre><br />
</code><br />
<br />
The following commands work like deploy-undeploy, deploy-rollback and deploy-promote, but for configuration.<br />
<br />
# config-undeploy - undeploys a config<br />
# config-rollback - rollback to a different config<br />
# config-promote - promotes a staged config to production<br />
<br />
<br />
=== Using config-deploy for a local server ===<br />
Note you also do these same steps for a local development server instead of copying jar files and config files as follows:<br />
<br />
Next deploy to the remote server as follows:<br />
<code><br />
<pre><br />
$ resinctl config-deploy blog-database -version=0.1.0 <br />
</pre><br />
</code><br />
<br />
(Just leave off the address and port.)<br />
<br />
To see what is deployed you can do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl config-list -all <br />
<br />
Output:<br />
archive/config/default/blog-database-0.1.0 0.1.0 05-12-2011-13:00:00<br />
production/config/default/blog-database 0.1.0 05-12-2011-13:00:00<br />
</pre><br />
</code><br />
<br />
Just leave off address and port to see what is configured locally.<br />
<br />
The advantage of using confg-deploy locally is that your dev system is more like your integration, qa and production system.<br />
It is like having a local cloud.</div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-07T01:08:28Z<p>Rickhigh: /* Promoting an app from preview mode to production */</p>
<hr />
<div># Deploying to a local server<br />
## Deploying to a staging server (locally)<br />
## Deploying to a preview staging server (locally)<br />
# Deploying to a remote server<br />
## Setting up a user and password<br />
## Deploying to a remote server<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
## license-add enabling Resin features<br />
# Deploy to a staging server<br />
## Setting up load balancer to not to deploy to staging server<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
## Installing mysql driver for a web application using config-deploy<br />
## Showing what is in remote config with config-list-ls and config-list-cat<br />
# web-app-deploy settings<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code><br />
<br />
<br />
== Deploying to a local server ==<br />
<br />
Deploy commands available <br />
<br />
<code><br />
<pre><br />
$ resinctl help deploy<br />
<br />
<br />
Output:<br />
usage: bin/resin.sh [-conf <file>] [-server <id>] deploy -user <user> \<br />
-password <password> [options] <war-file><br />
<br />
description:<br />
deploys application specified in a <war-file> to resin server<br />
<br />
options:<br />
-conf <file> : resin configuration file<br />
-server <id> : id of a server<br />
-address <address> : ip or host name of the server<br />
-port <port> : server http port<br />
-user <user> : user name used for authentication to the server<br />
-password <password> : password used for authentication to the server<br />
-host <host> : virtual host to make application available on<br />
-name <name> : name of the context to deploy to, defaults to war-file name<br />
-stage <stage> : stage to deploy application to, defaults to production<br />
-version <version> : version of application formatted as <major.minor.micro.qualifier><br />
-m <message> : commit message<br />
</pre><br />
</code><br />
<br />
Turning on versioning:<br />
<br />
<code><br />
<pre><br />
$ cat /etc/resin/resin.properties | grep deploy<br />
<br />
Output:<br />
deploy_versioning : true<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
<br />
$ sudo grep "web-app-deploy" -A 1 /etc/resin/resin.xml <br />
<br />
Output:<br />
<web-app-deploy path="webapps" versioning="${deploy_versioning}"<br />
expand-preserve-fileset="WEB-INF/work/**"/><br />
<br />
</pre><br />
</code><br />
<br />
"if true, use the web-app's numeric suffix as a version"<br />
<br />
Run deploy command passing location of war file.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.war -name blog <br />
<br />
Output:<br />
Deployed production/webapp/default/blog from \<br />
./target/blog-0.1.0.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
To see the deployed you can use resinctl deploy-list<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
<br />
Now undeploy it:<br />
<br />
<code><br />
<pre><br />
$ resinctl undeploy blog<br />
<br />
Output:<br />
Undeployed blog from hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
At this point there should be nothing<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
</pre><br />
</code><br />
<br />
Now deploy it with versioning:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -version 0.1.0 <br />
<br />
Output:<br />
Deployed production/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
</pre><br />
</code><br />
<br />
Blog application is under the version 0.1.0<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog-0.1.0<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
=== Deploying to a staging server ===<br />
<br />
Deploy to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogz -version 0.1.0 -stage staging<br />
<br />
Output<br />
Deployed staging/webapp/default/blogz-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
The staging name is logical. You can call it anything. The app will not be served unless<br />
the server is started with this staging name.<br />
<br />
Showing items deployed to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
production/webapp/default/blog-0.1.0<br />
staging/webapp/default/blogz-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
The /blog works but /blogz does not work because server is by default setup as production server.<br />
<br />
/blog works because server is setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blog<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
/blogz does not work because server is not setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogz<br />
...<br />
HTTP request sent, awaiting response... 404 Not Found<br />
</pre><br />
</code><br />
<br />
To run the server as a staging server do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ resinctl help start<br />
<br />
Output:<br />
usage: bin/resin.sh [-options] start<br />
<br />
where options include:<br />
-conf <file> : select a configuration file<br />
-data-directory <dir> : select a resin-data directory<br />
-join-cluster <cluster> : join a cluster as a dynamic server<br />
-log-directory <dir> : select a logging directory<br />
-resin-home <dir> : select a resin home directory<br />
-root-directory <dir> : select a root directory<br />
-server <id> : select a <server> to run<br />
-watchdog-port <port> : override the watchdog-port<br />
-verbose : print verbose starting information<br />
-preview : run as a preview server<br />
-debug-port <port> : configure a debug port<br />
-jmx-port <port> : configure an unauthenticated jmx port<br />
-stage <staging-name> : The stage the server is serving (default production)<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ sudo resinctl start -stage staging<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
<br />
$ wget localhost:8080/blogz<br />
...<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
<br />
=== Deploying to a preview staging server ===<br />
<br />
<br />
<code><br />
<pre><br />
<br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogp -version 0.1.0 -stage preview<br />
<br />
Output<br />
Deployed preview/webapp/default/blogp-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
$ resinctl deploy-list<br />
<br />
Output<br />
preview/webapp/default/blogp-0.1.0<br />
production/webapp/default/blog-0.1.0<br />
...<br />
</pre><br />
</code><br />
<br />
<br />
Restart the server in preview stage, since preview staging is a common thing, you can just use the -preview command.<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
$ sudo resinctl start -preview<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<br />
Now the preview blog site is available.<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogp<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
== Deploying to a Remote Server ==<br />
<br />
Setup the remote box (Install Resin)<br />
<br />
You need to create a user name and password.<br />
<br />
<code><br />
<pre><br />
REMOTE SERVER $ resinctl generate-password -user rick -password dogbones<br />
<br />
Output:<br />
admin_user : rick<br />
admin_password : {SSHA}JmojvNUU4OpTOw0/SESRsnpEHejxkhZZ<br />
</pre><br />
</code><br />
<br />
<br />
Modify resin.properties<br />
<br />
<code><br />
<pre><br />
<br />
REMOTE SERVER$ cat /etc/resin/resin.properties<br />
<br />
Output:<br />
admin_user : rick<br />
admin_password : {SSHA}JmojvNUU4OpTOw0/SESRsnpEHejxkhZZ<br />
admin_remote_enable : true<br />
...<br />
</pre><br />
</code><br />
<br />
Now from the local server deploy your app as follows:<br />
<br />
<code><br />
<pre><br />
LOCAL SERVER $ resinctl deploy target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogdb \ <br />
-address 192.168.248.168 -port 8080 -user rick -password dogbones<br />
</pre><br />
</code><br />
<br />
You can verify that the deploy worked as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -address 192.168.248.168 -port 8080 -user rick -password dogbones<br />
<br />
Output:<br />
production/webapp/default/blog<br />
...<br />
</pre><br />
</code><br />
<br />
<br />
<br />
== Working with deploy-copy to release, and rollback ==<br />
<br />
<br />
Deploy version to archive.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -stage archive -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
<br />
List versions deployed.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
archive/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
Copy deployment to production<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-copy -source blog -source-stage archive \<br />
-source-version 0.1.0 -target blog<br />
<br />
Output:<br />
copied archive/webapp/default/blog-0.1.0 to production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
archive/webapp/default/blog-0.1.0<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
<br />
When you deploy this way you must start the app as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-start blog<br />
<br />
Output:<br />
'production/webapp/default/blog' is started<br />
</pre><br />
</code><br />
<br />
Then you would deploy copy a different version to rollback or promote a different version to prod.<br />
<br />
In review of the above, we have decided to make the process a bit easier.<br />
<br />
The following section has not yet been implemented, but is slated for 4.0.25.<br />
<br />
<br />
<br />
<br />
== Proposed but not Implemented 4.0.25 Deploy and Rollback==<br />
<br />
<br />
''The following section has not yet been implemented, but is slated for 4.0.25.''<br />
<br />
<br />
Deploy version to archive.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
into production \<br />
</pre><br />
</code><br />
<br />
<br />
List versions deployed with all option.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -all<br />
<br />
Output:<br />
Tag Ver. DD-MM-YYYY-HH:MM:SS<br />
archive/webapp/default/blog-0.1.0 0.1.0 05-12-2011-13:00:00<br />
production/webapp/default/blog 0.1.0 05-12-2011-13:00:00<br />
</pre><br />
</code><br />
<br />
<br />
<br />
Later you decide to update to a new version likely after weeks or months of hard development.<br />
The line marked with production/webapp/default/blog is the /blog that is deployed in the running server.<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.2.0.BUILD-SNAPSHOT.war -name blog -version 0.2.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.2.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
deployed into production.<br />
</pre><br />
</code><br />
<br />
<br />
At this point the following will be deployed:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -all<br />
<br />
Output:<br />
Tag Ver. DD-MM-YYYY-HH:MM:SS<br />
archive/webapp/default/blog-0.1.0 0.1.0 05-12-2011-13:00:00<br />
archive/webapp/default/blog-0.2.0 0.2.0 05-01-2012-11:00:00<br />
production/webapp/default/blog 0.2.0 05-01-2012-11:00:00<br />
</pre><br />
</code><br />
<br />
<br />
Even after rigorous load testing and QA testing, a critical bug was found in 0.2.0 blog and now you need to quickly rollback to a previous version.<br />
<br />
<br />
To rollback to a previous version use the '''deploy-rollback''' as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-rollback blog -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 to hmux://127.0.0.1:6800 \<br />
into production <br />
<br />
</pre><br />
</code><br />
<br />
<br />
Alternatively you can use deploy-promote to accomplish the same thing.<br />
<br />
To rollback to a previous version use the '''deploy-promote''' as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-promote blog -stage archive -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 to hmux://127.0.0.1:6800 \<br />
into production <br />
<br />
</pre><br />
</code><br />
<br />
We specify the stage as archive (-stage archive) because deploy-promote defaults to working with the preview stage (more on this in the next section).<br />
<br />
Now after the rollback the deployed servers should look like this.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -all<br />
<br />
Output:<br />
Tag Ver. DD-MM-YYYY-HH:MM:SS<br />
archive/webapp/default/blog-0.1.0 0.1.0 05-12-2011-13:00:00<br />
archive/webapp/default/blog-0.2.0 0.2.0 05-01-2012-11:00:00<br />
production/webapp/default/blog 0.1.0 05-12-2011-13:00:00<br />
</pre><br />
</code><br />
<br />
<br />
Notice that 0.1.0 is now in production and 0.2.0 is not.<br />
<br />
==Promoting an app from preview mode to production==<br />
<br />
Options<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-promote blog <br />
<br />
Output:<br />
Deployed preview/webapp/default/blog to hmux://127.0.0.1:6800 \<br />
into production <br />
<br />
</pre><br />
</code><br />
<br />
Promotes blog that is currently in preview stage into production.<br />
<br />
== Cluster deployment NOT IMPLEMENTED UNTIL Resin 4.0.25 (coming soon) ==<br />
<br />
This section is slated for Resin 4.0.25 but not released yet and may change.<br />
<br />
Resin 4.0.25 adds the following config command line options to support remote configuration and cloud configuration of Resin servers.<br />
<br />
<code><br />
<pre><br />
resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-tree - list contents of directories recursively <br />
config-list-cat - list contents of config file (must be text)<br />
config-undeploy - undeploys a config<br />
config-rollback - rollback to a different config<br />
config-promote - promotes a staged config to production<br />
</pre><br />
</code><br />
<br />
<br />
===Background on need===<br />
At times you need to include things like jar files that are available to more than one application.<br />
Resin allows you to deploy these to remote servers (which can be 1 to hundreds of servers) with one simple command.<br />
<br />
Let's say your /blog application that relies on MySQL.<br />
<br />
<br />
By default resin uses the /etc/resin/resin.properties file. You could add these properties to /etc/resin/resin.properties.<br />
<br />
'''/etc/resin/resin.properties on resin server'''<br />
<code><br />
<pre><br />
<br />
blogdb.url : blogdb.cvolnlau763z.us-east-1.rds.amazonaws.com<br />
blogdb.user : bloguser<br />
blogdb.password : roofoo<br />
<br />
</pre><br />
</code><br />
<br />
These properties will vary for dev, production, qa, etc. And once they are set, they will not change often.<br />
<br />
You could test locally by copying this file (blog-database.xml) to /etc/resin/resin.d/.<br />
<br />
<br />
'''/etc/resin/resin.d/database.xml''' blog-database.properties under /etc/resin/resin.d.<br />
<code><br />
<pre><br />
<resin xmlns="http://caucho.com/ns/resin"<br />
xmlns:resin="urn:java:com.caucho.resin"><br />
<br />
<database jndi-name="jdbc/blogdb"><br />
<driver type="com.mysql.jdbc.Driver"><br />
<url>jdbc:mysql://${blogdb.url}:3306/blogdb</url><br />
<user>${blogdb.user}</user><br />
<password>${blogdb.password}</password><br />
</driver><br />
</database><br />
</resin><br />
</pre><br />
</code><br />
<br />
<br />
The problem now is that you don't have a mysql.jar file and you will get a class not found exception when the apps starts up.<br />
<br />
<br />
<br />
If you are using maven locally you can copy mysql from the maven local repo as follows:<br />
<br />
Find and copy the mysql jar file from the maven local repo to Resin as follows:<br />
<br />
Find it:<br />
<br />
<code><br />
<pre><br />
$ find ~/.m2/repository/ -name "*mysql*.jar"<br />
/home/rick/.m2/repository/mysql/mysql-connector-java/5.1.18/mysql-connector-java-5.1.18.jar<br />
</pre><br />
</code><br />
<br />
<br />
Now deploy it<br />
<br />
<code><br />
<pre><br />
$ sudo cp ~/.m2/repository/mysql/mysql-connector-java/5.1.18/mysql-connector-java-5.1.18.jar \ <br />
/usr/local/share/resin/lib/<br />
<br />
</pre><br />
</code><br />
<br />
Or you can use yum to get the mysql driver as follows:<br />
<br />
Next install the mysql driver.<br />
$ sudo yum install mysql-connector-java<br />
$ sudo cp /usr/share/java/mysql-connector-java.jar /usr/local/share/resin/lib/<br />
<br />
<br />
The problem with this approach is that things work for you locally for /blog application if it relies on mysql being managed under jndi:jdbc/blogdb, but all of your remote deployments will fail unless you manually add the mysql jar to each server, manually add the blog-database.xml file to each server, and manually update each resin.properties file.<br />
<br />
=== Remote config deployment ===<br />
Resin 4.0.25 allows you to deploy configuration files not just applications. This allows you to change what jar files get loaded into the Resin classpath, config files and properties. If you are doing deployment to 1 remote server or to a triad for cloud deployment with 100's of servers, deploying mysql to them can be as easy as what we are going to describe.<br />
<br />
Ok assuming you have developed and tested the /blog app locally and now you want to push a blog to a remote server or set of servers, you can do the following:<br />
<br />
<br />
# Create a directory blog-database<br />
# Create a directory called blog-database/lib<br />
# Copy blog-database.xml into blog-database directory<br />
# Copy mysql.jar into blog-database/lib<br />
# Create a file called blog-database/resin.properties<br />
# Use resinctl config-deploy to deploy the configuration<br />
<br />
<br />
First create the dirs and copy the jar.<br />
<br />
<code><br />
<pre><br />
$ mkdir blog-database<br />
$ mkdir blog-database/lib<br />
$ cp /etc/resin/resin.d/blog-database.xml blog-database/<br />
$ cp /usr/local/share/resin/lib/mysql-connector*.jar blog-database/lib/<br />
</pre><br />
</code><br />
<br />
Instead of modifying every servers /etc/resin/resin.properties, you can add a resin.properties to blog-database dir that gets deployed with the config bundle as follows:<br />
<br />
'''./blog-database/resin.properties'''<br />
<code><br />
<pre><br />
blogdb.url : blogdb.cvolnlau763z.us-east-1.rds.amazonaws.com<br />
blogdb.user : bloguser<br />
blogdb.password : roofoo<br />
</pre><br />
</code><br />
<br />
It might make sense to deploy the database properties in a separate config deployment, but for simplicity we bundle together in one.<br />
<br />
'''NOTE: This works for dir/lib . We should allow dir/webapp-jars and it should work the same. <br />
The jars get loaded per webapp for dir/webapp-jars. END NOTE'''<br />
<br />
Next deploy to the remote server as follows:<br />
<code><br />
<pre><br />
$ resinctl config-deploy blog-database -version=0.1.0 -address=199.99.99.01 -port=8080<br />
</pre><br />
</code><br />
<br />
To see what is deployed you can do the following:<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl config-list -all -address=199.99.99.01 -port=8080<br />
<br />
Output:<br />
archive/config/default/blog-database-0.1.0 0.1.0 05-12-2011-13:00:00<br />
production/config/default/blog-database 0.1.0 05-12-2011-13:00:00<br />
</pre><br />
</code><br />
<br />
<br />
If you wanted to see exactly what was in blog-database/lib you could do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl config-list-ls blog-database -dir=lib -version=0.1.0 -address=199.99.99.01 -port=8080<br />
<br />
Output:<br />
mysql-connector-java-5.1.18.jar<br />
</pre><br />
</code><br />
<br />
Or to see everything in the deployment use tree<br />
<code><br />
<pre><br />
$ resinctl config-list-tree blog-database -version=0.1.0 -address=199.99.99.01 -port=8080<br />
<br />
Output:<br />
blog-database.xml<br />
resin.properties<br />
lib/<br />
mysql-connector-java-5.1.18.jar<br />
</pre><br />
</code><br />
<br />
<br />
If you wanted to see exactly what was in blog-database/blog-database.xml you could do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl config-list-cat blog-database -file=./blog-database.xml -version=0.1.0 -address=199.99.99.01 -port=8080<br />
<br />
Output:<br />
<resin xmlns="http://caucho.com/ns/resin"<br />
xmlns:resin="urn:java:com.caucho.resin"><br />
<br />
<database jndi-name="jdbc/blogdb"><br />
<driver type="com.mysql.jdbc.Driver"><br />
<url>jdbc:mysql://${blogdb.url}:3306/blogdb</url><br />
<user>${blogdb.user}</user><br />
<password>${blogdb.password}</password><br />
</driver><br />
</database><br />
</resin><br />
<br />
</pre><br />
</code><br />
<br />
The following commands work like deploy-undeploy, deploy-rollback and deploy-promote, but for configuration.<br />
<br />
# config-undeploy - undeploys a config<br />
# config-rollback - rollback to a different config<br />
# config-promote - promotes a staged config to production<br />
<br />
<br />
=== Using config-deploy for a local server ===<br />
Note you also do these same steps for a local development server instead of copying jar files and config files as follows:<br />
<br />
Next deploy to the remote server as follows:<br />
<code><br />
<pre><br />
$ resinctl config-deploy blog-database -version=0.1.0 <br />
</pre><br />
</code><br />
<br />
(Just leave off the address and port.)<br />
<br />
To see what is deployed you can do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl config-list -all -address=199.99.99.01 -port=8080<br />
<br />
Output:<br />
archive/config/default/blog-database-0.1.0 0.1.0 05-12-2011-13:00:00<br />
production/config/default/blog-database 0.1.0 05-12-2011-13:00:00<br />
</pre><br />
</code><br />
<br />
<br />
If you wanted to see exactly what was in blog-database/lib you could do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl config-list-ls blog-database -dir=lib -version=0.1.0 <br />
<br />
Output:<br />
mysql-connector-java-5.1.18.jar<br />
</pre><br />
</code><br />
<br />
Or to see everything in the deployment use tree<br />
<code><br />
<pre><br />
$ resinctl config-list-tree blog-database -version=0.1.0 <br />
<br />
Output:<br />
blog-database.xml<br />
resin.properties<br />
lib/<br />
mysql-connector-java-5.1.18.jar<br />
</pre><br />
</code><br />
<br />
<br />
If you wanted to see exactly what was in blog-database/blog-database.xml you could do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl config-list-cat blog-database -file=./blog-database.xml -version=0.1.0 <br />
<br />
Output:<br />
<resin xmlns="http://caucho.com/ns/resin"<br />
xmlns:resin="urn:java:com.caucho.resin"><br />
<br />
<database jndi-name="jdbc/blogdb"><br />
<driver type="com.mysql.jdbc.Driver"><br />
<url>jdbc:mysql://${blogdb.url}:3306/blogdb</url><br />
<user>${blogdb.user}</user><br />
<password>${blogdb.password}</password><br />
</driver><br />
</database><br />
</resin><br />
<br />
</pre><br />
</code><br />
<br />
<br />
The advantage of using confg-deploy locally is that your dev system is more like your integration, qa and production system.<br />
It is like having a local cloud.</div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-07T01:07:08Z<p>Rickhigh: /* Proposed but not Implemented 4.0.25 Deploy and Rollback */</p>
<hr />
<div># Deploying to a local server<br />
## Deploying to a staging server (locally)<br />
## Deploying to a preview staging server (locally)<br />
# Deploying to a remote server<br />
## Setting up a user and password<br />
## Deploying to a remote server<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
## license-add enabling Resin features<br />
# Deploy to a staging server<br />
## Setting up load balancer to not to deploy to staging server<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
## Installing mysql driver for a web application using config-deploy<br />
## Showing what is in remote config with config-list-ls and config-list-cat<br />
# web-app-deploy settings<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code><br />
<br />
<br />
== Deploying to a local server ==<br />
<br />
Deploy commands available <br />
<br />
<code><br />
<pre><br />
$ resinctl help deploy<br />
<br />
<br />
Output:<br />
usage: bin/resin.sh [-conf <file>] [-server <id>] deploy -user <user> \<br />
-password <password> [options] <war-file><br />
<br />
description:<br />
deploys application specified in a <war-file> to resin server<br />
<br />
options:<br />
-conf <file> : resin configuration file<br />
-server <id> : id of a server<br />
-address <address> : ip or host name of the server<br />
-port <port> : server http port<br />
-user <user> : user name used for authentication to the server<br />
-password <password> : password used for authentication to the server<br />
-host <host> : virtual host to make application available on<br />
-name <name> : name of the context to deploy to, defaults to war-file name<br />
-stage <stage> : stage to deploy application to, defaults to production<br />
-version <version> : version of application formatted as <major.minor.micro.qualifier><br />
-m <message> : commit message<br />
</pre><br />
</code><br />
<br />
Turning on versioning:<br />
<br />
<code><br />
<pre><br />
$ cat /etc/resin/resin.properties | grep deploy<br />
<br />
Output:<br />
deploy_versioning : true<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
<br />
$ sudo grep "web-app-deploy" -A 1 /etc/resin/resin.xml <br />
<br />
Output:<br />
<web-app-deploy path="webapps" versioning="${deploy_versioning}"<br />
expand-preserve-fileset="WEB-INF/work/**"/><br />
<br />
</pre><br />
</code><br />
<br />
"if true, use the web-app's numeric suffix as a version"<br />
<br />
Run deploy command passing location of war file.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.war -name blog <br />
<br />
Output:<br />
Deployed production/webapp/default/blog from \<br />
./target/blog-0.1.0.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
To see the deployed you can use resinctl deploy-list<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
<br />
Now undeploy it:<br />
<br />
<code><br />
<pre><br />
$ resinctl undeploy blog<br />
<br />
Output:<br />
Undeployed blog from hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
At this point there should be nothing<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
</pre><br />
</code><br />
<br />
Now deploy it with versioning:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -version 0.1.0 <br />
<br />
Output:<br />
Deployed production/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
</pre><br />
</code><br />
<br />
Blog application is under the version 0.1.0<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog-0.1.0<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
=== Deploying to a staging server ===<br />
<br />
Deploy to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogz -version 0.1.0 -stage staging<br />
<br />
Output<br />
Deployed staging/webapp/default/blogz-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
The staging name is logical. You can call it anything. The app will not be served unless<br />
the server is started with this staging name.<br />
<br />
Showing items deployed to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
production/webapp/default/blog-0.1.0<br />
staging/webapp/default/blogz-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
The /blog works but /blogz does not work because server is by default setup as production server.<br />
<br />
/blog works because server is setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blog<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
/blogz does not work because server is not setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogz<br />
...<br />
HTTP request sent, awaiting response... 404 Not Found<br />
</pre><br />
</code><br />
<br />
To run the server as a staging server do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ resinctl help start<br />
<br />
Output:<br />
usage: bin/resin.sh [-options] start<br />
<br />
where options include:<br />
-conf <file> : select a configuration file<br />
-data-directory <dir> : select a resin-data directory<br />
-join-cluster <cluster> : join a cluster as a dynamic server<br />
-log-directory <dir> : select a logging directory<br />
-resin-home <dir> : select a resin home directory<br />
-root-directory <dir> : select a root directory<br />
-server <id> : select a <server> to run<br />
-watchdog-port <port> : override the watchdog-port<br />
-verbose : print verbose starting information<br />
-preview : run as a preview server<br />
-debug-port <port> : configure a debug port<br />
-jmx-port <port> : configure an unauthenticated jmx port<br />
-stage <staging-name> : The stage the server is serving (default production)<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ sudo resinctl start -stage staging<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
<br />
$ wget localhost:8080/blogz<br />
...<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
<br />
=== Deploying to a preview staging server ===<br />
<br />
<br />
<code><br />
<pre><br />
<br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogp -version 0.1.0 -stage preview<br />
<br />
Output<br />
Deployed preview/webapp/default/blogp-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
$ resinctl deploy-list<br />
<br />
Output<br />
preview/webapp/default/blogp-0.1.0<br />
production/webapp/default/blog-0.1.0<br />
...<br />
</pre><br />
</code><br />
<br />
<br />
Restart the server in preview stage, since preview staging is a common thing, you can just use the -preview command.<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
$ sudo resinctl start -preview<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<br />
Now the preview blog site is available.<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogp<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
== Deploying to a Remote Server ==<br />
<br />
Setup the remote box (Install Resin)<br />
<br />
You need to create a user name and password.<br />
<br />
<code><br />
<pre><br />
REMOTE SERVER $ resinctl generate-password -user rick -password dogbones<br />
<br />
Output:<br />
admin_user : rick<br />
admin_password : {SSHA}JmojvNUU4OpTOw0/SESRsnpEHejxkhZZ<br />
</pre><br />
</code><br />
<br />
<br />
Modify resin.properties<br />
<br />
<code><br />
<pre><br />
<br />
REMOTE SERVER$ cat /etc/resin/resin.properties<br />
<br />
Output:<br />
admin_user : rick<br />
admin_password : {SSHA}JmojvNUU4OpTOw0/SESRsnpEHejxkhZZ<br />
admin_remote_enable : true<br />
...<br />
</pre><br />
</code><br />
<br />
Now from the local server deploy your app as follows:<br />
<br />
<code><br />
<pre><br />
LOCAL SERVER $ resinctl deploy target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogdb \ <br />
-address 192.168.248.168 -port 8080 -user rick -password dogbones<br />
</pre><br />
</code><br />
<br />
You can verify that the deploy worked as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -address 192.168.248.168 -port 8080 -user rick -password dogbones<br />
<br />
Output:<br />
production/webapp/default/blog<br />
...<br />
</pre><br />
</code><br />
<br />
<br />
<br />
== Working with deploy-copy to release, and rollback ==<br />
<br />
<br />
Deploy version to archive.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -stage archive -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
<br />
List versions deployed.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
archive/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
Copy deployment to production<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-copy -source blog -source-stage archive \<br />
-source-version 0.1.0 -target blog<br />
<br />
Output:<br />
copied archive/webapp/default/blog-0.1.0 to production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
archive/webapp/default/blog-0.1.0<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
<br />
When you deploy this way you must start the app as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-start blog<br />
<br />
Output:<br />
'production/webapp/default/blog' is started<br />
</pre><br />
</code><br />
<br />
Then you would deploy copy a different version to rollback or promote a different version to prod.<br />
<br />
In review of the above, we have decided to make the process a bit easier.<br />
<br />
The following section has not yet been implemented, but is slated for 4.0.25.<br />
<br />
<br />
<br />
<br />
== Proposed but not Implemented 4.0.25 Deploy and Rollback==<br />
<br />
<br />
''The following section has not yet been implemented, but is slated for 4.0.25.''<br />
<br />
<br />
Deploy version to archive.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
into production \<br />
</pre><br />
</code><br />
<br />
<br />
List versions deployed with all option.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -all<br />
<br />
Output:<br />
Tag Ver. DD-MM-YYYY-HH:MM:SS<br />
archive/webapp/default/blog-0.1.0 0.1.0 05-12-2011-13:00:00<br />
production/webapp/default/blog 0.1.0 05-12-2011-13:00:00<br />
</pre><br />
</code><br />
<br />
<br />
<br />
Later you decide to update to a new version likely after weeks or months of hard development.<br />
The line marked with production/webapp/default/blog is the /blog that is deployed in the running server.<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.2.0.BUILD-SNAPSHOT.war -name blog -version 0.2.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.2.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
deployed into production.<br />
</pre><br />
</code><br />
<br />
<br />
At this point the following will be deployed:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -all<br />
<br />
Output:<br />
Tag Ver. DD-MM-YYYY-HH:MM:SS<br />
archive/webapp/default/blog-0.1.0 0.1.0 05-12-2011-13:00:00<br />
archive/webapp/default/blog-0.2.0 0.2.0 05-01-2012-11:00:00<br />
production/webapp/default/blog 0.2.0 05-01-2012-11:00:00<br />
</pre><br />
</code><br />
<br />
<br />
Even after rigorous load testing and QA testing, a critical bug was found in 0.2.0 blog and now you need to quickly rollback to a previous version.<br />
<br />
<br />
To rollback to a previous version use the '''deploy-rollback''' as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-rollback blog -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 to hmux://127.0.0.1:6800 \<br />
into production <br />
<br />
</pre><br />
</code><br />
<br />
<br />
Alternatively you can use deploy-promote to accomplish the same thing.<br />
<br />
To rollback to a previous version use the '''deploy-promote''' as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-promote blog -stage archive -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 to hmux://127.0.0.1:6800 \<br />
into production <br />
<br />
</pre><br />
</code><br />
<br />
We specify the stage as archive (-stage archive) because deploy-promote defaults to working with the preview stage (more on this in the next section).<br />
<br />
Now after the rollback the deployed servers should look like this.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -all<br />
<br />
Output:<br />
Tag Ver. DD-MM-YYYY-HH:MM:SS<br />
archive/webapp/default/blog-0.1.0 0.1.0 05-12-2011-13:00:00<br />
archive/webapp/default/blog-0.2.0 0.2.0 05-01-2012-11:00:00<br />
production/webapp/default/blog 0.1.0 05-12-2011-13:00:00<br />
</pre><br />
</code><br />
<br />
<br />
Notice that 0.1.0 is now in production and 0.2.0 is not.<br />
<br />
==Promoting an app from preview mode to production==<br />
<br />
Options<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-promote blog <br />
<br />
Output:<br />
Deployed preview/webapp/default/blog to hmux://127.0.0.1:6800 \<br />
into production <br />
<br />
</pre><br />
</code><br />
<br />
Promotes blog that is currently in preview mode into production.<br />
<br />
<br />
== Cluster deployment NOT IMPLEMENTED UNTIL Resin 4.0.25 (coming soon) ==<br />
<br />
This section is slated for Resin 4.0.25 but not released yet and may change.<br />
<br />
Resin 4.0.25 adds the following config command line options to support remote configuration and cloud configuration of Resin servers.<br />
<br />
<code><br />
<pre><br />
resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-tree - list contents of directories recursively <br />
config-list-cat - list contents of config file (must be text)<br />
config-undeploy - undeploys a config<br />
config-rollback - rollback to a different config<br />
config-promote - promotes a staged config to production<br />
</pre><br />
</code><br />
<br />
<br />
===Background on need===<br />
At times you need to include things like jar files that are available to more than one application.<br />
Resin allows you to deploy these to remote servers (which can be 1 to hundreds of servers) with one simple command.<br />
<br />
Let's say your /blog application that relies on MySQL.<br />
<br />
<br />
By default resin uses the /etc/resin/resin.properties file. You could add these properties to /etc/resin/resin.properties.<br />
<br />
'''/etc/resin/resin.properties on resin server'''<br />
<code><br />
<pre><br />
<br />
blogdb.url : blogdb.cvolnlau763z.us-east-1.rds.amazonaws.com<br />
blogdb.user : bloguser<br />
blogdb.password : roofoo<br />
<br />
</pre><br />
</code><br />
<br />
These properties will vary for dev, production, qa, etc. And once they are set, they will not change often.<br />
<br />
You could test locally by copying this file (blog-database.xml) to /etc/resin/resin.d/.<br />
<br />
<br />
'''/etc/resin/resin.d/database.xml''' blog-database.properties under /etc/resin/resin.d.<br />
<code><br />
<pre><br />
<resin xmlns="http://caucho.com/ns/resin"<br />
xmlns:resin="urn:java:com.caucho.resin"><br />
<br />
<database jndi-name="jdbc/blogdb"><br />
<driver type="com.mysql.jdbc.Driver"><br />
<url>jdbc:mysql://${blogdb.url}:3306/blogdb</url><br />
<user>${blogdb.user}</user><br />
<password>${blogdb.password}</password><br />
</driver><br />
</database><br />
</resin><br />
</pre><br />
</code><br />
<br />
<br />
The problem now is that you don't have a mysql.jar file and you will get a class not found exception when the apps starts up.<br />
<br />
<br />
<br />
If you are using maven locally you can copy mysql from the maven local repo as follows:<br />
<br />
Find and copy the mysql jar file from the maven local repo to Resin as follows:<br />
<br />
Find it:<br />
<br />
<code><br />
<pre><br />
$ find ~/.m2/repository/ -name "*mysql*.jar"<br />
/home/rick/.m2/repository/mysql/mysql-connector-java/5.1.18/mysql-connector-java-5.1.18.jar<br />
</pre><br />
</code><br />
<br />
<br />
Now deploy it<br />
<br />
<code><br />
<pre><br />
$ sudo cp ~/.m2/repository/mysql/mysql-connector-java/5.1.18/mysql-connector-java-5.1.18.jar \ <br />
/usr/local/share/resin/lib/<br />
<br />
</pre><br />
</code><br />
<br />
Or you can use yum to get the mysql driver as follows:<br />
<br />
Next install the mysql driver.<br />
$ sudo yum install mysql-connector-java<br />
$ sudo cp /usr/share/java/mysql-connector-java.jar /usr/local/share/resin/lib/<br />
<br />
<br />
The problem with this approach is that things work for you locally for /blog application if it relies on mysql being managed under jndi:jdbc/blogdb, but all of your remote deployments will fail unless you manually add the mysql jar to each server, manually add the blog-database.xml file to each server, and manually update each resin.properties file.<br />
<br />
=== Remote config deployment ===<br />
Resin 4.0.25 allows you to deploy configuration files not just applications. This allows you to change what jar files get loaded into the Resin classpath, config files and properties. If you are doing deployment to 1 remote server or to a triad for cloud deployment with 100's of servers, deploying mysql to them can be as easy as what we are going to describe.<br />
<br />
Ok assuming you have developed and tested the /blog app locally and now you want to push a blog to a remote server or set of servers, you can do the following:<br />
<br />
<br />
# Create a directory blog-database<br />
# Create a directory called blog-database/lib<br />
# Copy blog-database.xml into blog-database directory<br />
# Copy mysql.jar into blog-database/lib<br />
# Create a file called blog-database/resin.properties<br />
# Use resinctl config-deploy to deploy the configuration<br />
<br />
<br />
First create the dirs and copy the jar.<br />
<br />
<code><br />
<pre><br />
$ mkdir blog-database<br />
$ mkdir blog-database/lib<br />
$ cp /etc/resin/resin.d/blog-database.xml blog-database/<br />
$ cp /usr/local/share/resin/lib/mysql-connector*.jar blog-database/lib/<br />
</pre><br />
</code><br />
<br />
Instead of modifying every servers /etc/resin/resin.properties, you can add a resin.properties to blog-database dir that gets deployed with the config bundle as follows:<br />
<br />
'''./blog-database/resin.properties'''<br />
<code><br />
<pre><br />
blogdb.url : blogdb.cvolnlau763z.us-east-1.rds.amazonaws.com<br />
blogdb.user : bloguser<br />
blogdb.password : roofoo<br />
</pre><br />
</code><br />
<br />
It might make sense to deploy the database properties in a separate config deployment, but for simplicity we bundle together in one.<br />
<br />
'''NOTE: This works for dir/lib . We should allow dir/webapp-jars and it should work the same. <br />
The jars get loaded per webapp for dir/webapp-jars. END NOTE'''<br />
<br />
Next deploy to the remote server as follows:<br />
<code><br />
<pre><br />
$ resinctl config-deploy blog-database -version=0.1.0 -address=199.99.99.01 -port=8080<br />
</pre><br />
</code><br />
<br />
To see what is deployed you can do the following:<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl config-list -all -address=199.99.99.01 -port=8080<br />
<br />
Output:<br />
archive/config/default/blog-database-0.1.0 0.1.0 05-12-2011-13:00:00<br />
production/config/default/blog-database 0.1.0 05-12-2011-13:00:00<br />
</pre><br />
</code><br />
<br />
<br />
If you wanted to see exactly what was in blog-database/lib you could do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl config-list-ls blog-database -dir=lib -version=0.1.0 -address=199.99.99.01 -port=8080<br />
<br />
Output:<br />
mysql-connector-java-5.1.18.jar<br />
</pre><br />
</code><br />
<br />
Or to see everything in the deployment use tree<br />
<code><br />
<pre><br />
$ resinctl config-list-tree blog-database -version=0.1.0 -address=199.99.99.01 -port=8080<br />
<br />
Output:<br />
blog-database.xml<br />
resin.properties<br />
lib/<br />
mysql-connector-java-5.1.18.jar<br />
</pre><br />
</code><br />
<br />
<br />
If you wanted to see exactly what was in blog-database/blog-database.xml you could do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl config-list-cat blog-database -file=./blog-database.xml -version=0.1.0 -address=199.99.99.01 -port=8080<br />
<br />
Output:<br />
<resin xmlns="http://caucho.com/ns/resin"<br />
xmlns:resin="urn:java:com.caucho.resin"><br />
<br />
<database jndi-name="jdbc/blogdb"><br />
<driver type="com.mysql.jdbc.Driver"><br />
<url>jdbc:mysql://${blogdb.url}:3306/blogdb</url><br />
<user>${blogdb.user}</user><br />
<password>${blogdb.password}</password><br />
</driver><br />
</database><br />
</resin><br />
<br />
</pre><br />
</code><br />
<br />
The following commands work like deploy-undeploy, deploy-rollback and deploy-promote, but for configuration.<br />
<br />
# config-undeploy - undeploys a config<br />
# config-rollback - rollback to a different config<br />
# config-promote - promotes a staged config to production<br />
<br />
<br />
=== Using config-deploy for a local server ===<br />
Note you also do these same steps for a local development server instead of copying jar files and config files as follows:<br />
<br />
Next deploy to the remote server as follows:<br />
<code><br />
<pre><br />
$ resinctl config-deploy blog-database -version=0.1.0 <br />
</pre><br />
</code><br />
<br />
(Just leave off the address and port.)<br />
<br />
To see what is deployed you can do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl config-list -all -address=199.99.99.01 -port=8080<br />
<br />
Output:<br />
archive/config/default/blog-database-0.1.0 0.1.0 05-12-2011-13:00:00<br />
production/config/default/blog-database 0.1.0 05-12-2011-13:00:00<br />
</pre><br />
</code><br />
<br />
<br />
If you wanted to see exactly what was in blog-database/lib you could do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl config-list-ls blog-database -dir=lib -version=0.1.0 <br />
<br />
Output:<br />
mysql-connector-java-5.1.18.jar<br />
</pre><br />
</code><br />
<br />
Or to see everything in the deployment use tree<br />
<code><br />
<pre><br />
$ resinctl config-list-tree blog-database -version=0.1.0 <br />
<br />
Output:<br />
blog-database.xml<br />
resin.properties<br />
lib/<br />
mysql-connector-java-5.1.18.jar<br />
</pre><br />
</code><br />
<br />
<br />
If you wanted to see exactly what was in blog-database/blog-database.xml you could do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl config-list-cat blog-database -file=./blog-database.xml -version=0.1.0 <br />
<br />
Output:<br />
<resin xmlns="http://caucho.com/ns/resin"<br />
xmlns:resin="urn:java:com.caucho.resin"><br />
<br />
<database jndi-name="jdbc/blogdb"><br />
<driver type="com.mysql.jdbc.Driver"><br />
<url>jdbc:mysql://${blogdb.url}:3306/blogdb</url><br />
<user>${blogdb.user}</user><br />
<password>${blogdb.password}</password><br />
</driver><br />
</database><br />
</resin><br />
<br />
</pre><br />
</code><br />
<br />
<br />
The advantage of using confg-deploy locally is that your dev system is more like your integration, qa and production system.<br />
It is like having a local cloud.</div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-07T00:54:46Z<p>Rickhigh: /* Cluster deployment NOT IMPLEMENTED UNTIL Resin 4.0.25 (coming soon) */</p>
<hr />
<div># Deploying to a local server<br />
## Deploying to a staging server (locally)<br />
## Deploying to a preview staging server (locally)<br />
# Deploying to a remote server<br />
## Setting up a user and password<br />
## Deploying to a remote server<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
## license-add enabling Resin features<br />
# Deploy to a staging server<br />
## Setting up load balancer to not to deploy to staging server<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
## Installing mysql driver for a web application using config-deploy<br />
## Showing what is in remote config with config-list-ls and config-list-cat<br />
# web-app-deploy settings<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code><br />
<br />
<br />
== Deploying to a local server ==<br />
<br />
Deploy commands available <br />
<br />
<code><br />
<pre><br />
$ resinctl help deploy<br />
<br />
<br />
Output:<br />
usage: bin/resin.sh [-conf <file>] [-server <id>] deploy -user <user> \<br />
-password <password> [options] <war-file><br />
<br />
description:<br />
deploys application specified in a <war-file> to resin server<br />
<br />
options:<br />
-conf <file> : resin configuration file<br />
-server <id> : id of a server<br />
-address <address> : ip or host name of the server<br />
-port <port> : server http port<br />
-user <user> : user name used for authentication to the server<br />
-password <password> : password used for authentication to the server<br />
-host <host> : virtual host to make application available on<br />
-name <name> : name of the context to deploy to, defaults to war-file name<br />
-stage <stage> : stage to deploy application to, defaults to production<br />
-version <version> : version of application formatted as <major.minor.micro.qualifier><br />
-m <message> : commit message<br />
</pre><br />
</code><br />
<br />
Turning on versioning:<br />
<br />
<code><br />
<pre><br />
$ cat /etc/resin/resin.properties | grep deploy<br />
<br />
Output:<br />
deploy_versioning : true<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
<br />
$ sudo grep "web-app-deploy" -A 1 /etc/resin/resin.xml <br />
<br />
Output:<br />
<web-app-deploy path="webapps" versioning="${deploy_versioning}"<br />
expand-preserve-fileset="WEB-INF/work/**"/><br />
<br />
</pre><br />
</code><br />
<br />
"if true, use the web-app's numeric suffix as a version"<br />
<br />
Run deploy command passing location of war file.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.war -name blog <br />
<br />
Output:<br />
Deployed production/webapp/default/blog from \<br />
./target/blog-0.1.0.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
To see the deployed you can use resinctl deploy-list<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
<br />
Now undeploy it:<br />
<br />
<code><br />
<pre><br />
$ resinctl undeploy blog<br />
<br />
Output:<br />
Undeployed blog from hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
At this point there should be nothing<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
</pre><br />
</code><br />
<br />
Now deploy it with versioning:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -version 0.1.0 <br />
<br />
Output:<br />
Deployed production/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
</pre><br />
</code><br />
<br />
Blog application is under the version 0.1.0<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog-0.1.0<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
=== Deploying to a staging server ===<br />
<br />
Deploy to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogz -version 0.1.0 -stage staging<br />
<br />
Output<br />
Deployed staging/webapp/default/blogz-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
The staging name is logical. You can call it anything. The app will not be served unless<br />
the server is started with this staging name.<br />
<br />
Showing items deployed to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
production/webapp/default/blog-0.1.0<br />
staging/webapp/default/blogz-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
The /blog works but /blogz does not work because server is by default setup as production server.<br />
<br />
/blog works because server is setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blog<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
/blogz does not work because server is not setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogz<br />
...<br />
HTTP request sent, awaiting response... 404 Not Found<br />
</pre><br />
</code><br />
<br />
To run the server as a staging server do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ resinctl help start<br />
<br />
Output:<br />
usage: bin/resin.sh [-options] start<br />
<br />
where options include:<br />
-conf <file> : select a configuration file<br />
-data-directory <dir> : select a resin-data directory<br />
-join-cluster <cluster> : join a cluster as a dynamic server<br />
-log-directory <dir> : select a logging directory<br />
-resin-home <dir> : select a resin home directory<br />
-root-directory <dir> : select a root directory<br />
-server <id> : select a <server> to run<br />
-watchdog-port <port> : override the watchdog-port<br />
-verbose : print verbose starting information<br />
-preview : run as a preview server<br />
-debug-port <port> : configure a debug port<br />
-jmx-port <port> : configure an unauthenticated jmx port<br />
-stage <staging-name> : The stage the server is serving (default production)<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ sudo resinctl start -stage staging<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
<br />
$ wget localhost:8080/blogz<br />
...<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
<br />
=== Deploying to a preview staging server ===<br />
<br />
<br />
<code><br />
<pre><br />
<br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogp -version 0.1.0 -stage preview<br />
<br />
Output<br />
Deployed preview/webapp/default/blogp-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
$ resinctl deploy-list<br />
<br />
Output<br />
preview/webapp/default/blogp-0.1.0<br />
production/webapp/default/blog-0.1.0<br />
...<br />
</pre><br />
</code><br />
<br />
<br />
Restart the server in preview stage, since preview staging is a common thing, you can just use the -preview command.<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
$ sudo resinctl start -preview<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<br />
Now the preview blog site is available.<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogp<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
== Deploying to a Remote Server ==<br />
<br />
Setup the remote box (Install Resin)<br />
<br />
You need to create a user name and password.<br />
<br />
<code><br />
<pre><br />
REMOTE SERVER $ resinctl generate-password -user rick -password dogbones<br />
<br />
Output:<br />
admin_user : rick<br />
admin_password : {SSHA}JmojvNUU4OpTOw0/SESRsnpEHejxkhZZ<br />
</pre><br />
</code><br />
<br />
<br />
Modify resin.properties<br />
<br />
<code><br />
<pre><br />
<br />
REMOTE SERVER$ cat /etc/resin/resin.properties<br />
<br />
Output:<br />
admin_user : rick<br />
admin_password : {SSHA}JmojvNUU4OpTOw0/SESRsnpEHejxkhZZ<br />
admin_remote_enable : true<br />
...<br />
</pre><br />
</code><br />
<br />
Now from the local server deploy your app as follows:<br />
<br />
<code><br />
<pre><br />
LOCAL SERVER $ resinctl deploy target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogdb \ <br />
-address 192.168.248.168 -port 8080 -user rick -password dogbones<br />
</pre><br />
</code><br />
<br />
You can verify that the deploy worked as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -address 192.168.248.168 -port 8080 -user rick -password dogbones<br />
<br />
Output:<br />
production/webapp/default/blog<br />
...<br />
</pre><br />
</code><br />
<br />
<br />
<br />
== Working with deploy-copy to release, and rollback ==<br />
<br />
<br />
Deploy version to archive.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -stage archive -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
<br />
List versions deployed.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
archive/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
Copy deployment to production<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-copy -source blog -source-stage archive \<br />
-source-version 0.1.0 -target blog<br />
<br />
Output:<br />
copied archive/webapp/default/blog-0.1.0 to production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
archive/webapp/default/blog-0.1.0<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
<br />
When you deploy this way you must start the app as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-start blog<br />
<br />
Output:<br />
'production/webapp/default/blog' is started<br />
</pre><br />
</code><br />
<br />
Then you would deploy copy a different version to rollback or promote a different version to prod.<br />
<br />
In review of the above, we have decided to make the process a bit easier.<br />
<br />
The following section has not yet been implemented, but is slated for 4.0.25.<br />
<br />
<br />
<br />
<br />
== Proposed but not Implemented 4.0.25 Deploy and Rollback==<br />
<br />
<br />
''The following section has not yet been implemented, but is slated for 4.0.25.''<br />
<br />
<br />
Deploy version to archive.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -archive-version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
into production \<br />
</pre><br />
</code><br />
<br />
<br />
List versions deployed with all option.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -all<br />
<br />
Output:<br />
Tag Ver. DD-MM-YYYY-HH:MM:SS<br />
archive/webapp/default/blog-0.1.0 0.1.0 05-12-2011-13:00:00<br />
production/webapp/default/blog 0.1.0 05-12-2011-13:00:00<br />
</pre><br />
</code><br />
<br />
<br />
<br />
Later you decide to update to a new version likely after weeks or months of hard development.<br />
The line marked with production/webapp/default/blog is the /blog that is deployed in the running server.<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.2.0.BUILD-SNAPSHOT.war -name blog -archive_version 0.2.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.2.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
deployed into production.<br />
</pre><br />
</code><br />
<br />
<br />
At this point the following will be deployed:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -all<br />
<br />
Output:<br />
Tag Ver. DD-MM-YYYY-HH:MM:SS<br />
archive/webapp/default/blog-0.1.0 0.1.0 05-12-2011-13:00:00<br />
archive/webapp/default/blog-0.2.0 0.2.0 05-01-2012-11:00:00<br />
production/webapp/default/blog 0.2.0 05-01-2012-11:00:00<br />
</pre><br />
</code><br />
<br />
<br />
Even after rigorous load testing and QA testing, a critical bug was found in 0.2.0 blog and now you need to quickly rollback to a previous version.<br />
<br />
To rollback to a previous version use the '''deploy-archive''' as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-archive blog -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 to hmux://127.0.0.1:6800 \<br />
into production <br />
<br />
</pre><br />
</code><br />
<br />
<br />
<br />
Even after rigorous load testing and QA testing, a critical bug was found in 0.2.0 blog and now you need to quickly rollback to a previous version.<br />
<br />
To rollback to a previous version use the '''deploy-rollback''' as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-rollback blog -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 to hmux://127.0.0.1:6800 \<br />
into production <br />
<br />
</pre><br />
</code><br />
<br />
<br />
<br />
<br />
Even after rigorous load testing and QA testing, a critical bug was found in 0.2.0 blog and now you need to quickly rollback to a previous version.<br />
<br />
To rollback to a previous version use the '''rollback''' as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl rollback blog -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 to hmux://127.0.0.1:6800 \<br />
into production <br />
<br />
</pre><br />
</code><br />
<br />
<br />
<br />
Even after rigorous load testing and QA testing, a critical bug was found in 0.2.0 blog and now you need to quickly rollback to a previous version.<br />
<br />
To rollback to a previous version use the '''deploy-stage''' as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-stage blog -stage archive -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 to hmux://127.0.0.1:6800 \<br />
into production <br />
<br />
</pre><br />
</code><br />
<br />
'''We will need a deploy-stage no matter what for managing preview servers.'''<br />
<br />
NOTE:<br />
I think we go with deploy-rollback and deploy-stage. They do almost the same thing.<br />
Rollback is a bit more self documenting. You use deploy-rollback for rollbacks and you use deploy-stage <br />
for promoting an app to production.<br />
END NOTE:<br />
<br />
<br />
Now after the rollback the deployed servers should look like this.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -all<br />
<br />
Output:<br />
Tag Ver. DD-MM-YYYY-HH:MM:SS<br />
archive/webapp/default/blog-0.1.0 0.1.0 05-12-2011-13:00:00<br />
archive/webapp/default/blog-0.2.0 0.2.0 05-01-2012-11:00:00<br />
production/webapp/default/blog 0.1.0 05-12-2011-13:00:00<br />
</pre><br />
</code><br />
<br />
<br />
Notice that 0.1.0 is now in production.<br />
<br />
<br />
==Promoting an app from preview mode to production==<br />
<br />
Options<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-promote blog <br />
<br />
Output:<br />
Deployed preview/webapp/default/blog to hmux://127.0.0.1:6800 \<br />
into production <br />
<br />
</pre><br />
</code><br />
<br />
Promotes blog that is currently in preview mode into production.<br />
<br />
<br />
== Cluster deployment NOT IMPLEMENTED UNTIL Resin 4.0.25 (coming soon) ==<br />
<br />
This section is slated for Resin 4.0.25 but not released yet and may change.<br />
<br />
Resin 4.0.25 adds the following config command line options to support remote configuration and cloud configuration of Resin servers.<br />
<br />
<code><br />
<pre><br />
resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-tree - list contents of directories recursively <br />
config-list-cat - list contents of config file (must be text)<br />
config-undeploy - undeploys a config<br />
config-rollback - rollback to a different config<br />
config-promote - promotes a staged config to production<br />
</pre><br />
</code><br />
<br />
<br />
===Background on need===<br />
At times you need to include things like jar files that are available to more than one application.<br />
Resin allows you to deploy these to remote servers (which can be 1 to hundreds of servers) with one simple command.<br />
<br />
Let's say your /blog application that relies on MySQL.<br />
<br />
<br />
By default resin uses the /etc/resin/resin.properties file. You could add these properties to /etc/resin/resin.properties.<br />
<br />
'''/etc/resin/resin.properties on resin server'''<br />
<code><br />
<pre><br />
<br />
blogdb.url : blogdb.cvolnlau763z.us-east-1.rds.amazonaws.com<br />
blogdb.user : bloguser<br />
blogdb.password : roofoo<br />
<br />
</pre><br />
</code><br />
<br />
These properties will vary for dev, production, qa, etc. And once they are set, they will not change often.<br />
<br />
You could test locally by copying this file (blog-database.xml) to /etc/resin/resin.d/.<br />
<br />
<br />
'''/etc/resin/resin.d/database.xml''' blog-database.properties under /etc/resin/resin.d.<br />
<code><br />
<pre><br />
<resin xmlns="http://caucho.com/ns/resin"<br />
xmlns:resin="urn:java:com.caucho.resin"><br />
<br />
<database jndi-name="jdbc/blogdb"><br />
<driver type="com.mysql.jdbc.Driver"><br />
<url>jdbc:mysql://${blogdb.url}:3306/blogdb</url><br />
<user>${blogdb.user}</user><br />
<password>${blogdb.password}</password><br />
</driver><br />
</database><br />
</resin><br />
</pre><br />
</code><br />
<br />
<br />
The problem now is that you don't have a mysql.jar file and you will get a class not found exception when the apps starts up.<br />
<br />
<br />
<br />
If you are using maven locally you can copy mysql from the maven local repo as follows:<br />
<br />
Find and copy the mysql jar file from the maven local repo to Resin as follows:<br />
<br />
Find it:<br />
<br />
<code><br />
<pre><br />
$ find ~/.m2/repository/ -name "*mysql*.jar"<br />
/home/rick/.m2/repository/mysql/mysql-connector-java/5.1.18/mysql-connector-java-5.1.18.jar<br />
</pre><br />
</code><br />
<br />
<br />
Now deploy it<br />
<br />
<code><br />
<pre><br />
$ sudo cp ~/.m2/repository/mysql/mysql-connector-java/5.1.18/mysql-connector-java-5.1.18.jar \ <br />
/usr/local/share/resin/lib/<br />
<br />
</pre><br />
</code><br />
<br />
Or you can use yum to get the mysql driver as follows:<br />
<br />
Next install the mysql driver.<br />
$ sudo yum install mysql-connector-java<br />
$ sudo cp /usr/share/java/mysql-connector-java.jar /usr/local/share/resin/lib/<br />
<br />
<br />
The problem with this approach is that things work for you locally for /blog application if it relies on mysql being managed under jndi:jdbc/blogdb, but all of your remote deployments will fail unless you manually add the mysql jar to each server, manually add the blog-database.xml file to each server, and manually update each resin.properties file.<br />
<br />
=== Remote config deployment ===<br />
Resin 4.0.25 allows you to deploy configuration files not just applications. This allows you to change what jar files get loaded into the Resin classpath, config files and properties. If you are doing deployment to 1 remote server or to a triad for cloud deployment with 100's of servers, deploying mysql to them can be as easy as what we are going to describe.<br />
<br />
Ok assuming you have developed and tested the /blog app locally and now you want to push a blog to a remote server or set of servers, you can do the following:<br />
<br />
<br />
# Create a directory blog-database<br />
# Create a directory called blog-database/lib<br />
# Copy blog-database.xml into blog-database directory<br />
# Copy mysql.jar into blog-database/lib<br />
# Create a file called blog-database/resin.properties<br />
# Use resinctl config-deploy to deploy the configuration<br />
<br />
<br />
First create the dirs and copy the jar.<br />
<br />
<code><br />
<pre><br />
$ mkdir blog-database<br />
$ mkdir blog-database/lib<br />
$ cp /etc/resin/resin.d/blog-database.xml blog-database/<br />
$ cp /usr/local/share/resin/lib/mysql-connector*.jar blog-database/lib/<br />
</pre><br />
</code><br />
<br />
Instead of modifying every servers /etc/resin/resin.properties, you can add a resin.properties to blog-database dir that gets deployed with the config bundle as follows:<br />
<br />
'''./blog-database/resin.properties'''<br />
<code><br />
<pre><br />
blogdb.url : blogdb.cvolnlau763z.us-east-1.rds.amazonaws.com<br />
blogdb.user : bloguser<br />
blogdb.password : roofoo<br />
</pre><br />
</code><br />
<br />
It might make sense to deploy the database properties in a separate config deployment, but for simplicity we bundle together in one.<br />
<br />
'''NOTE: This works for dir/lib . We should allow dir/webapp-jars and it should work the same. <br />
The jars get loaded per webapp for dir/webapp-jars. END NOTE'''<br />
<br />
Next deploy to the remote server as follows:<br />
<code><br />
<pre><br />
$ resinctl config-deploy blog-database -version=0.1.0 -address=199.99.99.01 -port=8080<br />
</pre><br />
</code><br />
<br />
To see what is deployed you can do the following:<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl config-list -all -address=199.99.99.01 -port=8080<br />
<br />
Output:<br />
archive/config/default/blog-database-0.1.0 0.1.0 05-12-2011-13:00:00<br />
production/config/default/blog-database 0.1.0 05-12-2011-13:00:00<br />
</pre><br />
</code><br />
<br />
<br />
If you wanted to see exactly what was in blog-database/lib you could do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl config-list-ls blog-database -dir=lib -version=0.1.0 -address=199.99.99.01 -port=8080<br />
<br />
Output:<br />
mysql-connector-java-5.1.18.jar<br />
</pre><br />
</code><br />
<br />
Or to see everything in the deployment use tree<br />
<code><br />
<pre><br />
$ resinctl config-list-tree blog-database -version=0.1.0 -address=199.99.99.01 -port=8080<br />
<br />
Output:<br />
blog-database.xml<br />
resin.properties<br />
lib/<br />
mysql-connector-java-5.1.18.jar<br />
</pre><br />
</code><br />
<br />
<br />
If you wanted to see exactly what was in blog-database/blog-database.xml you could do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl config-list-cat blog-database -file=./blog-database.xml -version=0.1.0 -address=199.99.99.01 -port=8080<br />
<br />
Output:<br />
<resin xmlns="http://caucho.com/ns/resin"<br />
xmlns:resin="urn:java:com.caucho.resin"><br />
<br />
<database jndi-name="jdbc/blogdb"><br />
<driver type="com.mysql.jdbc.Driver"><br />
<url>jdbc:mysql://${blogdb.url}:3306/blogdb</url><br />
<user>${blogdb.user}</user><br />
<password>${blogdb.password}</password><br />
</driver><br />
</database><br />
</resin><br />
<br />
</pre><br />
</code><br />
<br />
The following commands work like deploy-undeploy, deploy-rollback and deploy-promote, but for configuration.<br />
<br />
# config-undeploy - undeploys a config<br />
# config-rollback - rollback to a different config<br />
# config-promote - promotes a staged config to production<br />
<br />
<br />
=== Using config-deploy for a local server ===<br />
Note you also do these same steps for a local development server instead of copying jar files and config files as follows:<br />
<br />
Next deploy to the remote server as follows:<br />
<code><br />
<pre><br />
$ resinctl config-deploy blog-database -version=0.1.0 <br />
</pre><br />
</code><br />
<br />
(Just leave off the address and port.)<br />
<br />
To see what is deployed you can do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl config-list -all -address=199.99.99.01 -port=8080<br />
<br />
Output:<br />
archive/config/default/blog-database-0.1.0 0.1.0 05-12-2011-13:00:00<br />
production/config/default/blog-database 0.1.0 05-12-2011-13:00:00<br />
</pre><br />
</code><br />
<br />
<br />
If you wanted to see exactly what was in blog-database/lib you could do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl config-list-ls blog-database -dir=lib -version=0.1.0 <br />
<br />
Output:<br />
mysql-connector-java-5.1.18.jar<br />
</pre><br />
</code><br />
<br />
Or to see everything in the deployment use tree<br />
<code><br />
<pre><br />
$ resinctl config-list-tree blog-database -version=0.1.0 <br />
<br />
Output:<br />
blog-database.xml<br />
resin.properties<br />
lib/<br />
mysql-connector-java-5.1.18.jar<br />
</pre><br />
</code><br />
<br />
<br />
If you wanted to see exactly what was in blog-database/blog-database.xml you could do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl config-list-cat blog-database -file=./blog-database.xml -version=0.1.0 <br />
<br />
Output:<br />
<resin xmlns="http://caucho.com/ns/resin"<br />
xmlns:resin="urn:java:com.caucho.resin"><br />
<br />
<database jndi-name="jdbc/blogdb"><br />
<driver type="com.mysql.jdbc.Driver"><br />
<url>jdbc:mysql://${blogdb.url}:3306/blogdb</url><br />
<user>${blogdb.user}</user><br />
<password>${blogdb.password}</password><br />
</driver><br />
</database><br />
</resin><br />
<br />
</pre><br />
</code><br />
<br />
<br />
The advantage of using confg-deploy locally is that your dev system is more like your integration, qa and production system.<br />
It is like having a local cloud.</div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-07T00:44:02Z<p>Rickhigh: /* Cluster deployment NOT IMPLEMENTED UNTIL Resin 4.0.25 (coming soon) */</p>
<hr />
<div># Deploying to a local server<br />
## Deploying to a staging server (locally)<br />
## Deploying to a preview staging server (locally)<br />
# Deploying to a remote server<br />
## Setting up a user and password<br />
## Deploying to a remote server<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
## license-add enabling Resin features<br />
# Deploy to a staging server<br />
## Setting up load balancer to not to deploy to staging server<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
## Installing mysql driver for a web application using config-deploy<br />
## Showing what is in remote config with config-list-ls and config-list-cat<br />
# web-app-deploy settings<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code><br />
<br />
<br />
== Deploying to a local server ==<br />
<br />
Deploy commands available <br />
<br />
<code><br />
<pre><br />
$ resinctl help deploy<br />
<br />
<br />
Output:<br />
usage: bin/resin.sh [-conf <file>] [-server <id>] deploy -user <user> \<br />
-password <password> [options] <war-file><br />
<br />
description:<br />
deploys application specified in a <war-file> to resin server<br />
<br />
options:<br />
-conf <file> : resin configuration file<br />
-server <id> : id of a server<br />
-address <address> : ip or host name of the server<br />
-port <port> : server http port<br />
-user <user> : user name used for authentication to the server<br />
-password <password> : password used for authentication to the server<br />
-host <host> : virtual host to make application available on<br />
-name <name> : name of the context to deploy to, defaults to war-file name<br />
-stage <stage> : stage to deploy application to, defaults to production<br />
-version <version> : version of application formatted as <major.minor.micro.qualifier><br />
-m <message> : commit message<br />
</pre><br />
</code><br />
<br />
Turning on versioning:<br />
<br />
<code><br />
<pre><br />
$ cat /etc/resin/resin.properties | grep deploy<br />
<br />
Output:<br />
deploy_versioning : true<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
<br />
$ sudo grep "web-app-deploy" -A 1 /etc/resin/resin.xml <br />
<br />
Output:<br />
<web-app-deploy path="webapps" versioning="${deploy_versioning}"<br />
expand-preserve-fileset="WEB-INF/work/**"/><br />
<br />
</pre><br />
</code><br />
<br />
"if true, use the web-app's numeric suffix as a version"<br />
<br />
Run deploy command passing location of war file.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.war -name blog <br />
<br />
Output:<br />
Deployed production/webapp/default/blog from \<br />
./target/blog-0.1.0.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
To see the deployed you can use resinctl deploy-list<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
<br />
Now undeploy it:<br />
<br />
<code><br />
<pre><br />
$ resinctl undeploy blog<br />
<br />
Output:<br />
Undeployed blog from hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
At this point there should be nothing<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
</pre><br />
</code><br />
<br />
Now deploy it with versioning:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -version 0.1.0 <br />
<br />
Output:<br />
Deployed production/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
</pre><br />
</code><br />
<br />
Blog application is under the version 0.1.0<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog-0.1.0<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
=== Deploying to a staging server ===<br />
<br />
Deploy to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogz -version 0.1.0 -stage staging<br />
<br />
Output<br />
Deployed staging/webapp/default/blogz-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
The staging name is logical. You can call it anything. The app will not be served unless<br />
the server is started with this staging name.<br />
<br />
Showing items deployed to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
production/webapp/default/blog-0.1.0<br />
staging/webapp/default/blogz-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
The /blog works but /blogz does not work because server is by default setup as production server.<br />
<br />
/blog works because server is setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blog<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
/blogz does not work because server is not setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogz<br />
...<br />
HTTP request sent, awaiting response... 404 Not Found<br />
</pre><br />
</code><br />
<br />
To run the server as a staging server do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ resinctl help start<br />
<br />
Output:<br />
usage: bin/resin.sh [-options] start<br />
<br />
where options include:<br />
-conf <file> : select a configuration file<br />
-data-directory <dir> : select a resin-data directory<br />
-join-cluster <cluster> : join a cluster as a dynamic server<br />
-log-directory <dir> : select a logging directory<br />
-resin-home <dir> : select a resin home directory<br />
-root-directory <dir> : select a root directory<br />
-server <id> : select a <server> to run<br />
-watchdog-port <port> : override the watchdog-port<br />
-verbose : print verbose starting information<br />
-preview : run as a preview server<br />
-debug-port <port> : configure a debug port<br />
-jmx-port <port> : configure an unauthenticated jmx port<br />
-stage <staging-name> : The stage the server is serving (default production)<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ sudo resinctl start -stage staging<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
<br />
$ wget localhost:8080/blogz<br />
...<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
<br />
=== Deploying to a preview staging server ===<br />
<br />
<br />
<code><br />
<pre><br />
<br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogp -version 0.1.0 -stage preview<br />
<br />
Output<br />
Deployed preview/webapp/default/blogp-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
$ resinctl deploy-list<br />
<br />
Output<br />
preview/webapp/default/blogp-0.1.0<br />
production/webapp/default/blog-0.1.0<br />
...<br />
</pre><br />
</code><br />
<br />
<br />
Restart the server in preview stage, since preview staging is a common thing, you can just use the -preview command.<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
$ sudo resinctl start -preview<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<br />
Now the preview blog site is available.<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogp<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
== Deploying to a Remote Server ==<br />
<br />
Setup the remote box (Install Resin)<br />
<br />
You need to create a user name and password.<br />
<br />
<code><br />
<pre><br />
REMOTE SERVER $ resinctl generate-password -user rick -password dogbones<br />
<br />
Output:<br />
admin_user : rick<br />
admin_password : {SSHA}JmojvNUU4OpTOw0/SESRsnpEHejxkhZZ<br />
</pre><br />
</code><br />
<br />
<br />
Modify resin.properties<br />
<br />
<code><br />
<pre><br />
<br />
REMOTE SERVER$ cat /etc/resin/resin.properties<br />
<br />
Output:<br />
admin_user : rick<br />
admin_password : {SSHA}JmojvNUU4OpTOw0/SESRsnpEHejxkhZZ<br />
admin_remote_enable : true<br />
...<br />
</pre><br />
</code><br />
<br />
Now from the local server deploy your app as follows:<br />
<br />
<code><br />
<pre><br />
LOCAL SERVER $ resinctl deploy target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogdb \ <br />
-address 192.168.248.168 -port 8080 -user rick -password dogbones<br />
</pre><br />
</code><br />
<br />
You can verify that the deploy worked as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -address 192.168.248.168 -port 8080 -user rick -password dogbones<br />
<br />
Output:<br />
production/webapp/default/blog<br />
...<br />
</pre><br />
</code><br />
<br />
<br />
<br />
== Working with deploy-copy to release, and rollback ==<br />
<br />
<br />
Deploy version to archive.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -stage archive -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
<br />
List versions deployed.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
archive/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
Copy deployment to production<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-copy -source blog -source-stage archive \<br />
-source-version 0.1.0 -target blog<br />
<br />
Output:<br />
copied archive/webapp/default/blog-0.1.0 to production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
archive/webapp/default/blog-0.1.0<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
<br />
When you deploy this way you must start the app as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-start blog<br />
<br />
Output:<br />
'production/webapp/default/blog' is started<br />
</pre><br />
</code><br />
<br />
Then you would deploy copy a different version to rollback or promote a different version to prod.<br />
<br />
In review of the above, we have decided to make the process a bit easier.<br />
<br />
The following section has not yet been implemented, but is slated for 4.0.25.<br />
<br />
<br />
<br />
<br />
== Proposed but not Implemented 4.0.25 Deploy and Rollback==<br />
<br />
<br />
''The following section has not yet been implemented, but is slated for 4.0.25.''<br />
<br />
<br />
Deploy version to archive.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -archive-version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
into production \<br />
</pre><br />
</code><br />
<br />
<br />
List versions deployed with all option.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -all<br />
<br />
Output:<br />
Tag Ver. DD-MM-YYYY-HH:MM:SS<br />
archive/webapp/default/blog-0.1.0 0.1.0 05-12-2011-13:00:00<br />
production/webapp/default/blog 0.1.0 05-12-2011-13:00:00<br />
</pre><br />
</code><br />
<br />
<br />
<br />
Later you decide to update to a new version likely after weeks or months of hard development.<br />
The line marked with production/webapp/default/blog is the /blog that is deployed in the running server.<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.2.0.BUILD-SNAPSHOT.war -name blog -archive_version 0.2.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.2.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
deployed into production.<br />
</pre><br />
</code><br />
<br />
<br />
At this point the following will be deployed:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -all<br />
<br />
Output:<br />
Tag Ver. DD-MM-YYYY-HH:MM:SS<br />
archive/webapp/default/blog-0.1.0 0.1.0 05-12-2011-13:00:00<br />
archive/webapp/default/blog-0.2.0 0.2.0 05-01-2012-11:00:00<br />
production/webapp/default/blog 0.2.0 05-01-2012-11:00:00<br />
</pre><br />
</code><br />
<br />
<br />
Even after rigorous load testing and QA testing, a critical bug was found in 0.2.0 blog and now you need to quickly rollback to a previous version.<br />
<br />
To rollback to a previous version use the '''deploy-archive''' as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-archive blog -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 to hmux://127.0.0.1:6800 \<br />
into production <br />
<br />
</pre><br />
</code><br />
<br />
<br />
<br />
Even after rigorous load testing and QA testing, a critical bug was found in 0.2.0 blog and now you need to quickly rollback to a previous version.<br />
<br />
To rollback to a previous version use the '''deploy-rollback''' as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-rollback blog -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 to hmux://127.0.0.1:6800 \<br />
into production <br />
<br />
</pre><br />
</code><br />
<br />
<br />
<br />
<br />
Even after rigorous load testing and QA testing, a critical bug was found in 0.2.0 blog and now you need to quickly rollback to a previous version.<br />
<br />
To rollback to a previous version use the '''rollback''' as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl rollback blog -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 to hmux://127.0.0.1:6800 \<br />
into production <br />
<br />
</pre><br />
</code><br />
<br />
<br />
<br />
Even after rigorous load testing and QA testing, a critical bug was found in 0.2.0 blog and now you need to quickly rollback to a previous version.<br />
<br />
To rollback to a previous version use the '''deploy-stage''' as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-stage blog -stage archive -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 to hmux://127.0.0.1:6800 \<br />
into production <br />
<br />
</pre><br />
</code><br />
<br />
'''We will need a deploy-stage no matter what for managing preview servers.'''<br />
<br />
NOTE:<br />
I think we go with deploy-rollback and deploy-stage. They do almost the same thing.<br />
Rollback is a bit more self documenting. You use deploy-rollback for rollbacks and you use deploy-stage <br />
for promoting an app to production.<br />
END NOTE:<br />
<br />
<br />
Now after the rollback the deployed servers should look like this.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -all<br />
<br />
Output:<br />
Tag Ver. DD-MM-YYYY-HH:MM:SS<br />
archive/webapp/default/blog-0.1.0 0.1.0 05-12-2011-13:00:00<br />
archive/webapp/default/blog-0.2.0 0.2.0 05-01-2012-11:00:00<br />
production/webapp/default/blog 0.1.0 05-12-2011-13:00:00<br />
</pre><br />
</code><br />
<br />
<br />
Notice that 0.1.0 is now in production.<br />
<br />
<br />
==Promoting an app from preview mode to production==<br />
<br />
Options<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-promote blog <br />
<br />
Output:<br />
Deployed preview/webapp/default/blog to hmux://127.0.0.1:6800 \<br />
into production <br />
<br />
</pre><br />
</code><br />
<br />
Promotes blog that is currently in preview mode into production.<br />
<br />
<br />
== Cluster deployment NOT IMPLEMENTED UNTIL Resin 4.0.25 (coming soon) ==<br />
<br />
<code><br />
<pre><br />
resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
config-rollback - rollback to a different config<br />
config-promote - promotes a staged config to production<br />
</pre><br />
</code><br />
<br />
<br />
At times you need to include things like jar files that are available to more than one application.<br />
Resin allows you to deploy these to remote servers (which can be 1 to hundreds of servers) with one simple command.<br />
<br />
Let's say you have an application that relies on MySQL.<br />
<br />
Setup an RDS database using MySQL 5.1.7 (or as close to your MySQL as possible).<br />
<br />
I use the same username password to make it simple. The only part that is going to change for sure is the URL.<br />
<br />
By default resin uses the /etc/resin/resin.properties file. You could add these properties to /etc/resin/resin.properties.<br />
<br />
'''/etc/resin/resin.properties on resin server'''<br />
<code><br />
<pre><br />
<br />
blogdb.url : blogdb.cvolnlau763z.us-east-1.rds.amazonaws.com<br />
blogdb.user : bloguser<br />
blogdb.password : roofoo<br />
<br />
</pre><br />
</code><br />
<br />
These properties will vary for dev, production, qa, etc. And once they are set, they will not change often.<br />
<br />
You could test locally by copying this file (blog-database.xml) to /etc/resin/resin.d/.<br />
<br />
<br />
'''/etc/resin/resin.d/database.xml''' blog-database.properties under /etc/resin/resin.d.<br />
<code><br />
<pre><br />
<resin xmlns="http://caucho.com/ns/resin"<br />
xmlns:resin="urn:java:com.caucho.resin"><br />
<br />
<database jndi-name="jdbc/blogdb"><br />
<driver type="com.mysql.jdbc.Driver"><br />
<url>jdbc:mysql://${blogdb.url}:3306/blogdb</url><br />
<user>${blogdb.user}</user><br />
<password>${blogdb.password}</password><br />
</driver><br />
</database><br />
</resin><br />
</pre><br />
</code><br />
<br />
<br />
The problem now is that you don't have a mysql.jar file and you will get a class not found exception when the apps starts up.<br />
<br />
<br />
<br />
If you are using maven locally you can copy mysql from the maven local repo as follows:<br />
<br />
Find and copy the mysql jar file from the maven local repo to Resin as follows:<br />
<br />
Find it:<br />
<br />
<code><br />
<pre><br />
$ find ~/.m2/repository/ -name "*mysql*.jar"<br />
/home/rick/.m2/repository/mysql/mysql-connector-java/5.1.18/mysql-connector-java-5.1.18.jar<br />
</pre><br />
</code><br />
<br />
<br />
Now deploy it<br />
<br />
<code><br />
<pre><br />
$ sudo cp ~/.m2/repository/mysql/mysql-connector-java/5.1.18/mysql-connector-java-5.1.18.jar \ <br />
/usr/local/share/resin/lib/<br />
<br />
</pre><br />
</code><br />
<br />
Or you can use yum to get the mysql driver as follows:<br />
<br />
Next install the mysql driver.<br />
$ sudo yum install mysql-connector-java<br />
$ sudo cp /usr/share/java/mysql-connector-java.jar /usr/local/share/resin/lib/<br />
<br />
<br />
The problem with this approach is that things work for you locally for /blog if it relies on mysql being managed under jndi:jdbc/blogdb, but all of your remote deployments will fail unless you manually add the mysql jar to each server and manually add the blog-database.xml file to each server. <br />
<br />
<br />
Resin 4.0.25 allows you to deploy configuration files not just applications. This allows you to change what jar files get loaded into the Resin classpath, config files and properties. If you are doing cloud deployment with 100's of servers deploying mysql to them can be as easy as what we are going to describe.<br />
<br />
Ok assuming you have developed and tested the /blog app locally and now you want to push blog to a remote server or set of servers, you can do the following:<br />
<br />
<br />
# Create a directory blog-database<br />
# Create a directory called blog-database/lib<br />
# Copy blog-database.xml into blog-database directory<br />
# Copy mysql.jar into blog-database/lib<br />
# Create a file called blog-database/resin.properties<br />
# Use resinctl config-deploy to deploy the configuration<br />
<br />
<br />
First create the dirs and copy the jar.<br />
<br />
<code><br />
<pre><br />
$ mkdir blog-database<br />
$ mkdir blog-database/lib<br />
$ cp /etc/resin/resin.d/blog-database.xml blog-database/<br />
$ cp /usr/local/share/resin/lib/mysql-connector*.jar blog-database/lib/<br />
</pre><br />
</code><br />
<br />
Instead of modifying every servers /etc/resin/resin.properties, you can add a resin.properties to blog-database dir that gets deployed with the config bundle as follows:<br />
<br />
'''./blog-database/resin.properties'''<br />
<code><br />
<pre><br />
blogdb.url : blogdb.cvolnlau763z.us-east-1.rds.amazonaws.com<br />
blogdb.user : bloguser<br />
blogdb.password : roofoo<br />
</pre><br />
</code><br />
<br />
It might make sense to deploy the database properties in a separate config deployment, but for simplicity we bundle together in one.<br />
<br />
'''NOTE: This works for dir/lib . We should allow dir/webapp-jars and it should work the same. <br />
The jars get loaded per webapp for dir/webapp-jars. END NOTE'''<br />
<br />
Next deploy to the remote server as follows:<br />
<code><br />
<pre><br />
$ resinctl config-deploy blog-database -version=0.1.0 -address=199.99.99.01 -port=8080<br />
</pre><br />
</code><br />
<br />
To see what is deployed you can do the following:<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl config-list -all -address=199.99.99.01 -port=8080<br />
<br />
Output:<br />
archive/config/default/blog-database-0.1.0 0.1.0 05-12-2011-13:00:00<br />
production/config/default/blog-database 0.1.0 05-12-2011-13:00:00<br />
</pre><br />
</code><br />
<br />
<br />
If you wanted to see exactly what was in blog-database/lib you could do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl config-list-ls blog-database -dir=lib -version=0.1.0 -address=199.99.99.01 -port=8080<br />
<br />
Output:<br />
mysql-connector-java-5.1.18.jar<br />
</pre><br />
</code><br />
<br />
Or to see everything in the deployment use tree<br />
<code><br />
<pre><br />
$ resinctl config-list-tree blog-database -version=0.1.0 -address=199.99.99.01 -port=8080<br />
<br />
Output:<br />
blog-database.xml<br />
resin.properties<br />
lib/<br />
mysql-connector-java-5.1.18.jar<br />
</pre><br />
</code><br />
<br />
<br />
If you wanted to see exactly what was in blog-database/blog-database.xml you could do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl config-list-cat blog-database -file=./blog-database.xml -version=0.1.0 -address=199.99.99.01 -port=8080<br />
<br />
Output:<br />
<resin xmlns="http://caucho.com/ns/resin"<br />
xmlns:resin="urn:java:com.caucho.resin"><br />
<br />
<database jndi-name="jdbc/blogdb"><br />
<driver type="com.mysql.jdbc.Driver"><br />
<url>jdbc:mysql://${blogdb.url}:3306/blogdb</url><br />
<user>${blogdb.user}</user><br />
<password>${blogdb.password}</password><br />
</driver><br />
</database><br />
</resin><br />
<br />
</pre><br />
</code><br />
<br />
The following commands work like deploy-undeploy, deploy-rollback and deploy-promote, but for configuration.<br />
<br />
# config-undeploy - undeploys a config<br />
# config-rollback - rollback to a different config<br />
# config-promote - promotes a staged config to production</div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-07T00:13:58Z<p>Rickhigh: /* Cluster deployment NOT IMPLEMENTED UNTIL Resin 4.0.25 (coming soon) */</p>
<hr />
<div># Deploying to a local server<br />
## Deploying to a staging server (locally)<br />
## Deploying to a preview staging server (locally)<br />
# Deploying to a remote server<br />
## Setting up a user and password<br />
## Deploying to a remote server<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
## license-add enabling Resin features<br />
# Deploy to a staging server<br />
## Setting up load balancer to not to deploy to staging server<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
## Installing mysql driver for a web application using config-deploy<br />
## Showing what is in remote config with config-list-ls and config-list-cat<br />
# web-app-deploy settings<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code><br />
<br />
<br />
== Deploying to a local server ==<br />
<br />
Deploy commands available <br />
<br />
<code><br />
<pre><br />
$ resinctl help deploy<br />
<br />
<br />
Output:<br />
usage: bin/resin.sh [-conf <file>] [-server <id>] deploy -user <user> \<br />
-password <password> [options] <war-file><br />
<br />
description:<br />
deploys application specified in a <war-file> to resin server<br />
<br />
options:<br />
-conf <file> : resin configuration file<br />
-server <id> : id of a server<br />
-address <address> : ip or host name of the server<br />
-port <port> : server http port<br />
-user <user> : user name used for authentication to the server<br />
-password <password> : password used for authentication to the server<br />
-host <host> : virtual host to make application available on<br />
-name <name> : name of the context to deploy to, defaults to war-file name<br />
-stage <stage> : stage to deploy application to, defaults to production<br />
-version <version> : version of application formatted as <major.minor.micro.qualifier><br />
-m <message> : commit message<br />
</pre><br />
</code><br />
<br />
Turning on versioning:<br />
<br />
<code><br />
<pre><br />
$ cat /etc/resin/resin.properties | grep deploy<br />
<br />
Output:<br />
deploy_versioning : true<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
<br />
$ sudo grep "web-app-deploy" -A 1 /etc/resin/resin.xml <br />
<br />
Output:<br />
<web-app-deploy path="webapps" versioning="${deploy_versioning}"<br />
expand-preserve-fileset="WEB-INF/work/**"/><br />
<br />
</pre><br />
</code><br />
<br />
"if true, use the web-app's numeric suffix as a version"<br />
<br />
Run deploy command passing location of war file.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.war -name blog <br />
<br />
Output:<br />
Deployed production/webapp/default/blog from \<br />
./target/blog-0.1.0.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
To see the deployed you can use resinctl deploy-list<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
<br />
Now undeploy it:<br />
<br />
<code><br />
<pre><br />
$ resinctl undeploy blog<br />
<br />
Output:<br />
Undeployed blog from hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
At this point there should be nothing<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
</pre><br />
</code><br />
<br />
Now deploy it with versioning:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -version 0.1.0 <br />
<br />
Output:<br />
Deployed production/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
</pre><br />
</code><br />
<br />
Blog application is under the version 0.1.0<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog-0.1.0<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
=== Deploying to a staging server ===<br />
<br />
Deploy to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogz -version 0.1.0 -stage staging<br />
<br />
Output<br />
Deployed staging/webapp/default/blogz-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
The staging name is logical. You can call it anything. The app will not be served unless<br />
the server is started with this staging name.<br />
<br />
Showing items deployed to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
production/webapp/default/blog-0.1.0<br />
staging/webapp/default/blogz-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
The /blog works but /blogz does not work because server is by default setup as production server.<br />
<br />
/blog works because server is setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blog<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
/blogz does not work because server is not setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogz<br />
...<br />
HTTP request sent, awaiting response... 404 Not Found<br />
</pre><br />
</code><br />
<br />
To run the server as a staging server do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ resinctl help start<br />
<br />
Output:<br />
usage: bin/resin.sh [-options] start<br />
<br />
where options include:<br />
-conf <file> : select a configuration file<br />
-data-directory <dir> : select a resin-data directory<br />
-join-cluster <cluster> : join a cluster as a dynamic server<br />
-log-directory <dir> : select a logging directory<br />
-resin-home <dir> : select a resin home directory<br />
-root-directory <dir> : select a root directory<br />
-server <id> : select a <server> to run<br />
-watchdog-port <port> : override the watchdog-port<br />
-verbose : print verbose starting information<br />
-preview : run as a preview server<br />
-debug-port <port> : configure a debug port<br />
-jmx-port <port> : configure an unauthenticated jmx port<br />
-stage <staging-name> : The stage the server is serving (default production)<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ sudo resinctl start -stage staging<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
<br />
$ wget localhost:8080/blogz<br />
...<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
<br />
=== Deploying to a preview staging server ===<br />
<br />
<br />
<code><br />
<pre><br />
<br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogp -version 0.1.0 -stage preview<br />
<br />
Output<br />
Deployed preview/webapp/default/blogp-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
$ resinctl deploy-list<br />
<br />
Output<br />
preview/webapp/default/blogp-0.1.0<br />
production/webapp/default/blog-0.1.0<br />
...<br />
</pre><br />
</code><br />
<br />
<br />
Restart the server in preview stage, since preview staging is a common thing, you can just use the -preview command.<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
$ sudo resinctl start -preview<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<br />
Now the preview blog site is available.<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogp<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
== Deploying to a Remote Server ==<br />
<br />
Setup the remote box (Install Resin)<br />
<br />
You need to create a user name and password.<br />
<br />
<code><br />
<pre><br />
REMOTE SERVER $ resinctl generate-password -user rick -password dogbones<br />
<br />
Output:<br />
admin_user : rick<br />
admin_password : {SSHA}JmojvNUU4OpTOw0/SESRsnpEHejxkhZZ<br />
</pre><br />
</code><br />
<br />
<br />
Modify resin.properties<br />
<br />
<code><br />
<pre><br />
<br />
REMOTE SERVER$ cat /etc/resin/resin.properties<br />
<br />
Output:<br />
admin_user : rick<br />
admin_password : {SSHA}JmojvNUU4OpTOw0/SESRsnpEHejxkhZZ<br />
admin_remote_enable : true<br />
...<br />
</pre><br />
</code><br />
<br />
Now from the local server deploy your app as follows:<br />
<br />
<code><br />
<pre><br />
LOCAL SERVER $ resinctl deploy target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogdb \ <br />
-address 192.168.248.168 -port 8080 -user rick -password dogbones<br />
</pre><br />
</code><br />
<br />
You can verify that the deploy worked as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -address 192.168.248.168 -port 8080 -user rick -password dogbones<br />
<br />
Output:<br />
production/webapp/default/blog<br />
...<br />
</pre><br />
</code><br />
<br />
<br />
<br />
== Working with deploy-copy to release, and rollback ==<br />
<br />
<br />
Deploy version to archive.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -stage archive -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
<br />
List versions deployed.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
archive/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
Copy deployment to production<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-copy -source blog -source-stage archive \<br />
-source-version 0.1.0 -target blog<br />
<br />
Output:<br />
copied archive/webapp/default/blog-0.1.0 to production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
archive/webapp/default/blog-0.1.0<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
<br />
When you deploy this way you must start the app as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-start blog<br />
<br />
Output:<br />
'production/webapp/default/blog' is started<br />
</pre><br />
</code><br />
<br />
Then you would deploy copy a different version to rollback or promote a different version to prod.<br />
<br />
In review of the above, we have decided to make the process a bit easier.<br />
<br />
The following section has not yet been implemented, but is slated for 4.0.25.<br />
<br />
<br />
<br />
<br />
== Proposed but not Implemented 4.0.25 Deploy and Rollback==<br />
<br />
<br />
''The following section has not yet been implemented, but is slated for 4.0.25.''<br />
<br />
<br />
Deploy version to archive.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -archive-version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
into production \<br />
</pre><br />
</code><br />
<br />
<br />
List versions deployed with all option.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -all<br />
<br />
Output:<br />
Tag Ver. DD-MM-YYYY-HH:MM:SS<br />
archive/webapp/default/blog-0.1.0 0.1.0 05-12-2011-13:00:00<br />
production/webapp/default/blog 0.1.0 05-12-2011-13:00:00<br />
</pre><br />
</code><br />
<br />
<br />
<br />
Later you decide to update to a new version likely after weeks or months of hard development.<br />
The line marked with production/webapp/default/blog is the /blog that is deployed in the running server.<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.2.0.BUILD-SNAPSHOT.war -name blog -archive_version 0.2.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.2.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
deployed into production.<br />
</pre><br />
</code><br />
<br />
<br />
At this point the following will be deployed:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -all<br />
<br />
Output:<br />
Tag Ver. DD-MM-YYYY-HH:MM:SS<br />
archive/webapp/default/blog-0.1.0 0.1.0 05-12-2011-13:00:00<br />
archive/webapp/default/blog-0.2.0 0.2.0 05-01-2012-11:00:00<br />
production/webapp/default/blog 0.2.0 05-01-2012-11:00:00<br />
</pre><br />
</code><br />
<br />
<br />
Even after rigorous load testing and QA testing, a critical bug was found in 0.2.0 blog and now you need to quickly rollback to a previous version.<br />
<br />
To rollback to a previous version use the '''deploy-archive''' as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-archive blog -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 to hmux://127.0.0.1:6800 \<br />
into production <br />
<br />
</pre><br />
</code><br />
<br />
<br />
<br />
Even after rigorous load testing and QA testing, a critical bug was found in 0.2.0 blog and now you need to quickly rollback to a previous version.<br />
<br />
To rollback to a previous version use the '''deploy-rollback''' as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-rollback blog -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 to hmux://127.0.0.1:6800 \<br />
into production <br />
<br />
</pre><br />
</code><br />
<br />
<br />
<br />
<br />
Even after rigorous load testing and QA testing, a critical bug was found in 0.2.0 blog and now you need to quickly rollback to a previous version.<br />
<br />
To rollback to a previous version use the '''rollback''' as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl rollback blog -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 to hmux://127.0.0.1:6800 \<br />
into production <br />
<br />
</pre><br />
</code><br />
<br />
<br />
<br />
Even after rigorous load testing and QA testing, a critical bug was found in 0.2.0 blog and now you need to quickly rollback to a previous version.<br />
<br />
To rollback to a previous version use the '''deploy-stage''' as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-stage blog -stage archive -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 to hmux://127.0.0.1:6800 \<br />
into production <br />
<br />
</pre><br />
</code><br />
<br />
'''We will need a deploy-stage no matter what for managing preview servers.'''<br />
<br />
NOTE:<br />
I think we go with deploy-rollback and deploy-stage. They do almost the same thing.<br />
Rollback is a bit more self documenting. You use deploy-rollback for rollbacks and you use deploy-stage <br />
for promoting an app to production.<br />
END NOTE:<br />
<br />
<br />
Now after the rollback the deployed servers should look like this.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -all<br />
<br />
Output:<br />
Tag Ver. DD-MM-YYYY-HH:MM:SS<br />
archive/webapp/default/blog-0.1.0 0.1.0 05-12-2011-13:00:00<br />
archive/webapp/default/blog-0.2.0 0.2.0 05-01-2012-11:00:00<br />
production/webapp/default/blog 0.1.0 05-12-2011-13:00:00<br />
</pre><br />
</code><br />
<br />
<br />
Notice that 0.1.0 is now in production.<br />
<br />
<br />
==Promoting an app from preview mode to production==<br />
<br />
Options<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-promote blog <br />
<br />
Output:<br />
Deployed preview/webapp/default/blog to hmux://127.0.0.1:6800 \<br />
into production <br />
<br />
</pre><br />
</code><br />
<br />
Promotes blog that is currently in preview mode into production.<br />
<br />
<br />
== Cluster deployment NOT IMPLEMENTED UNTIL Resin 4.0.25 (coming soon) ==<br />
<br />
<code><br />
<pre><br />
resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code><br />
<br />
<br />
At times you need to include things like jar files that are available to more than one application.<br />
Resin allows you to deploy these to remote servers (which can be 1 to hundreds of servers) with one simple command.<br />
<br />
Let's say you have an application that relies on MySQL.<br />
<br />
Setup an RDS database using MySQL 5.1.7 (or as close to your MySQL as possible).<br />
<br />
I use the same username password to make it simple. The only part that is going to change for sure is the URL.<br />
<br />
By default resin uses the /etc/resin/resin.properties file. You could add these properties to /etc/resin/resin.properties.<br />
<br />
'''/etc/resin/resin.properties on resin server'''<br />
<code><br />
<pre><br />
<br />
blogdb.url : blogdb.cvolnlau763z.us-east-1.rds.amazonaws.com<br />
blogdb.user : bloguser<br />
blogdb.password : roofoo<br />
<br />
</pre><br />
</code><br />
<br />
These properties will vary for dev, production, qa, etc. And once they are set, they will not change often.<br />
<br />
You could test locally by copying this file (blog-database.xml) to /etc/resin/resin.d/.<br />
<br />
<br />
'''/etc/resin/resin.d/database.xml''' blog-database.properties under /etc/resin/resin.d.<br />
<code><br />
<pre><br />
<resin xmlns="http://caucho.com/ns/resin"<br />
xmlns:resin="urn:java:com.caucho.resin"><br />
<br />
<database jndi-name="jdbc/blogdb"><br />
<driver type="com.mysql.jdbc.Driver"><br />
<url>jdbc:mysql://${blogdb.url}:3306/blogdb</url><br />
<user>${blogdb.user}</user><br />
<password>${blogdb.password}</password><br />
</driver><br />
</database><br />
</resin><br />
</pre><br />
</code><br />
<br />
<br />
The problem now is that you don't have a mysql.jar file and you will get a class not found exception when the apps starts up.<br />
<br />
<br />
<br />
If you are using maven locally you can copy mysql from the maven local repo as follows:<br />
<br />
Find and copy the mysql jar file from the maven local repo to Resin as follows:<br />
<br />
Find it:<br />
<br />
<code><br />
<pre><br />
$ find ~/.m2/repository/ -name "*mysql*.jar"<br />
/home/rick/.m2/repository/mysql/mysql-connector-java/5.1.18/mysql-connector-java-5.1.18.jar<br />
</pre><br />
</code><br />
<br />
<br />
Now deploy it<br />
<br />
<code><br />
<pre><br />
$ sudo cp ~/.m2/repository/mysql/mysql-connector-java/5.1.18/mysql-connector-java-5.1.18.jar \ <br />
/usr/local/share/resin/lib/<br />
<br />
</pre><br />
</code><br />
<br />
Or you can use yum to get the mysql driver as follows:<br />
<br />
Next install the mysql driver.<br />
$ sudo yum install mysql-connector-java<br />
$ sudo cp /usr/share/java/mysql-connector-java.jar /usr/local/share/resin/lib/<br />
<br />
<br />
The problem with this approach is that things work for you locally for /blog if it relies on mysql being managed under jndi:jdbc/blogdb, but all of your remote deployments will fail unless you manually add the mysql jar to each server.<br />
<br />
<br />
Resin 4.0.25 allows you to deploy configuration files not just applications. This allows you to change what jar files get loaded into the Resin classpath. If you are doing cloud deployment with 100's of servers deploying mysql to them can be as easy as what we are going to describe.<br />
<br />
Ok assuming you have developed and tested the /blog app locally and now you want to push blog to a remote server or set of servers, you can do the following:<br />
<br />
<br />
# Create a directory blog-database<br />
# Create a directory called blog-database/lib<br />
# Copy blog-database.xml into blog-database directory<br />
# Copy mysql.jar into blog-database/lib<br />
# Use resinctl config-deploy to deploy the configuration<br />
<br />
<br />
First create the dirs and copy the jar.<br />
<br />
<code><br />
<pre><br />
$ mkdir blog-database<br />
$ mkdir blog-database/lib<br />
$ cp /etc/resin/resin.d/blog-database.xml blog-database/<br />
$ cp /usr/local/share/resin/lib/mysql-connector*.jar blog-database/lib/<br />
</pre><br />
</code><br />
<br />
'''NOTE: This works for dir/lib .. we should allow dir/webapp-jars and it should work the same. <br />
The jars get loaded per webapp for dir/webapp-jars. END NOTE'''<br />
<br />
Next deploy to the remote server as follows:<br />
<code><br />
<pre><br />
$ resinctl config-deploy blog-database<br />
</pre><br />
</code><br />
<br />
To see what is deployed you can do the following:<br />
<br />
<code><br />
<pre><br />
resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code><br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl config-list <br />
</pre><br />
</code></div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-06T23:55:12Z<p>Rickhigh: /* Promoting an app from preview mode to production */</p>
<hr />
<div># Deploying to a local server<br />
## Deploying to a staging server (locally)<br />
## Deploying to a preview staging server (locally)<br />
# Deploying to a remote server<br />
## Setting up a user and password<br />
## Deploying to a remote server<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
## license-add enabling Resin features<br />
# Deploy to a staging server<br />
## Setting up load balancer to not to deploy to staging server<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
## Installing mysql driver for a web application using config-deploy<br />
## Showing what is in remote config with config-list-ls and config-list-cat<br />
# web-app-deploy settings<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code><br />
<br />
<br />
== Deploying to a local server ==<br />
<br />
Deploy commands available <br />
<br />
<code><br />
<pre><br />
$ resinctl help deploy<br />
<br />
<br />
Output:<br />
usage: bin/resin.sh [-conf <file>] [-server <id>] deploy -user <user> \<br />
-password <password> [options] <war-file><br />
<br />
description:<br />
deploys application specified in a <war-file> to resin server<br />
<br />
options:<br />
-conf <file> : resin configuration file<br />
-server <id> : id of a server<br />
-address <address> : ip or host name of the server<br />
-port <port> : server http port<br />
-user <user> : user name used for authentication to the server<br />
-password <password> : password used for authentication to the server<br />
-host <host> : virtual host to make application available on<br />
-name <name> : name of the context to deploy to, defaults to war-file name<br />
-stage <stage> : stage to deploy application to, defaults to production<br />
-version <version> : version of application formatted as <major.minor.micro.qualifier><br />
-m <message> : commit message<br />
</pre><br />
</code><br />
<br />
Turning on versioning:<br />
<br />
<code><br />
<pre><br />
$ cat /etc/resin/resin.properties | grep deploy<br />
<br />
Output:<br />
deploy_versioning : true<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
<br />
$ sudo grep "web-app-deploy" -A 1 /etc/resin/resin.xml <br />
<br />
Output:<br />
<web-app-deploy path="webapps" versioning="${deploy_versioning}"<br />
expand-preserve-fileset="WEB-INF/work/**"/><br />
<br />
</pre><br />
</code><br />
<br />
"if true, use the web-app's numeric suffix as a version"<br />
<br />
Run deploy command passing location of war file.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.war -name blog <br />
<br />
Output:<br />
Deployed production/webapp/default/blog from \<br />
./target/blog-0.1.0.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
To see the deployed you can use resinctl deploy-list<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
<br />
Now undeploy it:<br />
<br />
<code><br />
<pre><br />
$ resinctl undeploy blog<br />
<br />
Output:<br />
Undeployed blog from hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
At this point there should be nothing<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
</pre><br />
</code><br />
<br />
Now deploy it with versioning:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -version 0.1.0 <br />
<br />
Output:<br />
Deployed production/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
</pre><br />
</code><br />
<br />
Blog application is under the version 0.1.0<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog-0.1.0<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
=== Deploying to a staging server ===<br />
<br />
Deploy to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogz -version 0.1.0 -stage staging<br />
<br />
Output<br />
Deployed staging/webapp/default/blogz-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
The staging name is logical. You can call it anything. The app will not be served unless<br />
the server is started with this staging name.<br />
<br />
Showing items deployed to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
production/webapp/default/blog-0.1.0<br />
staging/webapp/default/blogz-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
The /blog works but /blogz does not work because server is by default setup as production server.<br />
<br />
/blog works because server is setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blog<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
/blogz does not work because server is not setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogz<br />
...<br />
HTTP request sent, awaiting response... 404 Not Found<br />
</pre><br />
</code><br />
<br />
To run the server as a staging server do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ resinctl help start<br />
<br />
Output:<br />
usage: bin/resin.sh [-options] start<br />
<br />
where options include:<br />
-conf <file> : select a configuration file<br />
-data-directory <dir> : select a resin-data directory<br />
-join-cluster <cluster> : join a cluster as a dynamic server<br />
-log-directory <dir> : select a logging directory<br />
-resin-home <dir> : select a resin home directory<br />
-root-directory <dir> : select a root directory<br />
-server <id> : select a <server> to run<br />
-watchdog-port <port> : override the watchdog-port<br />
-verbose : print verbose starting information<br />
-preview : run as a preview server<br />
-debug-port <port> : configure a debug port<br />
-jmx-port <port> : configure an unauthenticated jmx port<br />
-stage <staging-name> : The stage the server is serving (default production)<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ sudo resinctl start -stage staging<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
<br />
$ wget localhost:8080/blogz<br />
...<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
<br />
=== Deploying to a preview staging server ===<br />
<br />
<br />
<code><br />
<pre><br />
<br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogp -version 0.1.0 -stage preview<br />
<br />
Output<br />
Deployed preview/webapp/default/blogp-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
$ resinctl deploy-list<br />
<br />
Output<br />
preview/webapp/default/blogp-0.1.0<br />
production/webapp/default/blog-0.1.0<br />
...<br />
</pre><br />
</code><br />
<br />
<br />
Restart the server in preview stage, since preview staging is a common thing, you can just use the -preview command.<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
$ sudo resinctl start -preview<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<br />
Now the preview blog site is available.<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogp<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
== Deploying to a Remote Server ==<br />
<br />
Setup the remote box (Install Resin)<br />
<br />
You need to create a user name and password.<br />
<br />
<code><br />
<pre><br />
REMOTE SERVER $ resinctl generate-password -user rick -password dogbones<br />
<br />
Output:<br />
admin_user : rick<br />
admin_password : {SSHA}JmojvNUU4OpTOw0/SESRsnpEHejxkhZZ<br />
</pre><br />
</code><br />
<br />
<br />
Modify resin.properties<br />
<br />
<code><br />
<pre><br />
<br />
REMOTE SERVER$ cat /etc/resin/resin.properties<br />
<br />
Output:<br />
admin_user : rick<br />
admin_password : {SSHA}JmojvNUU4OpTOw0/SESRsnpEHejxkhZZ<br />
admin_remote_enable : true<br />
...<br />
</pre><br />
</code><br />
<br />
Now from the local server deploy your app as follows:<br />
<br />
<code><br />
<pre><br />
LOCAL SERVER $ resinctl deploy target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogdb \ <br />
-address 192.168.248.168 -port 8080 -user rick -password dogbones<br />
</pre><br />
</code><br />
<br />
You can verify that the deploy worked as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -address 192.168.248.168 -port 8080 -user rick -password dogbones<br />
<br />
Output:<br />
production/webapp/default/blog<br />
...<br />
</pre><br />
</code><br />
<br />
<br />
<br />
== Working with deploy-copy to release, and rollback ==<br />
<br />
<br />
Deploy version to archive.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -stage archive -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
<br />
List versions deployed.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
archive/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
Copy deployment to production<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-copy -source blog -source-stage archive \<br />
-source-version 0.1.0 -target blog<br />
<br />
Output:<br />
copied archive/webapp/default/blog-0.1.0 to production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
archive/webapp/default/blog-0.1.0<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
<br />
When you deploy this way you must start the app as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-start blog<br />
<br />
Output:<br />
'production/webapp/default/blog' is started<br />
</pre><br />
</code><br />
<br />
Then you would deploy copy a different version to rollback or promote a different version to prod.<br />
<br />
In review of the above, we have decided to make the process a bit easier.<br />
<br />
The following section has not yet been implemented, but is slated for 4.0.25.<br />
<br />
<br />
<br />
<br />
== Proposed but not Implemented 4.0.25 Deploy and Rollback==<br />
<br />
<br />
''The following section has not yet been implemented, but is slated for 4.0.25.''<br />
<br />
<br />
Deploy version to archive.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -archive-version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
into production \<br />
</pre><br />
</code><br />
<br />
<br />
List versions deployed with all option.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -all<br />
<br />
Output:<br />
Tag Ver. DD-MM-YYYY-HH:MM:SS<br />
archive/webapp/default/blog-0.1.0 0.1.0 05-12-2011-13:00:00<br />
production/webapp/default/blog 0.1.0 05-12-2011-13:00:00<br />
</pre><br />
</code><br />
<br />
<br />
<br />
Later you decide to update to a new version likely after weeks or months of hard development.<br />
The line marked with production/webapp/default/blog is the /blog that is deployed in the running server.<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.2.0.BUILD-SNAPSHOT.war -name blog -archive_version 0.2.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.2.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
deployed into production.<br />
</pre><br />
</code><br />
<br />
<br />
At this point the following will be deployed:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -all<br />
<br />
Output:<br />
Tag Ver. DD-MM-YYYY-HH:MM:SS<br />
archive/webapp/default/blog-0.1.0 0.1.0 05-12-2011-13:00:00<br />
archive/webapp/default/blog-0.2.0 0.2.0 05-01-2012-11:00:00<br />
production/webapp/default/blog 0.2.0 05-01-2012-11:00:00<br />
</pre><br />
</code><br />
<br />
<br />
Even after rigorous load testing and QA testing, a critical bug was found in 0.2.0 blog and now you need to quickly rollback to a previous version.<br />
<br />
To rollback to a previous version use the '''deploy-archive''' as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-archive blog -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 to hmux://127.0.0.1:6800 \<br />
into production <br />
<br />
</pre><br />
</code><br />
<br />
<br />
<br />
Even after rigorous load testing and QA testing, a critical bug was found in 0.2.0 blog and now you need to quickly rollback to a previous version.<br />
<br />
To rollback to a previous version use the '''deploy-rollback''' as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-rollback blog -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 to hmux://127.0.0.1:6800 \<br />
into production <br />
<br />
</pre><br />
</code><br />
<br />
<br />
<br />
<br />
Even after rigorous load testing and QA testing, a critical bug was found in 0.2.0 blog and now you need to quickly rollback to a previous version.<br />
<br />
To rollback to a previous version use the '''rollback''' as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl rollback blog -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 to hmux://127.0.0.1:6800 \<br />
into production <br />
<br />
</pre><br />
</code><br />
<br />
<br />
<br />
Even after rigorous load testing and QA testing, a critical bug was found in 0.2.0 blog and now you need to quickly rollback to a previous version.<br />
<br />
To rollback to a previous version use the '''deploy-stage''' as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-stage blog -stage archive -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 to hmux://127.0.0.1:6800 \<br />
into production <br />
<br />
</pre><br />
</code><br />
<br />
'''We will need a deploy-stage no matter what for managing preview servers.'''<br />
<br />
NOTE:<br />
I think we go with deploy-rollback and deploy-stage. They do almost the same thing.<br />
Rollback is a bit more self documenting. You use deploy-rollback for rollbacks and you use deploy-stage <br />
for promoting an app to production.<br />
END NOTE:<br />
<br />
<br />
Now after the rollback the deployed servers should look like this.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -all<br />
<br />
Output:<br />
Tag Ver. DD-MM-YYYY-HH:MM:SS<br />
archive/webapp/default/blog-0.1.0 0.1.0 05-12-2011-13:00:00<br />
archive/webapp/default/blog-0.2.0 0.2.0 05-01-2012-11:00:00<br />
production/webapp/default/blog 0.1.0 05-12-2011-13:00:00<br />
</pre><br />
</code><br />
<br />
<br />
Notice that 0.1.0 is now in production.<br />
<br />
<br />
==Promoting an app from preview mode to production==<br />
<br />
Options<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-promote blog <br />
<br />
Output:<br />
Deployed preview/webapp/default/blog to hmux://127.0.0.1:6800 \<br />
into production <br />
<br />
</pre><br />
</code><br />
<br />
Promotes blog that is currently in preview mode into production.<br />
<br />
<br />
== Cluster deployment NOT IMPLEMENTED UNTIL Resin 4.0.25 (coming soon) ==<br />
<br />
<code><br />
<pre><br />
resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre<br />
</code><br />
<br />
<br />
At times you need to include things like jar files that are available to more than one application.<br />
Resin allows you to deploy these to cluster (which can be 1 to hundreds of servers) with one simple command.<br />
<br />
Let's say you have an application that relies on MySQL.<br />
<br />
<br />
Setup an RDS database using MySQL 5.1.7 (or as close to your MySQL as possible).<br />
<br />
I use the same username password to make it simple. The only part that is going to change for sure is the URL.<br />
<br />
<br />
By default resin uses the /etc/resin/resin.properties file. You could add these properties to /etc/resin/resin.properties.<br />
<br />
'''/etc/resin/resin.properties on resin server'''<br />
<code><br />
<pre><br />
<br />
blogdb.url : blogdb.cvolnlau763z.us-east-1.rds.amazonaws.com<br />
blogdb.user : bloguser<br />
blogdb.password : roofoo<br />
<br />
</pre><br />
</code><br />
<br />
These properties will vary for dev, production, qa, etc. And once they are set, they will not change often.<br />
<br />
You could test locally by copying this file (blog-database.xml) to /etc/resin/resin.d/.<br />
<br />
<br />
'''/etc/resin/resin.d/database.xml''' blog-database.properties under /etc/resin/resin.d.<br />
<code><br />
<pre><br />
<resin xmlns="http://caucho.com/ns/resin"<br />
xmlns:resin="urn:java:com.caucho.resin"><br />
<br />
<database jndi-name="jdbc/blogdb"><br />
<driver type="com.mysql.jdbc.Driver"><br />
<url>jdbc:mysql://${blogdb.url}:3306/blogdb</url><br />
<user>${blogdb.user}</user><br />
<password>${blogdb.password}</password><br />
</driver><br />
</database><br />
</resin><br />
</pre><br />
</code><br />
<br />
<br />
The problem now is that you don't have a mysql.jar file and you will get a class not found exception when the apps starts up.<br />
<br />
<br />
<br />
If you are using maven locally you can copy mysql from the maven local repo as follows:<br />
<br />
<br />
<br />
Find and copy the mysql jar file from the maven local repo to Resin as follows:<br />
<br />
Find it:<br />
<br />
<code><br />
<pre><br />
$ find ~/.m2/repository/ -name "*mysql*.jar"<br />
/home/rick/.m2/repository/mysql/mysql-connector-java/5.1.18/mysql-connector-java-5.1.18.jar<br />
</pre><br />
</code><br />
<br />
<br />
Now deploy it<br />
<br />
<code><br />
<pre><br />
$ sudo cp ~/.m2/repository/mysql/mysql-connector-java/5.1.18/mysql-connector-java-5.1.18.jar \ <br />
/usr/local/share/resin/lib/<br />
<br />
</pre><br />
</code><br />
<br />
Or you can use yum to get the mysql driver as follows:<br />
<br />
Next install the mysql driver.<br />
$ sudo yum install mysql-connector-java<br />
$ sudo cp /usr/share/java/mysql-connector-java.jar /usr/local/share/resin/lib/<br />
<br />
<br />
The problem with this approach is that things work for you locally for /blog if it relies on mysql being managed under jndi:jdbc/blogdb, but all of your remote deployments will fail unless you manually add the mysql jar to each server.</div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-06T21:56:35Z<p>Rickhigh: /* Proposed but not Implemented 4.0.25 Deploy and Rollback */</p>
<hr />
<div># Deploying to a local server<br />
## Deploying to a staging server (locally)<br />
## Deploying to a preview staging server (locally)<br />
# Deploying to a remote server<br />
## Setting up a user and password<br />
## Deploying to a remote server<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
## license-add enabling Resin features<br />
# Deploy to a staging server<br />
## Setting up load balancer to not to deploy to staging server<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
## Installing mysql driver for a web application using config-deploy<br />
## Showing what is in remote config with config-list-ls and config-list-cat<br />
# web-app-deploy settings<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code><br />
<br />
<br />
== Deploying to a local server ==<br />
<br />
Deploy commands available <br />
<br />
<code><br />
<pre><br />
$ resinctl help deploy<br />
<br />
<br />
Output:<br />
usage: bin/resin.sh [-conf <file>] [-server <id>] deploy -user <user> \<br />
-password <password> [options] <war-file><br />
<br />
description:<br />
deploys application specified in a <war-file> to resin server<br />
<br />
options:<br />
-conf <file> : resin configuration file<br />
-server <id> : id of a server<br />
-address <address> : ip or host name of the server<br />
-port <port> : server http port<br />
-user <user> : user name used for authentication to the server<br />
-password <password> : password used for authentication to the server<br />
-host <host> : virtual host to make application available on<br />
-name <name> : name of the context to deploy to, defaults to war-file name<br />
-stage <stage> : stage to deploy application to, defaults to production<br />
-version <version> : version of application formatted as <major.minor.micro.qualifier><br />
-m <message> : commit message<br />
</pre><br />
</code><br />
<br />
Turning on versioning:<br />
<br />
<code><br />
<pre><br />
$ cat /etc/resin/resin.properties | grep deploy<br />
<br />
Output:<br />
deploy_versioning : true<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
<br />
$ sudo grep "web-app-deploy" -A 1 /etc/resin/resin.xml <br />
<br />
Output:<br />
<web-app-deploy path="webapps" versioning="${deploy_versioning}"<br />
expand-preserve-fileset="WEB-INF/work/**"/><br />
<br />
</pre><br />
</code><br />
<br />
"if true, use the web-app's numeric suffix as a version"<br />
<br />
Run deploy command passing location of war file.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.war -name blog <br />
<br />
Output:<br />
Deployed production/webapp/default/blog from \<br />
./target/blog-0.1.0.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
To see the deployed you can use resinctl deploy-list<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
<br />
Now undeploy it:<br />
<br />
<code><br />
<pre><br />
$ resinctl undeploy blog<br />
<br />
Output:<br />
Undeployed blog from hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
At this point there should be nothing<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
</pre><br />
</code><br />
<br />
Now deploy it with versioning:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -version 0.1.0 <br />
<br />
Output:<br />
Deployed production/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
</pre><br />
</code><br />
<br />
Blog application is under the version 0.1.0<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog-0.1.0<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
=== Deploying to a staging server ===<br />
<br />
Deploy to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogz -version 0.1.0 -stage staging<br />
<br />
Output<br />
Deployed staging/webapp/default/blogz-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
The staging name is logical. You can call it anything. The app will not be served unless<br />
the server is started with this staging name.<br />
<br />
Showing items deployed to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
production/webapp/default/blog-0.1.0<br />
staging/webapp/default/blogz-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
The /blog works but /blogz does not work because server is by default setup as production server.<br />
<br />
/blog works because server is setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blog<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
/blogz does not work because server is not setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogz<br />
...<br />
HTTP request sent, awaiting response... 404 Not Found<br />
</pre><br />
</code><br />
<br />
To run the server as a staging server do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ resinctl help start<br />
<br />
Output:<br />
usage: bin/resin.sh [-options] start<br />
<br />
where options include:<br />
-conf <file> : select a configuration file<br />
-data-directory <dir> : select a resin-data directory<br />
-join-cluster <cluster> : join a cluster as a dynamic server<br />
-log-directory <dir> : select a logging directory<br />
-resin-home <dir> : select a resin home directory<br />
-root-directory <dir> : select a root directory<br />
-server <id> : select a <server> to run<br />
-watchdog-port <port> : override the watchdog-port<br />
-verbose : print verbose starting information<br />
-preview : run as a preview server<br />
-debug-port <port> : configure a debug port<br />
-jmx-port <port> : configure an unauthenticated jmx port<br />
-stage <staging-name> : The stage the server is serving (default production)<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ sudo resinctl start -stage staging<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
<br />
$ wget localhost:8080/blogz<br />
...<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
<br />
=== Deploying to a preview staging server ===<br />
<br />
<br />
<code><br />
<pre><br />
<br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogp -version 0.1.0 -stage preview<br />
<br />
Output<br />
Deployed preview/webapp/default/blogp-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
$ resinctl deploy-list<br />
<br />
Output<br />
preview/webapp/default/blogp-0.1.0<br />
production/webapp/default/blog-0.1.0<br />
...<br />
</pre><br />
</code><br />
<br />
<br />
Restart the server in preview stage, since preview staging is a common thing, you can just use the -preview command.<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
$ sudo resinctl start -preview<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<br />
Now the preview blog site is available.<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogp<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
== Deploying to a Remote Server ==<br />
<br />
Setup the remote box (Install Resin)<br />
<br />
You need to create a user name and password.<br />
<br />
<code><br />
<pre><br />
REMOTE SERVER $ resinctl generate-password -user rick -password dogbones<br />
<br />
Output:<br />
admin_user : rick<br />
admin_password : {SSHA}JmojvNUU4OpTOw0/SESRsnpEHejxkhZZ<br />
</pre><br />
</code><br />
<br />
<br />
Modify resin.properties<br />
<br />
<code><br />
<pre><br />
<br />
REMOTE SERVER$ cat /etc/resin/resin.properties<br />
<br />
Output:<br />
admin_user : rick<br />
admin_password : {SSHA}JmojvNUU4OpTOw0/SESRsnpEHejxkhZZ<br />
admin_remote_enable : true<br />
...<br />
</pre><br />
</code><br />
<br />
Now from the local server deploy your app as follows:<br />
<br />
<code><br />
<pre><br />
LOCAL SERVER $ resinctl deploy target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogdb \ <br />
-address 192.168.248.168 -port 8080 -user rick -password dogbones<br />
</pre><br />
</code><br />
<br />
You can verify that the deploy worked as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -address 192.168.248.168 -port 8080 -user rick -password dogbones<br />
<br />
Output:<br />
production/webapp/default/blog<br />
...<br />
</pre><br />
</code><br />
<br />
<br />
<br />
== Working with deploy-copy to release, and rollback ==<br />
<br />
<br />
Deploy version to archive.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -stage archive -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
<br />
List versions deployed.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
archive/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
Copy deployment to production<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-copy -source blog -source-stage archive \<br />
-source-version 0.1.0 -target blog<br />
<br />
Output:<br />
copied archive/webapp/default/blog-0.1.0 to production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
archive/webapp/default/blog-0.1.0<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
<br />
When you deploy this way you must start the app as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-start blog<br />
<br />
Output:<br />
'production/webapp/default/blog' is started<br />
</pre><br />
</code><br />
<br />
Then you would deploy copy a different version to rollback or promote a different version to prod.<br />
<br />
In review of the above, we have decided to make the process a bit easier.<br />
<br />
The following section has not yet been implemented, but is slated for 4.0.25.<br />
<br />
<br />
<br />
<br />
== Proposed but not Implemented 4.0.25 Deploy and Rollback==<br />
<br />
<br />
''The following section has not yet been implemented, but is slated for 4.0.25.''<br />
<br />
<br />
Deploy version to archive.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -archive-version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
into production \<br />
</pre><br />
</code><br />
<br />
<br />
List versions deployed with all option.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -all<br />
<br />
Output:<br />
Tag Ver. DD-MM-YYYY-HH:MM:SS<br />
archive/webapp/default/blog-0.1.0 0.1.0 05-12-2011-13:00:00<br />
production/webapp/default/blog 0.1.0 05-12-2011-13:00:00<br />
</pre><br />
</code><br />
<br />
<br />
<br />
Later you decide to update to a new version likely after weeks or months of hard development.<br />
The line marked with production/webapp/default/blog is the /blog that is deployed in the running server.<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.2.0.BUILD-SNAPSHOT.war -name blog -archive_version 0.2.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.2.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
deployed into production.<br />
</pre><br />
</code><br />
<br />
<br />
At this point the following will be deployed:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -all<br />
<br />
Output:<br />
Tag Ver. DD-MM-YYYY-HH:MM:SS<br />
archive/webapp/default/blog-0.1.0 0.1.0 05-12-2011-13:00:00<br />
archive/webapp/default/blog-0.2.0 0.2.0 05-01-2012-11:00:00<br />
production/webapp/default/blog 0.2.0 05-01-2012-11:00:00<br />
</pre><br />
</code><br />
<br />
<br />
Even after rigorous load testing and QA testing, a critical bug was found in 0.2.0 blog and now you need to quickly rollback to a previous version.<br />
<br />
To rollback to a previous version use the '''deploy-archive''' as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-archive blog -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 to hmux://127.0.0.1:6800 \<br />
into production <br />
<br />
</pre><br />
</code><br />
<br />
<br />
<br />
Even after rigorous load testing and QA testing, a critical bug was found in 0.2.0 blog and now you need to quickly rollback to a previous version.<br />
<br />
To rollback to a previous version use the '''deploy-rollback''' as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-rollback blog -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 to hmux://127.0.0.1:6800 \<br />
into production <br />
<br />
</pre><br />
</code><br />
<br />
<br />
<br />
<br />
Even after rigorous load testing and QA testing, a critical bug was found in 0.2.0 blog and now you need to quickly rollback to a previous version.<br />
<br />
To rollback to a previous version use the '''rollback''' as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl rollback blog -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 to hmux://127.0.0.1:6800 \<br />
into production <br />
<br />
</pre><br />
</code><br />
<br />
<br />
<br />
Even after rigorous load testing and QA testing, a critical bug was found in 0.2.0 blog and now you need to quickly rollback to a previous version.<br />
<br />
To rollback to a previous version use the '''deploy-stage''' as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-stage blog -stage archive -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 to hmux://127.0.0.1:6800 \<br />
into production <br />
<br />
</pre><br />
</code><br />
<br />
'''We will need a deploy-stage no matter what for managing preview servers.'''<br />
<br />
NOTE:<br />
I think we go with deploy-rollback and deploy-stage. They do almost the same thing.<br />
Rollback is a bit more self documenting. You use deploy-rollback for rollbacks and you use deploy-stage <br />
for promoting an app to production.<br />
END NOTE:<br />
<br />
<br />
Now after the rollback the deployed servers should look like this.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -all<br />
<br />
Output:<br />
Tag Ver. DD-MM-YYYY-HH:MM:SS<br />
archive/webapp/default/blog-0.1.0 0.1.0 05-12-2011-13:00:00<br />
archive/webapp/default/blog-0.2.0 0.2.0 05-01-2012-11:00:00<br />
production/webapp/default/blog 0.1.0 05-12-2011-13:00:00<br />
</pre><br />
</code><br />
<br />
<br />
Notice that 0.1.0 is now in production.<br />
<br />
<br />
==Promoting an app from preview mode to production==<br />
<br />
Options<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-promote blog <br />
<br />
Output:<br />
Deployed preview/webapp/default/blog to hmux://127.0.0.1:6800 \<br />
into production <br />
<br />
</pre><br />
</code><br />
<br />
Promotes blog that is currently in preview mode into production.</div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-06T21:47:55Z<p>Rickhigh: /* Proposed but not Implemented 4.0.25 Deploy and Rollback */</p>
<hr />
<div># Deploying to a local server<br />
## Deploying to a staging server (locally)<br />
## Deploying to a preview staging server (locally)<br />
# Deploying to a remote server<br />
## Setting up a user and password<br />
## Deploying to a remote server<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
## license-add enabling Resin features<br />
# Deploy to a staging server<br />
## Setting up load balancer to not to deploy to staging server<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
## Installing mysql driver for a web application using config-deploy<br />
## Showing what is in remote config with config-list-ls and config-list-cat<br />
# web-app-deploy settings<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code><br />
<br />
<br />
== Deploying to a local server ==<br />
<br />
Deploy commands available <br />
<br />
<code><br />
<pre><br />
$ resinctl help deploy<br />
<br />
<br />
Output:<br />
usage: bin/resin.sh [-conf <file>] [-server <id>] deploy -user <user> \<br />
-password <password> [options] <war-file><br />
<br />
description:<br />
deploys application specified in a <war-file> to resin server<br />
<br />
options:<br />
-conf <file> : resin configuration file<br />
-server <id> : id of a server<br />
-address <address> : ip or host name of the server<br />
-port <port> : server http port<br />
-user <user> : user name used for authentication to the server<br />
-password <password> : password used for authentication to the server<br />
-host <host> : virtual host to make application available on<br />
-name <name> : name of the context to deploy to, defaults to war-file name<br />
-stage <stage> : stage to deploy application to, defaults to production<br />
-version <version> : version of application formatted as <major.minor.micro.qualifier><br />
-m <message> : commit message<br />
</pre><br />
</code><br />
<br />
Turning on versioning:<br />
<br />
<code><br />
<pre><br />
$ cat /etc/resin/resin.properties | grep deploy<br />
<br />
Output:<br />
deploy_versioning : true<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
<br />
$ sudo grep "web-app-deploy" -A 1 /etc/resin/resin.xml <br />
<br />
Output:<br />
<web-app-deploy path="webapps" versioning="${deploy_versioning}"<br />
expand-preserve-fileset="WEB-INF/work/**"/><br />
<br />
</pre><br />
</code><br />
<br />
"if true, use the web-app's numeric suffix as a version"<br />
<br />
Run deploy command passing location of war file.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.war -name blog <br />
<br />
Output:<br />
Deployed production/webapp/default/blog from \<br />
./target/blog-0.1.0.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
To see the deployed you can use resinctl deploy-list<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
<br />
Now undeploy it:<br />
<br />
<code><br />
<pre><br />
$ resinctl undeploy blog<br />
<br />
Output:<br />
Undeployed blog from hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
At this point there should be nothing<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
</pre><br />
</code><br />
<br />
Now deploy it with versioning:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -version 0.1.0 <br />
<br />
Output:<br />
Deployed production/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
</pre><br />
</code><br />
<br />
Blog application is under the version 0.1.0<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog-0.1.0<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
=== Deploying to a staging server ===<br />
<br />
Deploy to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogz -version 0.1.0 -stage staging<br />
<br />
Output<br />
Deployed staging/webapp/default/blogz-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
The staging name is logical. You can call it anything. The app will not be served unless<br />
the server is started with this staging name.<br />
<br />
Showing items deployed to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
production/webapp/default/blog-0.1.0<br />
staging/webapp/default/blogz-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
The /blog works but /blogz does not work because server is by default setup as production server.<br />
<br />
/blog works because server is setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blog<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
/blogz does not work because server is not setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogz<br />
...<br />
HTTP request sent, awaiting response... 404 Not Found<br />
</pre><br />
</code><br />
<br />
To run the server as a staging server do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ resinctl help start<br />
<br />
Output:<br />
usage: bin/resin.sh [-options] start<br />
<br />
where options include:<br />
-conf <file> : select a configuration file<br />
-data-directory <dir> : select a resin-data directory<br />
-join-cluster <cluster> : join a cluster as a dynamic server<br />
-log-directory <dir> : select a logging directory<br />
-resin-home <dir> : select a resin home directory<br />
-root-directory <dir> : select a root directory<br />
-server <id> : select a <server> to run<br />
-watchdog-port <port> : override the watchdog-port<br />
-verbose : print verbose starting information<br />
-preview : run as a preview server<br />
-debug-port <port> : configure a debug port<br />
-jmx-port <port> : configure an unauthenticated jmx port<br />
-stage <staging-name> : The stage the server is serving (default production)<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ sudo resinctl start -stage staging<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
<br />
$ wget localhost:8080/blogz<br />
...<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
<br />
=== Deploying to a preview staging server ===<br />
<br />
<br />
<code><br />
<pre><br />
<br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogp -version 0.1.0 -stage preview<br />
<br />
Output<br />
Deployed preview/webapp/default/blogp-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
$ resinctl deploy-list<br />
<br />
Output<br />
preview/webapp/default/blogp-0.1.0<br />
production/webapp/default/blog-0.1.0<br />
...<br />
</pre><br />
</code><br />
<br />
<br />
Restart the server in preview stage, since preview staging is a common thing, you can just use the -preview command.<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
$ sudo resinctl start -preview<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<br />
Now the preview blog site is available.<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogp<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
== Deploying to a Remote Server ==<br />
<br />
Setup the remote box (Install Resin)<br />
<br />
You need to create a user name and password.<br />
<br />
<code><br />
<pre><br />
REMOTE SERVER $ resinctl generate-password -user rick -password dogbones<br />
<br />
Output:<br />
admin_user : rick<br />
admin_password : {SSHA}JmojvNUU4OpTOw0/SESRsnpEHejxkhZZ<br />
</pre><br />
</code><br />
<br />
<br />
Modify resin.properties<br />
<br />
<code><br />
<pre><br />
<br />
REMOTE SERVER$ cat /etc/resin/resin.properties<br />
<br />
Output:<br />
admin_user : rick<br />
admin_password : {SSHA}JmojvNUU4OpTOw0/SESRsnpEHejxkhZZ<br />
admin_remote_enable : true<br />
...<br />
</pre><br />
</code><br />
<br />
Now from the local server deploy your app as follows:<br />
<br />
<code><br />
<pre><br />
LOCAL SERVER $ resinctl deploy target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogdb \ <br />
-address 192.168.248.168 -port 8080 -user rick -password dogbones<br />
</pre><br />
</code><br />
<br />
You can verify that the deploy worked as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -address 192.168.248.168 -port 8080 -user rick -password dogbones<br />
<br />
Output:<br />
production/webapp/default/blog<br />
...<br />
</pre><br />
</code><br />
<br />
<br />
<br />
== Working with deploy-copy to release, and rollback ==<br />
<br />
<br />
Deploy version to archive.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -stage archive -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
<br />
List versions deployed.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
archive/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
Copy deployment to production<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-copy -source blog -source-stage archive \<br />
-source-version 0.1.0 -target blog<br />
<br />
Output:<br />
copied archive/webapp/default/blog-0.1.0 to production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
archive/webapp/default/blog-0.1.0<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
<br />
When you deploy this way you must start the app as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-start blog<br />
<br />
Output:<br />
'production/webapp/default/blog' is started<br />
</pre><br />
</code><br />
<br />
Then you would deploy copy a different version to rollback or promote a different version to prod.<br />
<br />
In review of the above, we have decided to make the process a bit easier.<br />
<br />
The following section has not yet been implemented, but is slated for 4.0.25.<br />
<br />
<br />
<br />
<br />
== Proposed but not Implemented 4.0.25 Deploy and Rollback==<br />
<br />
<br />
''The following section has not yet been implemented, but is slated for 4.0.25.''<br />
<br />
<br />
Deploy version to archive.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -archive-version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
into production \<br />
</pre><br />
</code><br />
<br />
<br />
List versions deployed with all option.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -all<br />
<br />
Output:<br />
Tag Ver. DD-MM-YYYY-HH:MM:SS<br />
archive/webapp/default/blog-0.1.0 0.1.0 05-12-2011-13:00:00<br />
production/webapp/default/blog 0.1.0 05-12-2011-13:00:00<br />
</pre><br />
</code><br />
<br />
<br />
<br />
Later you decide to update to a new version likely after weeks or months of hard development.<br />
The line marked with production/webapp/default/blog is the /blog that is deployed in the running server.<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.2.0.BUILD-SNAPSHOT.war -name blog -archive_version 0.2.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.2.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
deployed into production.<br />
</pre><br />
</code><br />
<br />
<br />
At this point the following will be deployed:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -all<br />
<br />
Output:<br />
Tag Ver. DD-MM-YYYY-HH:MM:SS<br />
archive/webapp/default/blog-0.1.0 0.1.0 05-12-2011-13:00:00<br />
archive/webapp/default/blog-0.2.0 0.2.0 05-01-2012-11:00:00<br />
production/webapp/default/blog 0.2.0 05-01-2012-11:00:00<br />
</pre><br />
</code><br />
<br />
<br />
Even after rigorous load testing and QA testing, a critical bug was found and now you need to quickly rollback to a previous version.<br />
<br />
To rollback to a previous version use the '''deploy-archive''' as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-archive blog -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 to hmux://127.0.0.1:6800 \<br />
into production <br />
<br />
</pre><br />
</code><br />
<br />
<br />
<br />
Even after rigorous load testing and QA testing, a critical bug was found and now you need to quickly rollback to a previous version.<br />
<br />
To rollback to a previous version use the '''deploy-rollback''' as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-rollback blog -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 to hmux://127.0.0.1:6800 \<br />
into production <br />
<br />
</pre><br />
</code><br />
<br />
<br />
<br />
<br />
Even after rigorous load testing and QA testing, a critical bug was found and now you need to quickly rollback to a previous version.<br />
<br />
To rollback to a previous version use the '''rollback''' as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl rollback blog -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 to hmux://127.0.0.1:6800 \<br />
into production <br />
<br />
</pre><br />
</code><br />
<br />
<br />
<br />
Even after rigorous load testing and QA testing, a critical bug was found and now you need to quickly rollback to a previous version.<br />
<br />
To rollback to a previous version use the '''deploy-stage''' as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl '''deploy-stage''' -stage archive blog -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 to hmux://127.0.0.1:6800 \<br />
into production <br />
<br />
</pre><br />
</code><br />
<br />
'''We will need a deploy-stage no matter what for managing preview servers.'''</div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-06T20:44:50Z<p>Rickhigh: </p>
<hr />
<div># Deploying to a local server<br />
## Deploying to a staging server (locally)<br />
## Deploying to a preview staging server (locally)<br />
# Deploying to a remote server<br />
## Setting up a user and password<br />
## Deploying to a remote server<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
## license-add enabling Resin features<br />
# Deploy to a staging server<br />
## Setting up load balancer to not to deploy to staging server<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
## Installing mysql driver for a web application using config-deploy<br />
## Showing what is in remote config with config-list-ls and config-list-cat<br />
# web-app-deploy settings<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code><br />
<br />
<br />
== Deploying to a local server ==<br />
<br />
Deploy commands available <br />
<br />
<code><br />
<pre><br />
$ resinctl help deploy<br />
<br />
<br />
Output:<br />
usage: bin/resin.sh [-conf <file>] [-server <id>] deploy -user <user> \<br />
-password <password> [options] <war-file><br />
<br />
description:<br />
deploys application specified in a <war-file> to resin server<br />
<br />
options:<br />
-conf <file> : resin configuration file<br />
-server <id> : id of a server<br />
-address <address> : ip or host name of the server<br />
-port <port> : server http port<br />
-user <user> : user name used for authentication to the server<br />
-password <password> : password used for authentication to the server<br />
-host <host> : virtual host to make application available on<br />
-name <name> : name of the context to deploy to, defaults to war-file name<br />
-stage <stage> : stage to deploy application to, defaults to production<br />
-version <version> : version of application formatted as <major.minor.micro.qualifier><br />
-m <message> : commit message<br />
</pre><br />
</code><br />
<br />
Turning on versioning:<br />
<br />
<code><br />
<pre><br />
$ cat /etc/resin/resin.properties | grep deploy<br />
<br />
Output:<br />
deploy_versioning : true<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
<br />
$ sudo grep "web-app-deploy" -A 1 /etc/resin/resin.xml <br />
<br />
Output:<br />
<web-app-deploy path="webapps" versioning="${deploy_versioning}"<br />
expand-preserve-fileset="WEB-INF/work/**"/><br />
<br />
</pre><br />
</code><br />
<br />
"if true, use the web-app's numeric suffix as a version"<br />
<br />
Run deploy command passing location of war file.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.war -name blog <br />
<br />
Output:<br />
Deployed production/webapp/default/blog from \<br />
./target/blog-0.1.0.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
To see the deployed you can use resinctl deploy-list<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
<br />
Now undeploy it:<br />
<br />
<code><br />
<pre><br />
$ resinctl undeploy blog<br />
<br />
Output:<br />
Undeployed blog from hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
At this point there should be nothing<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
</pre><br />
</code><br />
<br />
Now deploy it with versioning:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -version 0.1.0 <br />
<br />
Output:<br />
Deployed production/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
</pre><br />
</code><br />
<br />
Blog application is under the version 0.1.0<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog-0.1.0<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
=== Deploying to a staging server ===<br />
<br />
Deploy to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogz -version 0.1.0 -stage staging<br />
<br />
Output<br />
Deployed staging/webapp/default/blogz-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
The staging name is logical. You can call it anything. The app will not be served unless<br />
the server is started with this staging name.<br />
<br />
Showing items deployed to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
production/webapp/default/blog-0.1.0<br />
staging/webapp/default/blogz-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
The /blog works but /blogz does not work because server is by default setup as production server.<br />
<br />
/blog works because server is setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blog<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
/blogz does not work because server is not setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogz<br />
...<br />
HTTP request sent, awaiting response... 404 Not Found<br />
</pre><br />
</code><br />
<br />
To run the server as a staging server do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ resinctl help start<br />
<br />
Output:<br />
usage: bin/resin.sh [-options] start<br />
<br />
where options include:<br />
-conf <file> : select a configuration file<br />
-data-directory <dir> : select a resin-data directory<br />
-join-cluster <cluster> : join a cluster as a dynamic server<br />
-log-directory <dir> : select a logging directory<br />
-resin-home <dir> : select a resin home directory<br />
-root-directory <dir> : select a root directory<br />
-server <id> : select a <server> to run<br />
-watchdog-port <port> : override the watchdog-port<br />
-verbose : print verbose starting information<br />
-preview : run as a preview server<br />
-debug-port <port> : configure a debug port<br />
-jmx-port <port> : configure an unauthenticated jmx port<br />
-stage <staging-name> : The stage the server is serving (default production)<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ sudo resinctl start -stage staging<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
<br />
$ wget localhost:8080/blogz<br />
...<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
<br />
=== Deploying to a preview staging server ===<br />
<br />
<br />
<code><br />
<pre><br />
<br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogp -version 0.1.0 -stage preview<br />
<br />
Output<br />
Deployed preview/webapp/default/blogp-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
$ resinctl deploy-list<br />
<br />
Output<br />
preview/webapp/default/blogp-0.1.0<br />
production/webapp/default/blog-0.1.0<br />
...<br />
</pre><br />
</code><br />
<br />
<br />
Restart the server in preview stage, since preview staging is a common thing, you can just use the -preview command.<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
$ sudo resinctl start -preview<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<br />
Now the preview blog site is available.<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogp<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
== Deploying to a Remote Server ==<br />
<br />
Setup the remote box (Install Resin)<br />
<br />
You need to create a user name and password.<br />
<br />
<code><br />
<pre><br />
REMOTE SERVER $ resinctl generate-password -user rick -password dogbones<br />
<br />
Output:<br />
admin_user : rick<br />
admin_password : {SSHA}JmojvNUU4OpTOw0/SESRsnpEHejxkhZZ<br />
</pre><br />
</code><br />
<br />
<br />
Modify resin.properties<br />
<br />
<code><br />
<pre><br />
<br />
REMOTE SERVER$ cat /etc/resin/resin.properties<br />
<br />
Output:<br />
admin_user : rick<br />
admin_password : {SSHA}JmojvNUU4OpTOw0/SESRsnpEHejxkhZZ<br />
admin_remote_enable : true<br />
...<br />
</pre><br />
</code><br />
<br />
Now from the local server deploy your app as follows:<br />
<br />
<code><br />
<pre><br />
LOCAL SERVER $ resinctl deploy target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogdb \ <br />
-address 192.168.248.168 -port 8080 -user rick -password dogbones<br />
</pre><br />
</code><br />
<br />
You can verify that the deploy worked as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -address 192.168.248.168 -port 8080 -user rick -password dogbones<br />
<br />
Output:<br />
production/webapp/default/blog<br />
...<br />
</pre><br />
</code><br />
<br />
<br />
<br />
== Working with deploy-copy to release, and rollback ==<br />
<br />
<br />
Deploy version to archive.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -stage archive -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
<br />
List versions deployed.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
archive/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
Copy deployment to production<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-copy -source blog -source-stage archive \<br />
-source-version 0.1.0 -target blog<br />
<br />
Output:<br />
copied archive/webapp/default/blog-0.1.0 to production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
archive/webapp/default/blog-0.1.0<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
<br />
When you deploy this way you must start the app as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-start blog<br />
<br />
Output:<br />
'production/webapp/default/blog' is started<br />
</pre><br />
</code><br />
<br />
Then you would deploy copy a different version to rollback or promote a different version to prod.<br />
<br />
In review of the above, we have decided to make the process a bit easier.<br />
<br />
The following section has not yet been implemented, but is slated for 4.0.25.<br />
<br />
<br />
<br />
<br />
== Proposed but not Implemented 4.0.25 Deploy and Rollback==<br />
<br />
<br />
''The following section has not yet been implemented, but is slated for 4.0.25.''<br />
<br />
<br />
Deploy version to archive.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -archive-version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
into production \<br />
</pre><br />
</code><br />
<br />
<br />
List versions deployed with all option.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -all<br />
<br />
Output:<br />
Tag Ver. DD-MM-YYYY-HH:MM:SS<br />
archive/webapp/default/blog-0.1.0 0.1.0 05-12-2011-13:00:00<br />
production/webapp/default/blog 0.1.0 05-12-2011-13:00:00<br />
</pre><br />
</code><br />
<br />
<br />
<br />
Later you decide to update to a new version likely after weeks or months of hard development.<br />
The line marked with production/webapp/default/blog is the /blog that is deployed in the running server.<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.2.0.BUILD-SNAPSHOT.war -name blog -archive_version 0.2.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.2.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
deployed into production.<br />
</pre><br />
</code><br />
<br />
<br />
At this point the following will be deployed:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -all<br />
<br />
Output:<br />
Tag Ver. DD-MM-YYYY-HH:MM:SS<br />
archive/webapp/default/blog-0.1.0 0.1.0 05-12-2011-13:00:00<br />
archive/webapp/default/blog-0.2.0 0.2.0 05-01-2012-11:00:00<br />
production/webapp/default/blog 0.2.0 05-01-2012-11:00:00<br />
</pre><br />
</code></div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-06T01:26:33Z<p>Rickhigh: </p>
<hr />
<div># Deploying to a local server<br />
## Deploying to a staging server (locally)<br />
## Deploying to a preview staging server (locally)<br />
# Deploying to a remote server<br />
## Setting up a user and password<br />
## Deploying to a remote server<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
## license-add enabling Resin features<br />
# Deploy to a staging server<br />
## Setting up load balancer to not to deploy to staging server<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
## Installing mysql driver for a web application using config-deploy<br />
## Showing what is in remote config with config-list-ls and config-list-cat<br />
# web-app-deploy settings<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code><br />
<br />
<br />
== Deploying to a local server ==<br />
<br />
Deploy commands available <br />
<br />
<code><br />
<pre><br />
$ resinctl help deploy<br />
<br />
<br />
Output:<br />
usage: bin/resin.sh [-conf <file>] [-server <id>] deploy -user <user> \<br />
-password <password> [options] <war-file><br />
<br />
description:<br />
deploys application specified in a <war-file> to resin server<br />
<br />
options:<br />
-conf <file> : resin configuration file<br />
-server <id> : id of a server<br />
-address <address> : ip or host name of the server<br />
-port <port> : server http port<br />
-user <user> : user name used for authentication to the server<br />
-password <password> : password used for authentication to the server<br />
-host <host> : virtual host to make application available on<br />
-name <name> : name of the context to deploy to, defaults to war-file name<br />
-stage <stage> : stage to deploy application to, defaults to production<br />
-version <version> : version of application formatted as <major.minor.micro.qualifier><br />
-m <message> : commit message<br />
</pre><br />
</code><br />
<br />
Turning on versioning:<br />
<br />
<code><br />
<pre><br />
$ cat /etc/resin/resin.properties | grep deploy<br />
<br />
Output:<br />
deploy_versioning : true<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
<br />
$ sudo grep "web-app-deploy" -A 1 /etc/resin/resin.xml <br />
<br />
Output:<br />
<web-app-deploy path="webapps" versioning="${deploy_versioning}"<br />
expand-preserve-fileset="WEB-INF/work/**"/><br />
<br />
</pre><br />
</code><br />
<br />
"if true, use the web-app's numeric suffix as a version"<br />
<br />
Run deploy command passing location of war file.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.war -name blog <br />
<br />
Output:<br />
Deployed production/webapp/default/blog from \<br />
./target/blog-0.1.0.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
To see the deployed you can use resinctl deploy-list<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
<br />
Now undeploy it:<br />
<br />
<code><br />
<pre><br />
$ resinctl undeploy blog<br />
<br />
Output:<br />
Undeployed blog from hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
At this point there should be nothing<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
</pre><br />
</code><br />
<br />
Now deploy it with versioning:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -version 0.1.0 <br />
<br />
Output:<br />
Deployed production/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
</pre><br />
</code><br />
<br />
Blog application is under the version 0.1.0<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog-0.1.0<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
=== Deploying to a staging server ===<br />
<br />
Deploy to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogz -version 0.1.0 -stage staging<br />
<br />
Output<br />
Deployed staging/webapp/default/blogz-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
The staging name is logical. You can call it anything. The app will not be served unless<br />
the server is started with this staging name.<br />
<br />
Showing items deployed to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
production/webapp/default/blog-0.1.0<br />
staging/webapp/default/blogz-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
The /blog works but /blogz does not work because server is by default setup as production server.<br />
<br />
/blog works because server is setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blog<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
/blogz does not work because server is not setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogz<br />
...<br />
HTTP request sent, awaiting response... 404 Not Found<br />
</pre><br />
</code><br />
<br />
To run the server as a staging server do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ resinctl help start<br />
<br />
Output:<br />
usage: bin/resin.sh [-options] start<br />
<br />
where options include:<br />
-conf <file> : select a configuration file<br />
-data-directory <dir> : select a resin-data directory<br />
-join-cluster <cluster> : join a cluster as a dynamic server<br />
-log-directory <dir> : select a logging directory<br />
-resin-home <dir> : select a resin home directory<br />
-root-directory <dir> : select a root directory<br />
-server <id> : select a <server> to run<br />
-watchdog-port <port> : override the watchdog-port<br />
-verbose : print verbose starting information<br />
-preview : run as a preview server<br />
-debug-port <port> : configure a debug port<br />
-jmx-port <port> : configure an unauthenticated jmx port<br />
-stage <staging-name> : The stage the server is serving (default production)<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ sudo resinctl start -stage staging<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
<br />
$ wget localhost:8080/blogz<br />
...<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
<br />
=== Deploying to a preview staging server ===<br />
<br />
<br />
<code><br />
<pre><br />
<br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogp -version 0.1.0 -stage preview<br />
<br />
Output<br />
Deployed preview/webapp/default/blogp-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
$ resinctl deploy-list<br />
<br />
Output<br />
preview/webapp/default/blogp-0.1.0<br />
production/webapp/default/blog-0.1.0<br />
...<br />
</pre><br />
</code><br />
<br />
<br />
Restart the server in preview stage, since preview staging is a common thing, you can just use the -preview command.<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
$ sudo resinctl start -preview<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<br />
Now the preview blog site is available.<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogp<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
== Deploying to a Remote Server ==<br />
<br />
Setup the remote box (Install Resin)<br />
<br />
You need to create a user name and password.<br />
<br />
<code><br />
<pre><br />
REMOTE SERVER $ resinctl generate-password -user rick -password dogbones<br />
<br />
Output:<br />
admin_user : rick<br />
admin_password : {SSHA}JmojvNUU4OpTOw0/SESRsnpEHejxkhZZ<br />
</pre><br />
</code><br />
<br />
<br />
Modify resin.properties<br />
<br />
<code><br />
<pre><br />
<br />
REMOTE SERVER$ cat /etc/resin/resin.properties<br />
<br />
Output:<br />
admin_user : rick<br />
admin_password : {SSHA}JmojvNUU4OpTOw0/SESRsnpEHejxkhZZ<br />
admin_remote_enable : true<br />
...<br />
</pre><br />
</code><br />
<br />
Now from the local server deploy your app as follows:<br />
<br />
<code><br />
<pre><br />
LOCAL SERVER $ resinctl deploy target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogdb \ <br />
-address 192.168.248.168 -port 8080 -user rick -password dogbones<br />
</pre><br />
</code><br />
<br />
You can verify that the deploy worked as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -address 192.168.248.168 -port 8080 -user rick -password dogbones<br />
<br />
Output:<br />
production/webapp/default/blog<br />
...<br />
</pre><br />
</code><br />
<br />
<br />
<br />
== Working with deploy-copy to release, and rollback ==<br />
<br />
<br />
Deploy version to archive.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -stage archive -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
<br />
List versions deployed.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
archive/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
Copy deployment to production<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-copy -source blog -source-stage archive \<br />
-source-version 0.1.0 -target blog<br />
<br />
Output:<br />
copied archive/webapp/default/blog-0.1.0 to production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
archive/webapp/default/blog-0.1.0<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
<br />
When you deploy this way you must start the app as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-start blog<br />
<br />
Output:<br />
'production/webapp/default/blog' is started<br />
</pre><br />
</code><br />
<br />
== Deploying a new version ==<br />
<br />
== Rolling back a deployment ==</div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-06T01:25:56Z<p>Rickhigh: /* Working with deploy-copy to release, and rollback */</p>
<hr />
<div># Deploying to a local server<br />
## Deploying to a staging server (locally)<br />
## Deploying to a preview staging server (locally)<br />
# Deploying to a remote server<br />
## Setting up a user and password<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
## license-add enabling Resin features<br />
# Deploy to a staging server<br />
## Setting up load balancer to not to deploy to staging server<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
## Installing mysql driver for a web application using config-deploy<br />
## Showing what is in remote config with config-list-ls and config-list-cat<br />
# web-app-deploy settings<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code><br />
<br />
<br />
== Deploying to a local server ==<br />
<br />
Deploy commands available <br />
<br />
<code><br />
<pre><br />
$ resinctl help deploy<br />
<br />
<br />
Output:<br />
usage: bin/resin.sh [-conf <file>] [-server <id>] deploy -user <user> \<br />
-password <password> [options] <war-file><br />
<br />
description:<br />
deploys application specified in a <war-file> to resin server<br />
<br />
options:<br />
-conf <file> : resin configuration file<br />
-server <id> : id of a server<br />
-address <address> : ip or host name of the server<br />
-port <port> : server http port<br />
-user <user> : user name used for authentication to the server<br />
-password <password> : password used for authentication to the server<br />
-host <host> : virtual host to make application available on<br />
-name <name> : name of the context to deploy to, defaults to war-file name<br />
-stage <stage> : stage to deploy application to, defaults to production<br />
-version <version> : version of application formatted as <major.minor.micro.qualifier><br />
-m <message> : commit message<br />
</pre><br />
</code><br />
<br />
Turning on versioning:<br />
<br />
<code><br />
<pre><br />
$ cat /etc/resin/resin.properties | grep deploy<br />
<br />
Output:<br />
deploy_versioning : true<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
<br />
$ sudo grep "web-app-deploy" -A 1 /etc/resin/resin.xml <br />
<br />
Output:<br />
<web-app-deploy path="webapps" versioning="${deploy_versioning}"<br />
expand-preserve-fileset="WEB-INF/work/**"/><br />
<br />
</pre><br />
</code><br />
<br />
"if true, use the web-app's numeric suffix as a version"<br />
<br />
Run deploy command passing location of war file.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.war -name blog <br />
<br />
Output:<br />
Deployed production/webapp/default/blog from \<br />
./target/blog-0.1.0.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
To see the deployed you can use resinctl deploy-list<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
<br />
Now undeploy it:<br />
<br />
<code><br />
<pre><br />
$ resinctl undeploy blog<br />
<br />
Output:<br />
Undeployed blog from hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
At this point there should be nothing<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
</pre><br />
</code><br />
<br />
Now deploy it with versioning:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -version 0.1.0 <br />
<br />
Output:<br />
Deployed production/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
</pre><br />
</code><br />
<br />
Blog application is under the version 0.1.0<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog-0.1.0<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
=== Deploying to a staging server ===<br />
<br />
Deploy to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogz -version 0.1.0 -stage staging<br />
<br />
Output<br />
Deployed staging/webapp/default/blogz-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
The staging name is logical. You can call it anything. The app will not be served unless<br />
the server is started with this staging name.<br />
<br />
Showing items deployed to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
production/webapp/default/blog-0.1.0<br />
staging/webapp/default/blogz-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
The /blog works but /blogz does not work because server is by default setup as production server.<br />
<br />
/blog works because server is setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blog<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
/blogz does not work because server is not setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogz<br />
...<br />
HTTP request sent, awaiting response... 404 Not Found<br />
</pre><br />
</code><br />
<br />
To run the server as a staging server do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ resinctl help start<br />
<br />
Output:<br />
usage: bin/resin.sh [-options] start<br />
<br />
where options include:<br />
-conf <file> : select a configuration file<br />
-data-directory <dir> : select a resin-data directory<br />
-join-cluster <cluster> : join a cluster as a dynamic server<br />
-log-directory <dir> : select a logging directory<br />
-resin-home <dir> : select a resin home directory<br />
-root-directory <dir> : select a root directory<br />
-server <id> : select a <server> to run<br />
-watchdog-port <port> : override the watchdog-port<br />
-verbose : print verbose starting information<br />
-preview : run as a preview server<br />
-debug-port <port> : configure a debug port<br />
-jmx-port <port> : configure an unauthenticated jmx port<br />
-stage <staging-name> : The stage the server is serving (default production)<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ sudo resinctl start -stage staging<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
<br />
$ wget localhost:8080/blogz<br />
...<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
<br />
=== Deploying to a preview staging server ===<br />
<br />
<br />
<code><br />
<pre><br />
<br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogp -version 0.1.0 -stage preview<br />
<br />
Output<br />
Deployed preview/webapp/default/blogp-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
$ resinctl deploy-list<br />
<br />
Output<br />
preview/webapp/default/blogp-0.1.0<br />
production/webapp/default/blog-0.1.0<br />
...<br />
</pre><br />
</code><br />
<br />
<br />
Restart the server in preview stage, since preview staging is a common thing, you can just use the -preview command.<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
$ sudo resinctl start -preview<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<br />
Now the preview blog site is available.<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogp<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
== Deploying to a Remote Server ==<br />
<br />
Setup the remote box (Install Resin)<br />
<br />
You need to create a user name and password.<br />
<br />
<code><br />
<pre><br />
REMOTE SERVER $ resinctl generate-password -user rick -password dogbones<br />
<br />
Output:<br />
admin_user : rick<br />
admin_password : {SSHA}JmojvNUU4OpTOw0/SESRsnpEHejxkhZZ<br />
</pre><br />
</code><br />
<br />
<br />
Modify resin.properties<br />
<br />
<code><br />
<pre><br />
<br />
REMOTE SERVER$ cat /etc/resin/resin.properties<br />
<br />
Output:<br />
admin_user : rick<br />
admin_password : {SSHA}JmojvNUU4OpTOw0/SESRsnpEHejxkhZZ<br />
admin_remote_enable : true<br />
...<br />
</pre><br />
</code><br />
<br />
Now from the local server deploy your app as follows:<br />
<br />
<code><br />
<pre><br />
LOCAL SERVER $ resinctl deploy target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogdb \ <br />
-address 192.168.248.168 -port 8080 -user rick -password dogbones<br />
</pre><br />
</code><br />
<br />
You can verify that the deploy worked as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -address 192.168.248.168 -port 8080 -user rick -password dogbones<br />
<br />
Output:<br />
production/webapp/default/blog<br />
...<br />
</pre><br />
</code><br />
<br />
<br />
<br />
== Working with deploy-copy to release, and rollback ==<br />
<br />
<br />
Deploy version to archive.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -stage archive -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
<br />
List versions deployed.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
archive/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
Copy deployment to production<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-copy -source blog -source-stage archive \<br />
-source-version 0.1.0 -target blog<br />
<br />
Output:<br />
copied archive/webapp/default/blog-0.1.0 to production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
archive/webapp/default/blog-0.1.0<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
<br />
When you deploy this way you must start the app as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-start blog<br />
<br />
Output:<br />
'production/webapp/default/blog' is started<br />
</pre><br />
</code><br />
<br />
== Deploying a new version ==<br />
<br />
== Rolling back a deployment ==</div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-06T01:24:51Z<p>Rickhigh: /* Working with deploy-copy to release, and rollback */</p>
<hr />
<div># Deploying to a local server<br />
## Deploying to a staging server (locally)<br />
## Deploying to a preview staging server (locally)<br />
# Deploying to a remote server<br />
## Setting up a user and password<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
## license-add enabling Resin features<br />
# Deploy to a staging server<br />
## Setting up load balancer to not to deploy to staging server<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
## Installing mysql driver for a web application using config-deploy<br />
## Showing what is in remote config with config-list-ls and config-list-cat<br />
# web-app-deploy settings<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code><br />
<br />
<br />
== Deploying to a local server ==<br />
<br />
Deploy commands available <br />
<br />
<code><br />
<pre><br />
$ resinctl help deploy<br />
<br />
<br />
Output:<br />
usage: bin/resin.sh [-conf <file>] [-server <id>] deploy -user <user> \<br />
-password <password> [options] <war-file><br />
<br />
description:<br />
deploys application specified in a <war-file> to resin server<br />
<br />
options:<br />
-conf <file> : resin configuration file<br />
-server <id> : id of a server<br />
-address <address> : ip or host name of the server<br />
-port <port> : server http port<br />
-user <user> : user name used for authentication to the server<br />
-password <password> : password used for authentication to the server<br />
-host <host> : virtual host to make application available on<br />
-name <name> : name of the context to deploy to, defaults to war-file name<br />
-stage <stage> : stage to deploy application to, defaults to production<br />
-version <version> : version of application formatted as <major.minor.micro.qualifier><br />
-m <message> : commit message<br />
</pre><br />
</code><br />
<br />
Turning on versioning:<br />
<br />
<code><br />
<pre><br />
$ cat /etc/resin/resin.properties | grep deploy<br />
<br />
Output:<br />
deploy_versioning : true<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
<br />
$ sudo grep "web-app-deploy" -A 1 /etc/resin/resin.xml <br />
<br />
Output:<br />
<web-app-deploy path="webapps" versioning="${deploy_versioning}"<br />
expand-preserve-fileset="WEB-INF/work/**"/><br />
<br />
</pre><br />
</code><br />
<br />
"if true, use the web-app's numeric suffix as a version"<br />
<br />
Run deploy command passing location of war file.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.war -name blog <br />
<br />
Output:<br />
Deployed production/webapp/default/blog from \<br />
./target/blog-0.1.0.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
To see the deployed you can use resinctl deploy-list<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
<br />
Now undeploy it:<br />
<br />
<code><br />
<pre><br />
$ resinctl undeploy blog<br />
<br />
Output:<br />
Undeployed blog from hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
At this point there should be nothing<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
</pre><br />
</code><br />
<br />
Now deploy it with versioning:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -version 0.1.0 <br />
<br />
Output:<br />
Deployed production/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
</pre><br />
</code><br />
<br />
Blog application is under the version 0.1.0<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog-0.1.0<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
=== Deploying to a staging server ===<br />
<br />
Deploy to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogz -version 0.1.0 -stage staging<br />
<br />
Output<br />
Deployed staging/webapp/default/blogz-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
The staging name is logical. You can call it anything. The app will not be served unless<br />
the server is started with this staging name.<br />
<br />
Showing items deployed to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
production/webapp/default/blog-0.1.0<br />
staging/webapp/default/blogz-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
The /blog works but /blogz does not work because server is by default setup as production server.<br />
<br />
/blog works because server is setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blog<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
/blogz does not work because server is not setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogz<br />
...<br />
HTTP request sent, awaiting response... 404 Not Found<br />
</pre><br />
</code><br />
<br />
To run the server as a staging server do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ resinctl help start<br />
<br />
Output:<br />
usage: bin/resin.sh [-options] start<br />
<br />
where options include:<br />
-conf <file> : select a configuration file<br />
-data-directory <dir> : select a resin-data directory<br />
-join-cluster <cluster> : join a cluster as a dynamic server<br />
-log-directory <dir> : select a logging directory<br />
-resin-home <dir> : select a resin home directory<br />
-root-directory <dir> : select a root directory<br />
-server <id> : select a <server> to run<br />
-watchdog-port <port> : override the watchdog-port<br />
-verbose : print verbose starting information<br />
-preview : run as a preview server<br />
-debug-port <port> : configure a debug port<br />
-jmx-port <port> : configure an unauthenticated jmx port<br />
-stage <staging-name> : The stage the server is serving (default production)<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ sudo resinctl start -stage staging<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
<br />
$ wget localhost:8080/blogz<br />
...<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
<br />
=== Deploying to a preview staging server ===<br />
<br />
<br />
<code><br />
<pre><br />
<br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogp -version 0.1.0 -stage preview<br />
<br />
Output<br />
Deployed preview/webapp/default/blogp-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
$ resinctl deploy-list<br />
<br />
Output<br />
preview/webapp/default/blogp-0.1.0<br />
production/webapp/default/blog-0.1.0<br />
...<br />
</pre><br />
</code><br />
<br />
<br />
Restart the server in preview stage, since preview staging is a common thing, you can just use the -preview command.<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
$ sudo resinctl start -preview<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<br />
Now the preview blog site is available.<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogp<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
== Deploying to a Remote Server ==<br />
<br />
Setup the remote box (Install Resin)<br />
<br />
You need to create a user name and password.<br />
<br />
<code><br />
<pre><br />
REMOTE SERVER $ resinctl generate-password -user rick -password dogbones<br />
<br />
Output:<br />
admin_user : rick<br />
admin_password : {SSHA}JmojvNUU4OpTOw0/SESRsnpEHejxkhZZ<br />
</pre><br />
</code><br />
<br />
<br />
Modify resin.properties<br />
<br />
<code><br />
<pre><br />
<br />
REMOTE SERVER$ cat /etc/resin/resin.properties<br />
<br />
Output:<br />
admin_user : rick<br />
admin_password : {SSHA}JmojvNUU4OpTOw0/SESRsnpEHejxkhZZ<br />
admin_remote_enable : true<br />
...<br />
</pre><br />
</code><br />
<br />
Now from the local server deploy your app as follows:<br />
<br />
<code><br />
<pre><br />
LOCAL SERVER $ resinctl deploy target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogdb \ <br />
-address 192.168.248.168 -port 8080 -user rick -password dogbones<br />
</pre><br />
</code><br />
<br />
You can verify that the deploy worked as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -address 192.168.248.168 -port 8080 -user rick -password dogbones<br />
<br />
Output:<br />
production/webapp/default/blog<br />
...<br />
</pre><br />
</code><br />
<br />
<br />
<br />
== Working with deploy-copy to release, and rollback ==<br />
<br />
<br />
Deploy version to archive.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -stage archive -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
<br />
List versions deployed.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
archive/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
Copy deployment to production<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-copy -source blog -source-stage archive \<br />
-source-version 0.1.0 -target blog<br />
<br />
Output:<br />
copied archive/webapp/default/blog-0.1.0 to production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
archive/webapp/default/blog-0.1.0<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
<br />
When you deploy this way you must start the app as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-start blog<br />
<br />
Output:<br />
'production/webapp/default/blog' is started<br />
</pre><br />
</code></div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-06T01:21:35Z<p>Rickhigh: /* Deploying to a Remote Server */</p>
<hr />
<div># Deploying to a local server<br />
## Deploying to a staging server (locally)<br />
## Deploying to a preview staging server (locally)<br />
# Deploying to a remote server<br />
## Setting up a user and password<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
## license-add enabling Resin features<br />
# Deploy to a staging server<br />
## Setting up load balancer to not to deploy to staging server<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
## Installing mysql driver for a web application using config-deploy<br />
## Showing what is in remote config with config-list-ls and config-list-cat<br />
# web-app-deploy settings<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code><br />
<br />
<br />
== Deploying to a local server ==<br />
<br />
Deploy commands available <br />
<br />
<code><br />
<pre><br />
$ resinctl help deploy<br />
<br />
<br />
Output:<br />
usage: bin/resin.sh [-conf <file>] [-server <id>] deploy -user <user> \<br />
-password <password> [options] <war-file><br />
<br />
description:<br />
deploys application specified in a <war-file> to resin server<br />
<br />
options:<br />
-conf <file> : resin configuration file<br />
-server <id> : id of a server<br />
-address <address> : ip or host name of the server<br />
-port <port> : server http port<br />
-user <user> : user name used for authentication to the server<br />
-password <password> : password used for authentication to the server<br />
-host <host> : virtual host to make application available on<br />
-name <name> : name of the context to deploy to, defaults to war-file name<br />
-stage <stage> : stage to deploy application to, defaults to production<br />
-version <version> : version of application formatted as <major.minor.micro.qualifier><br />
-m <message> : commit message<br />
</pre><br />
</code><br />
<br />
Turning on versioning:<br />
<br />
<code><br />
<pre><br />
$ cat /etc/resin/resin.properties | grep deploy<br />
<br />
Output:<br />
deploy_versioning : true<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
<br />
$ sudo grep "web-app-deploy" -A 1 /etc/resin/resin.xml <br />
<br />
Output:<br />
<web-app-deploy path="webapps" versioning="${deploy_versioning}"<br />
expand-preserve-fileset="WEB-INF/work/**"/><br />
<br />
</pre><br />
</code><br />
<br />
"if true, use the web-app's numeric suffix as a version"<br />
<br />
Run deploy command passing location of war file.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.war -name blog <br />
<br />
Output:<br />
Deployed production/webapp/default/blog from \<br />
./target/blog-0.1.0.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
To see the deployed you can use resinctl deploy-list<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
<br />
Now undeploy it:<br />
<br />
<code><br />
<pre><br />
$ resinctl undeploy blog<br />
<br />
Output:<br />
Undeployed blog from hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
At this point there should be nothing<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
</pre><br />
</code><br />
<br />
Now deploy it with versioning:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -version 0.1.0 <br />
<br />
Output:<br />
Deployed production/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
</pre><br />
</code><br />
<br />
Blog application is under the version 0.1.0<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog-0.1.0<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
=== Deploying to a staging server ===<br />
<br />
Deploy to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogz -version 0.1.0 -stage staging<br />
<br />
Output<br />
Deployed staging/webapp/default/blogz-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
The staging name is logical. You can call it anything. The app will not be served unless<br />
the server is started with this staging name.<br />
<br />
Showing items deployed to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
production/webapp/default/blog-0.1.0<br />
staging/webapp/default/blogz-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
The /blog works but /blogz does not work because server is by default setup as production server.<br />
<br />
/blog works because server is setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blog<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
/blogz does not work because server is not setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogz<br />
...<br />
HTTP request sent, awaiting response... 404 Not Found<br />
</pre><br />
</code><br />
<br />
To run the server as a staging server do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ resinctl help start<br />
<br />
Output:<br />
usage: bin/resin.sh [-options] start<br />
<br />
where options include:<br />
-conf <file> : select a configuration file<br />
-data-directory <dir> : select a resin-data directory<br />
-join-cluster <cluster> : join a cluster as a dynamic server<br />
-log-directory <dir> : select a logging directory<br />
-resin-home <dir> : select a resin home directory<br />
-root-directory <dir> : select a root directory<br />
-server <id> : select a <server> to run<br />
-watchdog-port <port> : override the watchdog-port<br />
-verbose : print verbose starting information<br />
-preview : run as a preview server<br />
-debug-port <port> : configure a debug port<br />
-jmx-port <port> : configure an unauthenticated jmx port<br />
-stage <staging-name> : The stage the server is serving (default production)<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ sudo resinctl start -stage staging<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
<br />
$ wget localhost:8080/blogz<br />
...<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
<br />
=== Deploying to a preview staging server ===<br />
<br />
<br />
<code><br />
<pre><br />
<br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogp -version 0.1.0 -stage preview<br />
<br />
Output<br />
Deployed preview/webapp/default/blogp-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
$ resinctl deploy-list<br />
<br />
Output<br />
preview/webapp/default/blogp-0.1.0<br />
production/webapp/default/blog-0.1.0<br />
...<br />
</pre><br />
</code><br />
<br />
<br />
Restart the server in preview stage, since preview staging is a common thing, you can just use the -preview command.<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
$ sudo resinctl start -preview<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<br />
Now the preview blog site is available.<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogp<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
== Deploying to a Remote Server ==<br />
<br />
Setup the remote box (Install Resin)<br />
<br />
You need to create a user name and password.<br />
<br />
<code><br />
<pre><br />
REMOTE SERVER $ resinctl generate-password -user rick -password dogbones<br />
<br />
Output:<br />
admin_user : rick<br />
admin_password : {SSHA}JmojvNUU4OpTOw0/SESRsnpEHejxkhZZ<br />
</pre><br />
</code><br />
<br />
<br />
Modify resin.properties<br />
<br />
<code><br />
<pre><br />
<br />
REMOTE SERVER$ cat /etc/resin/resin.properties<br />
<br />
Output:<br />
admin_user : rick<br />
admin_password : {SSHA}JmojvNUU4OpTOw0/SESRsnpEHejxkhZZ<br />
admin_remote_enable : true<br />
...<br />
</pre><br />
</code><br />
<br />
Now from the local server deploy your app as follows:<br />
<br />
<code><br />
<pre><br />
LOCAL SERVER $ resinctl deploy target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogdb \ <br />
-address 192.168.248.168 -port 8080 -user rick -password dogbones<br />
</pre><br />
</code><br />
<br />
You can verify that the deploy worked as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -address 192.168.248.168 -port 8080 -user rick -password dogbones<br />
<br />
Output:<br />
production/webapp/default/blog<br />
...<br />
</pre><br />
</code><br />
<br />
<br />
<br />
== Working with deploy-copy to release, and rollback ==<br />
<br />
<br />
Deploy version to archive.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -stage archive -version 0.1.0<br />
<br />
Output:<br />
Deployed archive/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
<br />
List versions deployed.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
archive/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
Copy deployment to production<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-copy -source blog -source-stage archive \<br />
-source-version 0.1.0 -target blog<br />
<br />
Output:<br />
copied archive/webapp/default/blog-0.1.0 to production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
archive/webapp/default/blog-0.1.0<br />
production/webapp/default/blog<br />
</pre><br />
</code></div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-06T00:53:51Z<p>Rickhigh: /* Deploying to a Remote Server */</p>
<hr />
<div># Deploying to a local server<br />
## Deploying to a staging server (locally)<br />
## Deploying to a preview staging server (locally)<br />
# Deploying to a remote server<br />
## Setting up a user and password<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
## license-add enabling Resin features<br />
# Deploy to a staging server<br />
## Setting up load balancer to not to deploy to staging server<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
## Installing mysql driver for a web application using config-deploy<br />
## Showing what is in remote config with config-list-ls and config-list-cat<br />
# web-app-deploy settings<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code><br />
<br />
<br />
== Deploying to a local server ==<br />
<br />
Deploy commands available <br />
<br />
<code><br />
<pre><br />
$ resinctl help deploy<br />
<br />
<br />
Output:<br />
usage: bin/resin.sh [-conf <file>] [-server <id>] deploy -user <user> \<br />
-password <password> [options] <war-file><br />
<br />
description:<br />
deploys application specified in a <war-file> to resin server<br />
<br />
options:<br />
-conf <file> : resin configuration file<br />
-server <id> : id of a server<br />
-address <address> : ip or host name of the server<br />
-port <port> : server http port<br />
-user <user> : user name used for authentication to the server<br />
-password <password> : password used for authentication to the server<br />
-host <host> : virtual host to make application available on<br />
-name <name> : name of the context to deploy to, defaults to war-file name<br />
-stage <stage> : stage to deploy application to, defaults to production<br />
-version <version> : version of application formatted as <major.minor.micro.qualifier><br />
-m <message> : commit message<br />
</pre><br />
</code><br />
<br />
Turning on versioning:<br />
<br />
<code><br />
<pre><br />
$ cat /etc/resin/resin.properties | grep deploy<br />
<br />
Output:<br />
deploy_versioning : true<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
<br />
$ sudo grep "web-app-deploy" -A 1 /etc/resin/resin.xml <br />
<br />
Output:<br />
<web-app-deploy path="webapps" versioning="${deploy_versioning}"<br />
expand-preserve-fileset="WEB-INF/work/**"/><br />
<br />
</pre><br />
</code><br />
<br />
"if true, use the web-app's numeric suffix as a version"<br />
<br />
Run deploy command passing location of war file.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.war -name blog <br />
<br />
Output:<br />
Deployed production/webapp/default/blog from \<br />
./target/blog-0.1.0.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
To see the deployed you can use resinctl deploy-list<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
<br />
Now undeploy it:<br />
<br />
<code><br />
<pre><br />
$ resinctl undeploy blog<br />
<br />
Output:<br />
Undeployed blog from hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
At this point there should be nothing<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
</pre><br />
</code><br />
<br />
Now deploy it with versioning:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -version 0.1.0 <br />
<br />
Output:<br />
Deployed production/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
</pre><br />
</code><br />
<br />
Blog application is under the version 0.1.0<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog-0.1.0<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
=== Deploying to a staging server ===<br />
<br />
Deploy to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogz -version 0.1.0 -stage staging<br />
<br />
Output<br />
Deployed staging/webapp/default/blogz-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
The staging name is logical. You can call it anything. The app will not be served unless<br />
the server is started with this staging name.<br />
<br />
Showing items deployed to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
production/webapp/default/blog-0.1.0<br />
staging/webapp/default/blogz-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
The /blog works but /blogz does not work because server is by default setup as production server.<br />
<br />
/blog works because server is setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blog<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
/blogz does not work because server is not setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogz<br />
...<br />
HTTP request sent, awaiting response... 404 Not Found<br />
</pre><br />
</code><br />
<br />
To run the server as a staging server do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ resinctl help start<br />
<br />
Output:<br />
usage: bin/resin.sh [-options] start<br />
<br />
where options include:<br />
-conf <file> : select a configuration file<br />
-data-directory <dir> : select a resin-data directory<br />
-join-cluster <cluster> : join a cluster as a dynamic server<br />
-log-directory <dir> : select a logging directory<br />
-resin-home <dir> : select a resin home directory<br />
-root-directory <dir> : select a root directory<br />
-server <id> : select a <server> to run<br />
-watchdog-port <port> : override the watchdog-port<br />
-verbose : print verbose starting information<br />
-preview : run as a preview server<br />
-debug-port <port> : configure a debug port<br />
-jmx-port <port> : configure an unauthenticated jmx port<br />
-stage <staging-name> : The stage the server is serving (default production)<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ sudo resinctl start -stage staging<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
<br />
$ wget localhost:8080/blogz<br />
...<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
<br />
=== Deploying to a preview staging server ===<br />
<br />
<br />
<code><br />
<pre><br />
<br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogp -version 0.1.0 -stage preview<br />
<br />
Output<br />
Deployed preview/webapp/default/blogp-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
$ resinctl deploy-list<br />
<br />
Output<br />
preview/webapp/default/blogp-0.1.0<br />
production/webapp/default/blog-0.1.0<br />
...<br />
</pre><br />
</code><br />
<br />
<br />
Restart the server in preview stage, since preview staging is a common thing, you can just use the -preview command.<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
$ sudo resinctl start -preview<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<br />
Now the preview blog site is available.<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogp<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
== Deploying to a Remote Server ==<br />
<br />
Setup the remote box (Install Resin)<br />
<br />
You need to create a user name and password.<br />
<br />
<code><br />
<pre><br />
REMOTE SERVER $ resinctl generate-password -user rick -password dogbones<br />
<br />
Output:<br />
admin_user : rick<br />
admin_password : {SSHA}JmojvNUU4OpTOw0/SESRsnpEHejxkhZZ<br />
</pre><br />
</code><br />
<br />
<br />
Modify resin.properties<br />
<br />
<code><br />
<pre><br />
<br />
REMOTE SERVER$ cat /etc/resin/resin.properties<br />
<br />
Output:<br />
admin_user : rick<br />
admin_password : {SSHA}JmojvNUU4OpTOw0/SESRsnpEHejxkhZZ<br />
admin_remote_enable : true<br />
...<br />
</pre><br />
</code><br />
<br />
Now from the local server deploy your app as follows:<br />
<br />
<code><br />
<pre><br />
LOCAL SERVER $ resinctl deploy target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogdb \ <br />
-address 192.168.248.168 -port 8080 -user rick -password dogbones<br />
</pre><br />
</code><br />
<br />
You can verify that the deploy worked as follows:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list -address 192.168.248.168 -port 8080 -user rick -password dogbones<br />
<br />
Output:<br />
production/webapp/default/blog<br />
...<br />
</pre><br />
</code></div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-06T00:41:38Z<p>Rickhigh: /* Deploying to a Remote Server */</p>
<hr />
<div># Deploying to a local server<br />
## Deploying to a staging server (locally)<br />
## Deploying to a preview staging server (locally)<br />
# Deploying to a remote server<br />
## Setting up a user and password<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
## license-add enabling Resin features<br />
# Deploy to a staging server<br />
## Setting up load balancer to not to deploy to staging server<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
## Installing mysql driver for a web application using config-deploy<br />
## Showing what is in remote config with config-list-ls and config-list-cat<br />
# web-app-deploy settings<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code><br />
<br />
<br />
== Deploying to a local server ==<br />
<br />
Deploy commands available <br />
<br />
<code><br />
<pre><br />
$ resinctl help deploy<br />
<br />
<br />
Output:<br />
usage: bin/resin.sh [-conf <file>] [-server <id>] deploy -user <user> \<br />
-password <password> [options] <war-file><br />
<br />
description:<br />
deploys application specified in a <war-file> to resin server<br />
<br />
options:<br />
-conf <file> : resin configuration file<br />
-server <id> : id of a server<br />
-address <address> : ip or host name of the server<br />
-port <port> : server http port<br />
-user <user> : user name used for authentication to the server<br />
-password <password> : password used for authentication to the server<br />
-host <host> : virtual host to make application available on<br />
-name <name> : name of the context to deploy to, defaults to war-file name<br />
-stage <stage> : stage to deploy application to, defaults to production<br />
-version <version> : version of application formatted as <major.minor.micro.qualifier><br />
-m <message> : commit message<br />
</pre><br />
</code><br />
<br />
Turning on versioning:<br />
<br />
<code><br />
<pre><br />
$ cat /etc/resin/resin.properties | grep deploy<br />
<br />
Output:<br />
deploy_versioning : true<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
<br />
$ sudo grep "web-app-deploy" -A 1 /etc/resin/resin.xml <br />
<br />
Output:<br />
<web-app-deploy path="webapps" versioning="${deploy_versioning}"<br />
expand-preserve-fileset="WEB-INF/work/**"/><br />
<br />
</pre><br />
</code><br />
<br />
"if true, use the web-app's numeric suffix as a version"<br />
<br />
Run deploy command passing location of war file.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.war -name blog <br />
<br />
Output:<br />
Deployed production/webapp/default/blog from \<br />
./target/blog-0.1.0.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
To see the deployed you can use resinctl deploy-list<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
<br />
Now undeploy it:<br />
<br />
<code><br />
<pre><br />
$ resinctl undeploy blog<br />
<br />
Output:<br />
Undeployed blog from hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
At this point there should be nothing<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
</pre><br />
</code><br />
<br />
Now deploy it with versioning:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -version 0.1.0 <br />
<br />
Output:<br />
Deployed production/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
</pre><br />
</code><br />
<br />
Blog application is under the version 0.1.0<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog-0.1.0<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
=== Deploying to a staging server ===<br />
<br />
Deploy to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogz -version 0.1.0 -stage staging<br />
<br />
Output<br />
Deployed staging/webapp/default/blogz-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
The staging name is logical. You can call it anything. The app will not be served unless<br />
the server is started with this staging name.<br />
<br />
Showing items deployed to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
production/webapp/default/blog-0.1.0<br />
staging/webapp/default/blogz-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
The /blog works but /blogz does not work because server is by default setup as production server.<br />
<br />
/blog works because server is setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blog<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
/blogz does not work because server is not setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogz<br />
...<br />
HTTP request sent, awaiting response... 404 Not Found<br />
</pre><br />
</code><br />
<br />
To run the server as a staging server do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ resinctl help start<br />
<br />
Output:<br />
usage: bin/resin.sh [-options] start<br />
<br />
where options include:<br />
-conf <file> : select a configuration file<br />
-data-directory <dir> : select a resin-data directory<br />
-join-cluster <cluster> : join a cluster as a dynamic server<br />
-log-directory <dir> : select a logging directory<br />
-resin-home <dir> : select a resin home directory<br />
-root-directory <dir> : select a root directory<br />
-server <id> : select a <server> to run<br />
-watchdog-port <port> : override the watchdog-port<br />
-verbose : print verbose starting information<br />
-preview : run as a preview server<br />
-debug-port <port> : configure a debug port<br />
-jmx-port <port> : configure an unauthenticated jmx port<br />
-stage <staging-name> : The stage the server is serving (default production)<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ sudo resinctl start -stage staging<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
<br />
$ wget localhost:8080/blogz<br />
...<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
<br />
=== Deploying to a preview staging server ===<br />
<br />
<br />
<code><br />
<pre><br />
<br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogp -version 0.1.0 -stage preview<br />
<br />
Output<br />
Deployed preview/webapp/default/blogp-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
$ resinctl deploy-list<br />
<br />
Output<br />
preview/webapp/default/blogp-0.1.0<br />
production/webapp/default/blog-0.1.0<br />
...<br />
</pre><br />
</code><br />
<br />
<br />
Restart the server in preview stage, since preview staging is a common thing, you can just use the -preview command.<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
$ sudo resinctl start -preview<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<br />
Now the preview blog site is available.<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogp<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
== Deploying to a Remote Server ==</div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-06T00:41:15Z<p>Rickhigh: /* Deploying to a preview staging server */</p>
<hr />
<div># Deploying to a local server<br />
## Deploying to a staging server (locally)<br />
## Deploying to a preview staging server (locally)<br />
# Deploying to a remote server<br />
## Setting up a user and password<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
## license-add enabling Resin features<br />
# Deploy to a staging server<br />
## Setting up load balancer to not to deploy to staging server<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
## Installing mysql driver for a web application using config-deploy<br />
## Showing what is in remote config with config-list-ls and config-list-cat<br />
# web-app-deploy settings<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code><br />
<br />
<br />
== Deploying to a local server ==<br />
<br />
Deploy commands available <br />
<br />
<code><br />
<pre><br />
$ resinctl help deploy<br />
<br />
<br />
Output:<br />
usage: bin/resin.sh [-conf <file>] [-server <id>] deploy -user <user> \<br />
-password <password> [options] <war-file><br />
<br />
description:<br />
deploys application specified in a <war-file> to resin server<br />
<br />
options:<br />
-conf <file> : resin configuration file<br />
-server <id> : id of a server<br />
-address <address> : ip or host name of the server<br />
-port <port> : server http port<br />
-user <user> : user name used for authentication to the server<br />
-password <password> : password used for authentication to the server<br />
-host <host> : virtual host to make application available on<br />
-name <name> : name of the context to deploy to, defaults to war-file name<br />
-stage <stage> : stage to deploy application to, defaults to production<br />
-version <version> : version of application formatted as <major.minor.micro.qualifier><br />
-m <message> : commit message<br />
</pre><br />
</code><br />
<br />
Turning on versioning:<br />
<br />
<code><br />
<pre><br />
$ cat /etc/resin/resin.properties | grep deploy<br />
<br />
Output:<br />
deploy_versioning : true<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
<br />
$ sudo grep "web-app-deploy" -A 1 /etc/resin/resin.xml <br />
<br />
Output:<br />
<web-app-deploy path="webapps" versioning="${deploy_versioning}"<br />
expand-preserve-fileset="WEB-INF/work/**"/><br />
<br />
</pre><br />
</code><br />
<br />
"if true, use the web-app's numeric suffix as a version"<br />
<br />
Run deploy command passing location of war file.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.war -name blog <br />
<br />
Output:<br />
Deployed production/webapp/default/blog from \<br />
./target/blog-0.1.0.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
To see the deployed you can use resinctl deploy-list<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
<br />
Now undeploy it:<br />
<br />
<code><br />
<pre><br />
$ resinctl undeploy blog<br />
<br />
Output:<br />
Undeployed blog from hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
At this point there should be nothing<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
</pre><br />
</code><br />
<br />
Now deploy it with versioning:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -version 0.1.0 <br />
<br />
Output:<br />
Deployed production/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
</pre><br />
</code><br />
<br />
Blog application is under the version 0.1.0<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog-0.1.0<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
=== Deploying to a staging server ===<br />
<br />
Deploy to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogz -version 0.1.0 -stage staging<br />
<br />
Output<br />
Deployed staging/webapp/default/blogz-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
The staging name is logical. You can call it anything. The app will not be served unless<br />
the server is started with this staging name.<br />
<br />
Showing items deployed to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
production/webapp/default/blog-0.1.0<br />
staging/webapp/default/blogz-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
The /blog works but /blogz does not work because server is by default setup as production server.<br />
<br />
/blog works because server is setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blog<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
/blogz does not work because server is not setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogz<br />
...<br />
HTTP request sent, awaiting response... 404 Not Found<br />
</pre><br />
</code><br />
<br />
To run the server as a staging server do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ resinctl help start<br />
<br />
Output:<br />
usage: bin/resin.sh [-options] start<br />
<br />
where options include:<br />
-conf <file> : select a configuration file<br />
-data-directory <dir> : select a resin-data directory<br />
-join-cluster <cluster> : join a cluster as a dynamic server<br />
-log-directory <dir> : select a logging directory<br />
-resin-home <dir> : select a resin home directory<br />
-root-directory <dir> : select a root directory<br />
-server <id> : select a <server> to run<br />
-watchdog-port <port> : override the watchdog-port<br />
-verbose : print verbose starting information<br />
-preview : run as a preview server<br />
-debug-port <port> : configure a debug port<br />
-jmx-port <port> : configure an unauthenticated jmx port<br />
-stage <staging-name> : The stage the server is serving (default production)<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ sudo resinctl start -stage staging<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
<br />
$ wget localhost:8080/blogz<br />
...<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
<br />
=== Deploying to a preview staging server ===<br />
<br />
<br />
<code><br />
<pre><br />
<br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogp -version 0.1.0 -stage preview<br />
<br />
Output<br />
Deployed preview/webapp/default/blogp-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
$ resinctl deploy-list<br />
<br />
Output<br />
preview/webapp/default/blogp-0.1.0<br />
production/webapp/default/blog-0.1.0<br />
...<br />
</pre><br />
</code><br />
<br />
<br />
Restart the server in preview stage, since preview staging is a common thing, you can just use the -preview command.<br />
<br />
== Deploying to a Remote Server ==<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
$ sudo resinctl start -preview<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<br />
Now the preview blog site is available.<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogp<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code></div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-05T23:47:29Z<p>Rickhigh: /* Deploying to a preview staging server */</p>
<hr />
<div># Deploying to a local server<br />
## Deploying to a staging server (locally)<br />
## Deploying to a preview staging server (locally)<br />
# Deploying to a remote server<br />
## Setting up a user and password<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
## license-add enabling Resin features<br />
# Deploy to a staging server<br />
## Setting up load balancer to not to deploy to staging server<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
## Installing mysql driver for a web application using config-deploy<br />
## Showing what is in remote config with config-list-ls and config-list-cat<br />
# web-app-deploy settings<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code><br />
<br />
<br />
== Deploying to a local server ==<br />
<br />
Deploy commands available <br />
<br />
<code><br />
<pre><br />
$ resinctl help deploy<br />
<br />
<br />
Output:<br />
usage: bin/resin.sh [-conf <file>] [-server <id>] deploy -user <user> \<br />
-password <password> [options] <war-file><br />
<br />
description:<br />
deploys application specified in a <war-file> to resin server<br />
<br />
options:<br />
-conf <file> : resin configuration file<br />
-server <id> : id of a server<br />
-address <address> : ip or host name of the server<br />
-port <port> : server http port<br />
-user <user> : user name used for authentication to the server<br />
-password <password> : password used for authentication to the server<br />
-host <host> : virtual host to make application available on<br />
-name <name> : name of the context to deploy to, defaults to war-file name<br />
-stage <stage> : stage to deploy application to, defaults to production<br />
-version <version> : version of application formatted as <major.minor.micro.qualifier><br />
-m <message> : commit message<br />
</pre><br />
</code><br />
<br />
Turning on versioning:<br />
<br />
<code><br />
<pre><br />
$ cat /etc/resin/resin.properties | grep deploy<br />
<br />
Output:<br />
deploy_versioning : true<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
<br />
$ sudo grep "web-app-deploy" -A 1 /etc/resin/resin.xml <br />
<br />
Output:<br />
<web-app-deploy path="webapps" versioning="${deploy_versioning}"<br />
expand-preserve-fileset="WEB-INF/work/**"/><br />
<br />
</pre><br />
</code><br />
<br />
"if true, use the web-app's numeric suffix as a version"<br />
<br />
Run deploy command passing location of war file.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.war -name blog <br />
<br />
Output:<br />
Deployed production/webapp/default/blog from \<br />
./target/blog-0.1.0.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
To see the deployed you can use resinctl deploy-list<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
<br />
Now undeploy it:<br />
<br />
<code><br />
<pre><br />
$ resinctl undeploy blog<br />
<br />
Output:<br />
Undeployed blog from hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
At this point there should be nothing<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
</pre><br />
</code><br />
<br />
Now deploy it with versioning:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -version 0.1.0 <br />
<br />
Output:<br />
Deployed production/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
</pre><br />
</code><br />
<br />
Blog application is under the version 0.1.0<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog-0.1.0<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
=== Deploying to a staging server ===<br />
<br />
Deploy to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogz -version 0.1.0 -stage staging<br />
<br />
Output<br />
Deployed staging/webapp/default/blogz-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
The staging name is logical. You can call it anything. The app will not be served unless<br />
the server is started with this staging name.<br />
<br />
Showing items deployed to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
production/webapp/default/blog-0.1.0<br />
staging/webapp/default/blogz-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
The /blog works but /blogz does not work because server is by default setup as production server.<br />
<br />
/blog works because server is setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blog<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
/blogz does not work because server is not setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogz<br />
...<br />
HTTP request sent, awaiting response... 404 Not Found<br />
</pre><br />
</code><br />
<br />
To run the server as a staging server do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ resinctl help start<br />
<br />
Output:<br />
usage: bin/resin.sh [-options] start<br />
<br />
where options include:<br />
-conf <file> : select a configuration file<br />
-data-directory <dir> : select a resin-data directory<br />
-join-cluster <cluster> : join a cluster as a dynamic server<br />
-log-directory <dir> : select a logging directory<br />
-resin-home <dir> : select a resin home directory<br />
-root-directory <dir> : select a root directory<br />
-server <id> : select a <server> to run<br />
-watchdog-port <port> : override the watchdog-port<br />
-verbose : print verbose starting information<br />
-preview : run as a preview server<br />
-debug-port <port> : configure a debug port<br />
-jmx-port <port> : configure an unauthenticated jmx port<br />
-stage <staging-name> : The stage the server is serving (default production)<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ sudo resinctl start -stage staging<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
<br />
$ wget localhost:8080/blogz<br />
...<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
<br />
=== Deploying to a preview staging server ===<br />
<br />
<br />
<code><br />
<pre><br />
<br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogp -version 0.1.0 -stage preview<br />
<br />
Output<br />
Deployed preview/webapp/default/blogp-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
$ resinctl deploy-list<br />
<br />
Output<br />
preview/webapp/default/blogp-0.1.0<br />
production/webapp/default/blog-0.1.0<br />
...<br />
</pre><br />
</code><br />
<br />
<br />
Restart the server in preview stage, since preview staging is a common thing, you can just use the -preview command.<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
$ sudo resinctl start -preview<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<br />
Now the preview blog site is available.<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogp<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code></div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-05T23:46:38Z<p>Rickhigh: </p>
<hr />
<div># Deploying to a local server<br />
## Deploying to a staging server (locally)<br />
## Deploying to a preview staging server (locally)<br />
# Deploying to a remote server<br />
## Setting up a user and password<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
## license-add enabling Resin features<br />
# Deploy to a staging server<br />
## Setting up load balancer to not to deploy to staging server<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
## Installing mysql driver for a web application using config-deploy<br />
## Showing what is in remote config with config-list-ls and config-list-cat<br />
# web-app-deploy settings<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code><br />
<br />
<br />
== Deploying to a local server ==<br />
<br />
Deploy commands available <br />
<br />
<code><br />
<pre><br />
$ resinctl help deploy<br />
<br />
<br />
Output:<br />
usage: bin/resin.sh [-conf <file>] [-server <id>] deploy -user <user> \<br />
-password <password> [options] <war-file><br />
<br />
description:<br />
deploys application specified in a <war-file> to resin server<br />
<br />
options:<br />
-conf <file> : resin configuration file<br />
-server <id> : id of a server<br />
-address <address> : ip or host name of the server<br />
-port <port> : server http port<br />
-user <user> : user name used for authentication to the server<br />
-password <password> : password used for authentication to the server<br />
-host <host> : virtual host to make application available on<br />
-name <name> : name of the context to deploy to, defaults to war-file name<br />
-stage <stage> : stage to deploy application to, defaults to production<br />
-version <version> : version of application formatted as <major.minor.micro.qualifier><br />
-m <message> : commit message<br />
</pre><br />
</code><br />
<br />
Turning on versioning:<br />
<br />
<code><br />
<pre><br />
$ cat /etc/resin/resin.properties | grep deploy<br />
<br />
Output:<br />
deploy_versioning : true<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
<br />
$ sudo grep "web-app-deploy" -A 1 /etc/resin/resin.xml <br />
<br />
Output:<br />
<web-app-deploy path="webapps" versioning="${deploy_versioning}"<br />
expand-preserve-fileset="WEB-INF/work/**"/><br />
<br />
</pre><br />
</code><br />
<br />
"if true, use the web-app's numeric suffix as a version"<br />
<br />
Run deploy command passing location of war file.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.war -name blog <br />
<br />
Output:<br />
Deployed production/webapp/default/blog from \<br />
./target/blog-0.1.0.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
To see the deployed you can use resinctl deploy-list<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
<br />
Now undeploy it:<br />
<br />
<code><br />
<pre><br />
$ resinctl undeploy blog<br />
<br />
Output:<br />
Undeployed blog from hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
At this point there should be nothing<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
</pre><br />
</code><br />
<br />
Now deploy it with versioning:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -version 0.1.0 <br />
<br />
Output:<br />
Deployed production/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
</pre><br />
</code><br />
<br />
Blog application is under the version 0.1.0<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog-0.1.0<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
=== Deploying to a staging server ===<br />
<br />
Deploy to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogz -version 0.1.0 -stage staging<br />
<br />
Output<br />
Deployed staging/webapp/default/blogz-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
The staging name is logical. You can call it anything. The app will not be served unless<br />
the server is started with this staging name.<br />
<br />
Showing items deployed to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
production/webapp/default/blog-0.1.0<br />
staging/webapp/default/blogz-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
The /blog works but /blogz does not work because server is by default setup as production server.<br />
<br />
/blog works because server is setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blog<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
/blogz does not work because server is not setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogz<br />
...<br />
HTTP request sent, awaiting response... 404 Not Found<br />
</pre><br />
</code><br />
<br />
To run the server as a staging server do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ resinctl help start<br />
<br />
Output:<br />
usage: bin/resin.sh [-options] start<br />
<br />
where options include:<br />
-conf <file> : select a configuration file<br />
-data-directory <dir> : select a resin-data directory<br />
-join-cluster <cluster> : join a cluster as a dynamic server<br />
-log-directory <dir> : select a logging directory<br />
-resin-home <dir> : select a resin home directory<br />
-root-directory <dir> : select a root directory<br />
-server <id> : select a <server> to run<br />
-watchdog-port <port> : override the watchdog-port<br />
-verbose : print verbose starting information<br />
-preview : run as a preview server<br />
-debug-port <port> : configure a debug port<br />
-jmx-port <port> : configure an unauthenticated jmx port<br />
-stage <staging-name> : The stage the server is serving (default production)<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ sudo resinctl start -stage staging<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
<br />
$ wget localhost:8080/blogz<br />
...<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
<br />
=== Deploying to a preview staging server ===<br />
<br />
<br />
<code><br />
<pre><br />
<br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogp -version 0.1.0 -stage preview<br />
<br />
'''Output'''<br />
Deployed preview/webapp/default/blogp-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
$ resinctl deploy-list<br />
<br />
'''Output'''<br />
preview/webapp/default/blogp-0.1.0<br />
production/webapp/default/blog-0.1.0<br />
...<br />
</pre><br />
</code><br />
<br />
<br />
Restart the server in preview stage, since preview staging is a common thing, you can just use the -preview command.<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
'''Output''':<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
$ sudo resinctl start -preview<br />
<br />
'''Output''':<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<br />
Now the preview blog site is available.<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogp<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code></div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-05T23:37:52Z<p>Rickhigh: /* Deploying to a staging server */</p>
<hr />
<div># Deploying to a local server<br />
# Deploying to a remote server<br />
## Setting up a user and password<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
## license-add enabling Resin features<br />
# Deploy to a staging server<br />
## Setting up load balancer to not to deploy to staging server<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
## Installing mysql driver for a web application using config-deploy<br />
## Showing what is in remote config with config-list-ls and config-list-cat<br />
# web-app-deploy settings<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code><br />
<br />
<br />
== Deploying to a local server ==<br />
<br />
Deploy commands available <br />
<br />
<code><br />
<pre><br />
$ resinctl help deploy<br />
<br />
<br />
Output:<br />
usage: bin/resin.sh [-conf <file>] [-server <id>] deploy -user <user> \<br />
-password <password> [options] <war-file><br />
<br />
description:<br />
deploys application specified in a <war-file> to resin server<br />
<br />
options:<br />
-conf <file> : resin configuration file<br />
-server <id> : id of a server<br />
-address <address> : ip or host name of the server<br />
-port <port> : server http port<br />
-user <user> : user name used for authentication to the server<br />
-password <password> : password used for authentication to the server<br />
-host <host> : virtual host to make application available on<br />
-name <name> : name of the context to deploy to, defaults to war-file name<br />
-stage <stage> : stage to deploy application to, defaults to production<br />
-version <version> : version of application formatted as <major.minor.micro.qualifier><br />
-m <message> : commit message<br />
</pre><br />
</code><br />
<br />
Turning on versioning:<br />
<br />
<code><br />
<pre><br />
$ cat /etc/resin/resin.properties | grep deploy<br />
<br />
Output:<br />
deploy_versioning : true<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
<br />
$ sudo grep "web-app-deploy" -A 1 /etc/resin/resin.xml <br />
<br />
Output:<br />
<web-app-deploy path="webapps" versioning="${deploy_versioning}"<br />
expand-preserve-fileset="WEB-INF/work/**"/><br />
<br />
</pre><br />
</code><br />
<br />
"if true, use the web-app's numeric suffix as a version"<br />
<br />
Run deploy command passing location of war file.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.war -name blog <br />
<br />
Output:<br />
Deployed production/webapp/default/blog from \<br />
./target/blog-0.1.0.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
To see the deployed you can use resinctl deploy-list<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
<br />
Now undeploy it:<br />
<br />
<code><br />
<pre><br />
$ resinctl undeploy blog<br />
<br />
Output:<br />
Undeployed blog from hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
At this point there should be nothing<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
</pre><br />
</code><br />
<br />
Now deploy it with versioning:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -version 0.1.0 <br />
<br />
Output:<br />
Deployed production/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
</pre><br />
</code><br />
<br />
Blog application is under the version 0.1.0<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog-0.1.0<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
=== Deploying to a staging server ===<br />
<br />
Deploy to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogz -version 0.1.0 -stage staging<br />
<br />
Output<br />
Deployed staging/webapp/default/blogz-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
The staging name is logical. You can call it anything. The app will not be served unless<br />
the server is started with this staging name.<br />
<br />
Showing items deployed to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
production/webapp/default/blog-0.1.0<br />
staging/webapp/default/blogz-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
The /blog works but /blogz does not work because server is by default setup as production server.<br />
<br />
/blog works because server is setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blog<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
/blogz does not work because server is not setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogz<br />
...<br />
HTTP request sent, awaiting response... 404 Not Found<br />
</pre><br />
</code><br />
<br />
To run the server as a staging server do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ resinctl help start<br />
<br />
Output:<br />
usage: bin/resin.sh [-options] start<br />
<br />
where options include:<br />
-conf <file> : select a configuration file<br />
-data-directory <dir> : select a resin-data directory<br />
-join-cluster <cluster> : join a cluster as a dynamic server<br />
-log-directory <dir> : select a logging directory<br />
-resin-home <dir> : select a resin home directory<br />
-root-directory <dir> : select a root directory<br />
-server <id> : select a <server> to run<br />
-watchdog-port <port> : override the watchdog-port<br />
-verbose : print verbose starting information<br />
-preview : run as a preview server<br />
-debug-port <port> : configure a debug port<br />
-jmx-port <port> : configure an unauthenticated jmx port<br />
-stage <staging-name> : The stage the server is serving (default production)<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ sudo resinctl start -stage staging<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
<br />
$ wget localhost:8080/blogz<br />
...<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
<br />
=== Deploying to a preview staging server ===<br />
<br />
<br />
<code><br />
<pre><br />
<br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogp -version 0.1.0 -stage preview<br />
<br />
'''Output'''<br />
Deployed preview/webapp/default/blogp-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
$ resinctl deploy-list<br />
<br />
'''Output'''<br />
preview/webapp/default/blogp-0.1.0<br />
production/webapp/default/blog-0.1.0<br />
...<br />
</pre><br />
</code><br />
<br />
<br />
Restart the server in preview stage, since preview staging is a common thing, you can just use the -preview command.<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
'''Output''':<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
$ sudo resinctl start -preview<br />
<br />
'''Output''':<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<br />
Now the preview blog site is available.<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogp<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code></div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-05T23:21:34Z<p>Rickhigh: /* Deploying to a staging server */</p>
<hr />
<div># Deploying to a local server<br />
# Deploying to a remote server<br />
## Setting up a user and password<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
## license-add enabling Resin features<br />
# Deploy to a staging server<br />
## Setting up load balancer to not to deploy to staging server<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
## Installing mysql driver for a web application using config-deploy<br />
## Showing what is in remote config with config-list-ls and config-list-cat<br />
# web-app-deploy settings<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code><br />
<br />
<br />
== Deploying to a local server ==<br />
<br />
Deploy commands available <br />
<br />
<code><br />
<pre><br />
$ resinctl help deploy<br />
<br />
<br />
Output:<br />
usage: bin/resin.sh [-conf <file>] [-server <id>] deploy -user <user> \<br />
-password <password> [options] <war-file><br />
<br />
description:<br />
deploys application specified in a <war-file> to resin server<br />
<br />
options:<br />
-conf <file> : resin configuration file<br />
-server <id> : id of a server<br />
-address <address> : ip or host name of the server<br />
-port <port> : server http port<br />
-user <user> : user name used for authentication to the server<br />
-password <password> : password used for authentication to the server<br />
-host <host> : virtual host to make application available on<br />
-name <name> : name of the context to deploy to, defaults to war-file name<br />
-stage <stage> : stage to deploy application to, defaults to production<br />
-version <version> : version of application formatted as <major.minor.micro.qualifier><br />
-m <message> : commit message<br />
</pre><br />
</code><br />
<br />
Turning on versioning:<br />
<br />
<code><br />
<pre><br />
$ cat /etc/resin/resin.properties | grep deploy<br />
<br />
Output:<br />
deploy_versioning : true<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
<br />
$ sudo grep "web-app-deploy" -A 1 /etc/resin/resin.xml <br />
<br />
Output:<br />
<web-app-deploy path="webapps" versioning="${deploy_versioning}"<br />
expand-preserve-fileset="WEB-INF/work/**"/><br />
<br />
</pre><br />
</code><br />
<br />
"if true, use the web-app's numeric suffix as a version"<br />
<br />
Run deploy command passing location of war file.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.war -name blog <br />
<br />
Output:<br />
Deployed production/webapp/default/blog from \<br />
./target/blog-0.1.0.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
To see the deployed you can use resinctl deploy-list<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
<br />
Now undeploy it:<br />
<br />
<code><br />
<pre><br />
$ resinctl undeploy blog<br />
<br />
Output:<br />
Undeployed blog from hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
At this point there should be nothing<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
</pre><br />
</code><br />
<br />
Now deploy it with versioning:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -version 0.1.0 <br />
<br />
Output:<br />
Deployed production/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
</pre><br />
</code><br />
<br />
Blog application is under the version 0.1.0<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog-0.1.0<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
=== Deploying to a staging server ===<br />
<br />
Deploy to staging server<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogz -version 0.1.0 -stage staging<br />
<br />
Output<br />
Deployed staging/webapp/default/blogz-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
Showing items deployed to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
production/webapp/default/blog-0.1.0<br />
staging/webapp/default/blogz-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
The /blog works but /blogz does not work because server is by default setup as production server.<br />
<br />
/blog works because server is setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blog<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
/blogz does not work because server is not setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogz<br />
...<br />
HTTP request sent, awaiting response... 404 Not Found<br />
</pre><br />
</code><br />
<br />
To run the server as a staging server do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ resinctl help start<br />
<br />
Output:<br />
usage: bin/resin.sh [-options] start<br />
<br />
where options include:<br />
-conf <file> : select a configuration file<br />
-data-directory <dir> : select a resin-data directory<br />
-join-cluster <cluster> : join a cluster as a dynamic server<br />
-log-directory <dir> : select a logging directory<br />
-resin-home <dir> : select a resin home directory<br />
-root-directory <dir> : select a root directory<br />
-server <id> : select a <server> to run<br />
-watchdog-port <port> : override the watchdog-port<br />
-verbose : print verbose starting information<br />
-preview : run as a preview server<br />
-debug-port <port> : configure a debug port<br />
-jmx-port <port> : configure an unauthenticated jmx port<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ sudo resinctl start -stage staging<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
<br />
$ wget localhost:8080/blogz<br />
...<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code></div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-05T23:20:23Z<p>Rickhigh: /* Deploying to a staging server */</p>
<hr />
<div># Deploying to a local server<br />
# Deploying to a remote server<br />
## Setting up a user and password<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
## license-add enabling Resin features<br />
# Deploy to a staging server<br />
## Setting up load balancer to not to deploy to staging server<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
## Installing mysql driver for a web application using config-deploy<br />
## Showing what is in remote config with config-list-ls and config-list-cat<br />
# web-app-deploy settings<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code><br />
<br />
<br />
== Deploying to a local server ==<br />
<br />
Deploy commands available <br />
<br />
<code><br />
<pre><br />
$ resinctl help deploy<br />
<br />
<br />
Output:<br />
usage: bin/resin.sh [-conf <file>] [-server <id>] deploy -user <user> \<br />
-password <password> [options] <war-file><br />
<br />
description:<br />
deploys application specified in a <war-file> to resin server<br />
<br />
options:<br />
-conf <file> : resin configuration file<br />
-server <id> : id of a server<br />
-address <address> : ip or host name of the server<br />
-port <port> : server http port<br />
-user <user> : user name used for authentication to the server<br />
-password <password> : password used for authentication to the server<br />
-host <host> : virtual host to make application available on<br />
-name <name> : name of the context to deploy to, defaults to war-file name<br />
-stage <stage> : stage to deploy application to, defaults to production<br />
-version <version> : version of application formatted as <major.minor.micro.qualifier><br />
-m <message> : commit message<br />
</pre><br />
</code><br />
<br />
Turning on versioning:<br />
<br />
<code><br />
<pre><br />
$ cat /etc/resin/resin.properties | grep deploy<br />
<br />
Output:<br />
deploy_versioning : true<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
<br />
$ sudo grep "web-app-deploy" -A 1 /etc/resin/resin.xml <br />
<br />
Output:<br />
<web-app-deploy path="webapps" versioning="${deploy_versioning}"<br />
expand-preserve-fileset="WEB-INF/work/**"/><br />
<br />
</pre><br />
</code><br />
<br />
"if true, use the web-app's numeric suffix as a version"<br />
<br />
Run deploy command passing location of war file.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.war -name blog <br />
<br />
Output:<br />
Deployed production/webapp/default/blog from \<br />
./target/blog-0.1.0.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
To see the deployed you can use resinctl deploy-list<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
<br />
Now undeploy it:<br />
<br />
<code><br />
<pre><br />
$ resinctl undeploy blog<br />
<br />
Output:<br />
Undeployed blog from hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
At this point there should be nothing<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
</pre><br />
</code><br />
<br />
Now deploy it with versioning:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -version 0.1.0 <br />
<br />
Output:<br />
Deployed production/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
</pre><br />
</code><br />
<br />
Blog application is under the version 0.1.0<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog-0.1.0<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
=== Deploying to a staging server ===<br />
<br />
Deploy to staging server<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogz -version 0.1.0 -stage staging<br />
<br />
Output<br />
Deployed staging/webapp/default/blogz-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
Showing items deployed to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
production/webapp/default/blog-0.1.0<br />
staging/webapp/default/blogz-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
The /blog works but /blogz does not work because server is by default setup as production server.<br />
<br />
/blog works because server is setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blog<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
/blogz does not work because server is not setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogz<br />
...<br />
HTTP request sent, awaiting response... 404 Not Found<br />
</pre><br />
</code><br />
<br />
To run the server as a staging server do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ resinctl help start<br />
<br />
Output:<br />
usage: bin/resin.sh [-options] start<br />
<br />
where options include:<br />
-conf <file> : select a configuration file<br />
-data-directory <dir> : select a resin-data directory<br />
-join-cluster <cluster> : join a cluster as a dynamic server<br />
-log-directory <dir> : select a logging directory<br />
-resin-home <dir> : select a resin home directory<br />
-root-directory <dir> : select a root directory<br />
-server <id> : select a <server> to run<br />
-watchdog-port <port> : override the watchdog-port<br />
-verbose : print verbose starting information<br />
-preview : run as a preview server<br />
-debug-port <port> : configure a debug port<br />
-jmx-port <port> : configure an unauthenticated jmx port<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ sudo resinctl start -stage staging<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
<br />
$ wget localhost:8080/blogz<br />
...<br />
...<br />
</pre><br />
</code><br />
<br />
HTTP request sent, awaiting response... 200 OK</div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-05T23:19:58Z<p>Rickhigh: /* Deploying to a staging server */</p>
<hr />
<div># Deploying to a local server<br />
# Deploying to a remote server<br />
## Setting up a user and password<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
## license-add enabling Resin features<br />
# Deploy to a staging server<br />
## Setting up load balancer to not to deploy to staging server<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
## Installing mysql driver for a web application using config-deploy<br />
## Showing what is in remote config with config-list-ls and config-list-cat<br />
# web-app-deploy settings<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code><br />
<br />
<br />
== Deploying to a local server ==<br />
<br />
Deploy commands available <br />
<br />
<code><br />
<pre><br />
$ resinctl help deploy<br />
<br />
<br />
Output:<br />
usage: bin/resin.sh [-conf <file>] [-server <id>] deploy -user <user> \<br />
-password <password> [options] <war-file><br />
<br />
description:<br />
deploys application specified in a <war-file> to resin server<br />
<br />
options:<br />
-conf <file> : resin configuration file<br />
-server <id> : id of a server<br />
-address <address> : ip or host name of the server<br />
-port <port> : server http port<br />
-user <user> : user name used for authentication to the server<br />
-password <password> : password used for authentication to the server<br />
-host <host> : virtual host to make application available on<br />
-name <name> : name of the context to deploy to, defaults to war-file name<br />
-stage <stage> : stage to deploy application to, defaults to production<br />
-version <version> : version of application formatted as <major.minor.micro.qualifier><br />
-m <message> : commit message<br />
</pre><br />
</code><br />
<br />
Turning on versioning:<br />
<br />
<code><br />
<pre><br />
$ cat /etc/resin/resin.properties | grep deploy<br />
<br />
Output:<br />
deploy_versioning : true<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
<br />
$ sudo grep "web-app-deploy" -A 1 /etc/resin/resin.xml <br />
<br />
Output:<br />
<web-app-deploy path="webapps" versioning="${deploy_versioning}"<br />
expand-preserve-fileset="WEB-INF/work/**"/><br />
<br />
</pre><br />
</code><br />
<br />
"if true, use the web-app's numeric suffix as a version"<br />
<br />
Run deploy command passing location of war file.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.war -name blog <br />
<br />
Output:<br />
Deployed production/webapp/default/blog from \<br />
./target/blog-0.1.0.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
To see the deployed you can use resinctl deploy-list<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
<br />
Now undeploy it:<br />
<br />
<code><br />
<pre><br />
$ resinctl undeploy blog<br />
<br />
Output:<br />
Undeployed blog from hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
At this point there should be nothing<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
</pre><br />
</code><br />
<br />
Now deploy it with versioning:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -version 0.1.0 <br />
<br />
Output:<br />
Deployed production/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
</pre><br />
</code><br />
<br />
Blog application is under the version 0.1.0<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog-0.1.0<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
=== Deploying to a staging server ===<br />
<br />
Deploy to staging server<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogz -version 0.1.0 -stage staging<br />
<br />
Output<br />
Deployed staging/webapp/default/blogz-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
Showing items deployed to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
production/webapp/default/blog-0.1.0<br />
staging/webapp/default/blogz-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
The /blog works but /blogz does not work because server is by default setup as production server.<br />
<br />
/blog works because server is setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blog<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
/blogz does not work because server is not setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogz<br />
...<br />
HTTP request sent, awaiting response... 404 Not Found<br />
</pre><br />
</code><br />
<br />
To run the server as a staging server do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ resinctl help start<br />
<br />
Output:<br />
usage: bin/resin.sh [-options] start<br />
<br />
where options include:<br />
-conf <file> : select a configuration file<br />
-data-directory <dir> : select a resin-data directory<br />
-join-cluster <cluster> : join a cluster as a dynamic server<br />
-log-directory <dir> : select a logging directory<br />
-resin-home <dir> : select a resin home directory<br />
-root-directory <dir> : select a root directory<br />
-server <id> : select a <server> to run<br />
-watchdog-port <port> : override the watchdog-port<br />
-verbose : print verbose starting information<br />
-preview : run as a preview server<br />
-debug-port <port> : configure a debug port<br />
-jmx-port <port> : configure an unauthenticated jmx port<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ sudo resinctl start -stage staging<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
<br />
$ wget localhost:8080/blogz<br />
...<br />
...<br />
</pre><br />
</code></div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-05T23:17:50Z<p>Rickhigh: /* Deploying to a staging server */</p>
<hr />
<div># Deploying to a local server<br />
# Deploying to a remote server<br />
## Setting up a user and password<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
## license-add enabling Resin features<br />
# Deploy to a staging server<br />
## Setting up load balancer to not to deploy to staging server<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
## Installing mysql driver for a web application using config-deploy<br />
## Showing what is in remote config with config-list-ls and config-list-cat<br />
# web-app-deploy settings<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code><br />
<br />
<br />
== Deploying to a local server ==<br />
<br />
Deploy commands available <br />
<br />
<code><br />
<pre><br />
$ resinctl help deploy<br />
<br />
<br />
Output:<br />
usage: bin/resin.sh [-conf <file>] [-server <id>] deploy -user <user> \<br />
-password <password> [options] <war-file><br />
<br />
description:<br />
deploys application specified in a <war-file> to resin server<br />
<br />
options:<br />
-conf <file> : resin configuration file<br />
-server <id> : id of a server<br />
-address <address> : ip or host name of the server<br />
-port <port> : server http port<br />
-user <user> : user name used for authentication to the server<br />
-password <password> : password used for authentication to the server<br />
-host <host> : virtual host to make application available on<br />
-name <name> : name of the context to deploy to, defaults to war-file name<br />
-stage <stage> : stage to deploy application to, defaults to production<br />
-version <version> : version of application formatted as <major.minor.micro.qualifier><br />
-m <message> : commit message<br />
</pre><br />
</code><br />
<br />
Turning on versioning:<br />
<br />
<code><br />
<pre><br />
$ cat /etc/resin/resin.properties | grep deploy<br />
<br />
Output:<br />
deploy_versioning : true<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
<br />
$ sudo grep "web-app-deploy" -A 1 /etc/resin/resin.xml <br />
<br />
Output:<br />
<web-app-deploy path="webapps" versioning="${deploy_versioning}"<br />
expand-preserve-fileset="WEB-INF/work/**"/><br />
<br />
</pre><br />
</code><br />
<br />
"if true, use the web-app's numeric suffix as a version"<br />
<br />
Run deploy command passing location of war file.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.war -name blog <br />
<br />
Output:<br />
Deployed production/webapp/default/blog from \<br />
./target/blog-0.1.0.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
To see the deployed you can use resinctl deploy-list<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
<br />
Now undeploy it:<br />
<br />
<code><br />
<pre><br />
$ resinctl undeploy blog<br />
<br />
Output:<br />
Undeployed blog from hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
At this point there should be nothing<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
</pre><br />
</code><br />
<br />
Now deploy it with versioning:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -version 0.1.0 <br />
<br />
Output:<br />
Deployed production/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
</pre><br />
</code><br />
<br />
Blog application is under the version 0.1.0<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog-0.1.0<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
=== Deploying to a staging server ===<br />
<br />
Deploy to staging server<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogz -version 0.1.0 -stage staging<br />
<br />
Output<br />
Deployed staging/webapp/default/blogz-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
Showing items deployed to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
production/webapp/default/blog-0.1.0<br />
staging/webapp/default/blogz-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
The /blog works but /blogz does not work because server is by default setup as production server.<br />
<br />
/blog works because server is setup for production<br />
<code><br />
<pre><br />
$ wget localhost:8080/blog<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</pre><br />
</code><br />
<br />
/blogz does not work because server is not setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogz<br />
...<br />
HTTP request sent, awaiting response... 404 Not Found<br />
</code><br />
</pre><br />
<br />
To run the server as a staging server do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ resinctl help start<br />
<br />
Output:<br />
usage: bin/resin.sh [-options] start<br />
<br />
where options include:<br />
-conf <file> : select a configuration file<br />
-data-directory <dir> : select a resin-data directory<br />
-join-cluster <cluster> : join a cluster as a dynamic server<br />
-log-directory <dir> : select a logging directory<br />
-resin-home <dir> : select a resin home directory<br />
-root-directory <dir> : select a root directory<br />
-server <id> : select a <server> to run<br />
-watchdog-port <port> : override the watchdog-port<br />
-verbose : print verbose starting information<br />
-preview : run as a preview server<br />
-debug-port <port> : configure a debug port<br />
-jmx-port <port> : configure an unauthenticated jmx port<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
$ sudo resinctl start -stage staging<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
<br />
$ wget localhost:8080/blogz<br />
...<br />
...<br />
</pre><br />
</code></div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-05T23:16:23Z<p>Rickhigh: /* Deploying to a staging server */</p>
<hr />
<div># Deploying to a local server<br />
# Deploying to a remote server<br />
## Setting up a user and password<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
## license-add enabling Resin features<br />
# Deploy to a staging server<br />
## Setting up load balancer to not to deploy to staging server<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
## Installing mysql driver for a web application using config-deploy<br />
## Showing what is in remote config with config-list-ls and config-list-cat<br />
# web-app-deploy settings<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code><br />
<br />
<br />
== Deploying to a local server ==<br />
<br />
Deploy commands available <br />
<br />
<code><br />
<pre><br />
$ resinctl help deploy<br />
<br />
<br />
Output:<br />
usage: bin/resin.sh [-conf <file>] [-server <id>] deploy -user <user> \<br />
-password <password> [options] <war-file><br />
<br />
description:<br />
deploys application specified in a <war-file> to resin server<br />
<br />
options:<br />
-conf <file> : resin configuration file<br />
-server <id> : id of a server<br />
-address <address> : ip or host name of the server<br />
-port <port> : server http port<br />
-user <user> : user name used for authentication to the server<br />
-password <password> : password used for authentication to the server<br />
-host <host> : virtual host to make application available on<br />
-name <name> : name of the context to deploy to, defaults to war-file name<br />
-stage <stage> : stage to deploy application to, defaults to production<br />
-version <version> : version of application formatted as <major.minor.micro.qualifier><br />
-m <message> : commit message<br />
</pre><br />
</code><br />
<br />
Turning on versioning:<br />
<br />
<code><br />
<pre><br />
$ cat /etc/resin/resin.properties | grep deploy<br />
<br />
Output:<br />
deploy_versioning : true<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
<br />
$ sudo grep "web-app-deploy" -A 1 /etc/resin/resin.xml <br />
<br />
Output:<br />
<web-app-deploy path="webapps" versioning="${deploy_versioning}"<br />
expand-preserve-fileset="WEB-INF/work/**"/><br />
<br />
</pre><br />
</code><br />
<br />
"if true, use the web-app's numeric suffix as a version"<br />
<br />
Run deploy command passing location of war file.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.war -name blog <br />
<br />
Output:<br />
Deployed production/webapp/default/blog from \<br />
./target/blog-0.1.0.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
To see the deployed you can use resinctl deploy-list<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
<br />
Now undeploy it:<br />
<br />
<code><br />
<pre><br />
$ resinctl undeploy blog<br />
<br />
Output:<br />
Undeployed blog from hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
At this point there should be nothing<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
</pre><br />
</code><br />
<br />
Now deploy it with versioning:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -version 0.1.0 <br />
<br />
Output:<br />
Deployed production/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
</pre><br />
</code><br />
<br />
Blog application is under the version 0.1.0<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog-0.1.0<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
=== Deploying to a staging server ===<br />
<br />
Deploy to staging server<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blogz -version 0.1.0 -stage staging<br />
<br />
Output<br />
Deployed staging/webapp/default/blogz-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
Showing items deployed to staging server.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
production/webapp/default/blog-0.1.0<br />
staging/webapp/default/blogz-0.1.0<br />
</code><br />
</pre><br />
<br />
The /blog works but /blogz does not work because server is by default setup as production server.<br />
<br />
/blog works because server is setup for production<br />
<code><br />
<pre><br />
$ wget localhost:8080/blog<br />
...<br />
HTTP request sent, awaiting response... 200 OK<br />
</code><br />
</pre><br />
<br />
/blogz does not work because server is not setup for production<br />
<br />
<code><br />
<pre><br />
$ wget localhost:8080/blogz<br />
...<br />
HTTP request sent, awaiting response... 404 Not Found<br />
</code><br />
</pre><br />
<br />
To run the server as a staging server do the following:<br />
<br />
<code><br />
<pre><br />
$ resinctl stop<br />
<br />
Output:<br />
Resin/4.0.24 stopped -server 'app-0' for watchdog at 127.0.0.1:6600<br />
</code><br />
</pre><br />
<br />
<code><br />
<pre><br />
$ resinctl help start<br />
<br />
Output:<br />
usage: bin/resin.sh [-options] start<br />
<br />
where options include:<br />
-conf <file> : select a configuration file<br />
-data-directory <dir> : select a resin-data directory<br />
-join-cluster <cluster> : join a cluster as a dynamic server<br />
-log-directory <dir> : select a logging directory<br />
-resin-home <dir> : select a resin home directory<br />
-root-directory <dir> : select a root directory<br />
-server <id> : select a <server> to run<br />
-watchdog-port <port> : override the watchdog-port<br />
-verbose : print verbose starting information<br />
-preview : run as a preview server<br />
-debug-port <port> : configure a debug port<br />
-jmx-port <port> : configure an unauthenticated jmx port<br />
</code><br />
</pre><br />
<br />
<code><br />
<pre><br />
$ sudo resinctl start -stage staging<br />
<br />
Output:<br />
Resin/4.0.24 launching watchdog at 127.0.0.1:6600<br />
Resin/4.0.24 started -server 'app-0' for watchdog at 127.0.0.1:6600<br />
<br />
<br />
$ wget localhost:8080/blogz<br />
...<br />
...<br />
</code><br />
</pre></div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-05T22:59:31Z<p>Rickhigh: </p>
<hr />
<div># Deploying to a local server<br />
# Deploying to a remote server<br />
## Setting up a user and password<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
## license-add enabling Resin features<br />
# Deploy to a staging server<br />
## Setting up load balancer to not to deploy to staging server<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
## Installing mysql driver for a web application using config-deploy<br />
## Showing what is in remote config with config-list-ls and config-list-cat<br />
# web-app-deploy settings<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code><br />
<br />
<br />
== Deploying to a local server ==<br />
<br />
Deploy commands available <br />
<br />
<code><br />
<pre><br />
$ resinctl help deploy<br />
<br />
<br />
Output:<br />
usage: bin/resin.sh [-conf <file>] [-server <id>] deploy -user <user> \<br />
-password <password> [options] <war-file><br />
<br />
description:<br />
deploys application specified in a <war-file> to resin server<br />
<br />
options:<br />
-conf <file> : resin configuration file<br />
-server <id> : id of a server<br />
-address <address> : ip or host name of the server<br />
-port <port> : server http port<br />
-user <user> : user name used for authentication to the server<br />
-password <password> : password used for authentication to the server<br />
-host <host> : virtual host to make application available on<br />
-name <name> : name of the context to deploy to, defaults to war-file name<br />
-stage <stage> : stage to deploy application to, defaults to production<br />
-version <version> : version of application formatted as <major.minor.micro.qualifier><br />
-m <message> : commit message<br />
</pre><br />
</code><br />
<br />
Turning on versioning:<br />
<br />
<code><br />
<pre><br />
$ cat /etc/resin/resin.properties | grep deploy<br />
<br />
Output:<br />
deploy_versioning : true<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
<br />
$ sudo grep "web-app-deploy" -A 1 /etc/resin/resin.xml <br />
<br />
Output:<br />
<web-app-deploy path="webapps" versioning="${deploy_versioning}"<br />
expand-preserve-fileset="WEB-INF/work/**"/><br />
<br />
</pre><br />
</code><br />
<br />
"if true, use the web-app's numeric suffix as a version"<br />
<br />
Run deploy command passing location of war file.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.war -name blog <br />
<br />
Output:<br />
Deployed production/webapp/default/blog from \<br />
./target/blog-0.1.0.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
To see the deployed you can use resinctl deploy-list<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
<br />
Now undeploy it:<br />
<br />
<code><br />
<pre><br />
$ resinctl undeploy blog<br />
<br />
Output:<br />
Undeployed blog from hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
At this point there should be nothing<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
</pre><br />
</code><br />
<br />
Now deploy it with versioning:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -version 0.1.0 <br />
<br />
Output:<br />
Deployed production/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
</pre><br />
</code><br />
<br />
Blog application is under the version 0.1.0<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog-0.1.0<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
=== Deploying to a staging server ===</div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-05T22:56:54Z<p>Rickhigh: </p>
<hr />
<div># Deploying to a local server<br />
# Deploying to a remote server<br />
## Setting up a user and password<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
## license-add enabling Resin features<br />
# Deploy to a staging server<br />
## Setting up load balancer to not to deploy to staging server<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
## Installing mysql driver for a web application using config-deploy<br />
## Showing what is in remote config with config-list-ls and config-list-cat<br />
# web-app-deploy settings<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code><br />
<br />
<br />
== Deploying to a local server ==<br />
<br />
Deploy commands available <br />
<br />
<code><br />
<pre><br />
$ resinctl help deploy<br />
<br />
<br />
Output:<br />
usage: bin/resin.sh [-conf <file>] [-server <id>] deploy -user <user> \<br />
-password <password> [options] <war-file><br />
<br />
description:<br />
deploys application specified in a <war-file> to resin server<br />
<br />
options:<br />
-conf <file> : resin configuration file<br />
-server <id> : id of a server<br />
-address <address> : ip or host name of the server<br />
-port <port> : server http port<br />
-user <user> : user name used for authentication to the server<br />
-password <password> : password used for authentication to the server<br />
-host <host> : virtual host to make application available on<br />
-name <name> : name of the context to deploy to, defaults to war-file name<br />
-stage <stage> : stage to deploy application to, defaults to production<br />
-version <version> : version of application formatted as <major.minor.micro.qualifier><br />
-m <message> : commit message<br />
</pre><br />
</code><br />
<br />
Turning on versioning:<br />
<br />
<code><br />
<pre><br />
$ cat /etc/resin/resin.properties | grep deploy<br />
<br />
Output:<br />
deploy_versioning : true<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
<br />
$ sudo grep "web-app-deploy" -A 1 /etc/resin/resin.xml <br />
<br />
Output:<br />
<web-app-deploy path="webapps" versioning="${deploy_versioning}"<br />
expand-preserve-fileset="WEB-INF/work/**"/><br />
<br />
</pre><br />
</code><br />
<br />
"if true, use the web-app's numeric suffix as a version"<br />
<br />
Run deploy command passing location of war file.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.war -name blog <br />
<br />
Output:<br />
Deployed production/webapp/default/blog from \<br />
./target/blog-0.1.0.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
To see the deployed you can use resinctl deploy-list<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
<br />
Now undeploy it:<br />
<br />
<code><br />
<pre><br />
$ resinctl undeploy blog<br />
<br />
Output:<br />
Undeployed blog from hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
At this point there should be nothing<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
</pre><br />
</code><br />
<br />
Now deploy it with versioning:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -version 0.1.0 <br />
<br />
Output:<br />
Deployed production/webapp/default/blog-0.1.0 from \<br />
./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
</pre><br />
</code><br />
<br />
Blog application is under the version 0.1.0<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
=== Deploying to a staging server ===<br />
<br />
<br />
<br />
<br />
* TODO explain production/webapp/default/blog-0.1.0<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers</div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-05T22:54:32Z<p>Rickhigh: </p>
<hr />
<div># Deploying to a local server<br />
# Deploying to a remote server<br />
## Setting up a user and password<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
## license-add enabling Resin features<br />
# Deploy to a staging server<br />
## Setting up load balancer to not to deploy to staging server<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
## Installing mysql driver for a web application using config-deploy<br />
## Showing what is in remote config with config-list-ls and config-list-cat<br />
# web-app-deploy settings<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code><br />
<br />
<br />
== Deploying to a local server ==<br />
<br />
Deploy commands available <br />
<br />
<code><br />
<pre><br />
$ resinctl help deploy<br />
<br />
<br />
Output:<br />
usage: bin/resin.sh [-conf <file>] [-server <id>] deploy -user <user> \<br />
-password <password> [options] <war-file><br />
<br />
description:<br />
deploys application specified in a <war-file> to resin server<br />
<br />
options:<br />
-conf <file> : resin configuration file<br />
-server <id> : id of a server<br />
-address <address> : ip or host name of the server<br />
-port <port> : server http port<br />
-user <user> : user name used for authentication to the server<br />
-password <password> : password used for authentication to the server<br />
-host <host> : virtual host to make application available on<br />
-name <name> : name of the context to deploy to, defaults to war-file name<br />
-stage <stage> : stage to deploy application to, defaults to production<br />
-version <version> : version of application formatted as <major.minor.micro.qualifier><br />
-m <message> : commit message<br />
</pre><br />
</code><br />
<br />
Turning on versioning:<br />
<br />
<code><br />
<pre><br />
$ cat /etc/resin/resin.properties | grep deploy<br />
<br />
Output:<br />
deploy_versioning : true<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
<br />
$ sudo grep "web-app-deploy" -A 1 /etc/resin/resin.xml <br />
<br />
Output:<br />
<web-app-deploy path="webapps" versioning="${deploy_versioning}"<br />
expand-preserve-fileset="WEB-INF/work/**"/><br />
<br />
</pre><br />
</code><br />
<br />
"if true, use the web-app's numeric suffix as a version"<br />
<br />
Run deploy command passing location of war file.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.war -name blog <br />
<br />
Output:<br />
Deployed production/webapp/default/blog from ./target/blog-0.1.0.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
To see the deployed you can use resinctl deploy-list<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
<br />
Now undeploy it:<br />
<br />
<code><br />
<pre><br />
$ resinctl undeploy blog<br />
<br />
Output:<br />
Undeployed blog from hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
At this point there should be nothing<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
</pre><br />
</code><br />
<br />
Now deploy it with versioning:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -version 0.1.0 <br />
<br />
Output:<br />
Deployed production/webapp/default/blog-0.1.0 from ./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
</pre><br />
</code><br />
<br />
Blog application is under the version 0.1.0<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
<br />
* TODO explain production/webapp/default/blog-0.1.0<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers</div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-05T22:41:57Z<p>Rickhigh: /* Deploying to a local server */</p>
<hr />
<div># Setting up a user and password<br />
# Deploying to a local server<br />
# Deploying to a remote server<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
## license-add enabling Resin features<br />
# Deploy to a staging server<br />
## Setting up load balancer to not to deploy to staging server<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
## Installing mysql driver for a web application using config-deploy<br />
## Showing what is in remote config with config-list-ls and config-list-cat<br />
# web-app-deploy settings<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code><br />
<br />
<br />
== Deploying to a local server ==<br />
<br />
Deploy commands available <br />
<br />
<code><br />
<pre><br />
$ resinctl help deploy<br />
<br />
<br />
Output:<br />
usage: bin/resin.sh [-conf <file>] [-server <id>] deploy -user <user> \<br />
-password <password> [options] <war-file><br />
<br />
description:<br />
deploys application specified in a <war-file> to resin server<br />
<br />
options:<br />
-conf <file> : resin configuration file<br />
-server <id> : id of a server<br />
-address <address> : ip or host name of the server<br />
-port <port> : server http port<br />
-user <user> : user name used for authentication to the server<br />
-password <password> : password used for authentication to the server<br />
-host <host> : virtual host to make application available on<br />
-name <name> : name of the context to deploy to, defaults to war-file name<br />
-stage <stage> : stage to deploy application to, defaults to production<br />
-version <version> : version of application formatted as <major.minor.micro.qualifier><br />
-m <message> : commit message<br />
</pre><br />
</code><br />
<br />
Turning on versioning:<br />
<br />
<code><br />
<pre><br />
$ cat /etc/resin/resin.properties | grep deploy<br />
<br />
Output:<br />
deploy_versioning : true<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
<br />
$ sudo grep "web-app-deploy" -A 1 /etc/resin/resin.xml <br />
<br />
Output:<br />
<web-app-deploy path="webapps" versioning="${deploy_versioning}"<br />
expand-preserve-fileset="WEB-INF/work/**"/><br />
<br />
</pre><br />
</code><br />
<br />
"if true, use the web-app's numeric suffix as a version"<br />
<br />
Run deploy command passing location of war file.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.war -name blog <br />
<br />
Output:<br />
Deployed production/webapp/default/blog from ./target/blog-0.1.0.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
To see the deployed you can use resinctl deploy-list<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
<br />
Now undeploy it:<br />
<br />
<code><br />
<pre><br />
$ resinctl undeploy blog<br />
<br />
Output:<br />
Undeployed blog from hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
At this point there should be nothing<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
</pre><br />
</code><br />
<br />
Now deploy it with versioning:<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -version 0.1.0 <br />
<br />
Output:<br />
Deployed production/webapp/default/blog-0.1.0 from ./target/blog-0.1.0.BUILD-SNAPSHOT.war to hmux://127.0.0.1:6800<br />
<br />
</pre><br />
</code><br />
<br />
Blog application is under the version 0.1.0<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog-0.1.0<br />
</pre><br />
</code><br />
<br />
<br />
<br />
* TODO explain production/webapp/default/blog-0.1.0<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers</div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-05T22:36:44Z<p>Rickhigh: /* Deploying to a local server */</p>
<hr />
<div># Setting up a user and password<br />
# Deploying to a local server<br />
# Deploying to a remote server<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
## license-add enabling Resin features<br />
# Deploy to a staging server<br />
## Setting up load balancer to not to deploy to staging server<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
## Installing mysql driver for a web application using config-deploy<br />
## Showing what is in remote config with config-list-ls and config-list-cat<br />
# web-app-deploy settings<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code><br />
<br />
<br />
== Deploying to a local server ==<br />
<br />
Deploy commands available <br />
<br />
<code><br />
<pre><br />
$ resinctl help deploy<br />
<br />
<br />
Output:<br />
usage: bin/resin.sh [-conf <file>] [-server <id>] deploy -user <user> \<br />
-password <password> [options] <war-file><br />
<br />
description:<br />
deploys application specified in a <war-file> to resin server<br />
<br />
options:<br />
-conf <file> : resin configuration file<br />
-server <id> : id of a server<br />
-address <address> : ip or host name of the server<br />
-port <port> : server http port<br />
-user <user> : user name used for authentication to the server<br />
-password <password> : password used for authentication to the server<br />
-host <host> : virtual host to make application available on<br />
-name <name> : name of the context to deploy to, defaults to war-file name<br />
-stage <stage> : stage to deploy application to, defaults to production<br />
-version <version> : version of application formatted as <major.minor.micro.qualifier><br />
-m <message> : commit message<br />
</pre><br />
</code><br />
<br />
Turning on versioning:<br />
<br />
<code><br />
<pre><br />
$ cat /etc/resin/resin.properties | grep deploy<br />
<br />
Output:<br />
deploy_versioning : true<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
<br />
$ sudo grep "web-app-deploy" -A 1 /etc/resin/resin.xml <br />
<br />
Output:<br />
<web-app-deploy path="webapps" versioning="${deploy_versioning}"<br />
expand-preserve-fileset="WEB-INF/work/**"/><br />
<br />
</pre><br />
</code><br />
<br />
"if true, use the web-app's numeric suffix as a version"<br />
<br />
Run deploy command passing location of war file.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.war -name blog <br />
<br />
Output:<br />
Deployed production/webapp/default/blog from ./target/blog-0.1.0.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
To see the deployed you can use resinctl deploy-list<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
<br />
Now undeploy it:<br />
<br />
<code><br />
<pre><br />
$ resinctl undeploy blog<br />
<br />
Output:<br />
Undeployed blog from hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
At this point there should be nothing<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
</pre><br />
</code></div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-05T22:33:56Z<p>Rickhigh: /* Deploying to a local server */</p>
<hr />
<div># Setting up a user and password<br />
# Deploying to a local server<br />
# Deploying to a remote server<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
## license-add enabling Resin features<br />
# Deploy to a staging server<br />
## Setting up load balancer to not to deploy to staging server<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
## Installing mysql driver for a web application using config-deploy<br />
## Showing what is in remote config with config-list-ls and config-list-cat<br />
# web-app-deploy settings<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code><br />
<br />
<br />
== Deploying to a local server ==<br />
<br />
Turning on versioning:<br />
<br />
<code><br />
<pre><br />
$ cat /etc/resin/resin.properties | grep deploy<br />
<br />
Output:<br />
deploy_versioning : true<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
<br />
$ sudo grep "web-app-deploy" -A 1 /etc/resin/resin.xml <br />
<br />
Output:<br />
<web-app-deploy path="webapps" versioning="${deploy_versioning}"<br />
expand-preserve-fileset="WEB-INF/work/**"/><br />
<br />
</pre><br />
</code><br />
<br />
"if true, use the web-app's numeric suffix as a version"<br />
<br />
Run deploy command passing location of war file.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.war -name blog <br />
<br />
Output:<br />
Deployed production/webapp/default/blog from ./target/blog-0.1.0.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
To see the deployed you can use resinctl deploy-list<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
<br />
Now undeploy it:<br />
<br />
<code><br />
<pre><br />
$ resinctl undeploy blog<br />
<br />
Output:<br />
Undeployed blog from hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
At this point there should be nothing<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
</pre><br />
</code></div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-05T22:33:38Z<p>Rickhigh: /* Deploying to a local server */</p>
<hr />
<div># Setting up a user and password<br />
# Deploying to a local server<br />
# Deploying to a remote server<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
## license-add enabling Resin features<br />
# Deploy to a staging server<br />
## Setting up load balancer to not to deploy to staging server<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
## Installing mysql driver for a web application using config-deploy<br />
## Showing what is in remote config with config-list-ls and config-list-cat<br />
# web-app-deploy settings<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code><br />
<br />
<br />
== Deploying to a local server ==<br />
<br />
Turning on versioning:<br />
<br />
<code><br />
<pre><br />
$ cat /etc/resin/resin.properties | grep deploy<br />
<br />
Output:<br />
deploy_versioning : true<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
<br />
$ sudo grep "web-app-deploy" -A 1 /etc/resin/resin.xml <br />
<br />
Output:<br />
<web-app-deploy path="webapps" versioning="${deploy_versioning}"<br />
expand-preserve-fileset="WEB-INF/work/**"/><br />
<br />
</pre><br />
</code><br />
<br />
"if true, use the web-app's numeric suffix as a version"<br />
<br />
Run deploy command passing location of war file.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.war -name blog <br />
<br />
Output:<br />
Deployed production/webapp/default/blog from ./target/blog-0.1.0.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
To see the deployed you can use resinctl deploy-list<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
* TODO explain production/webapp/default/blog<br />
* TODO add a table<br />
* TODO explain how to start up a server with different staging servers<br />
<br />
<br />
Now undeploy it:<br />
<br />
<code><br />
<pre><br />
$ resinctl undeploy blog<br />
<br />
Output:<br />
Undeployed blog from hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
At this point there should be nothing<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
</pre><br />
</code></div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-05T22:32:46Z<p>Rickhigh: /* Deploying to a local server */</p>
<hr />
<div># Setting up a user and password<br />
# Deploying to a local server<br />
# Deploying to a remote server<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
## license-add enabling Resin features<br />
# Deploy to a staging server<br />
## Setting up load balancer to not to deploy to staging server<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
## Installing mysql driver for a web application using config-deploy<br />
## Showing what is in remote config with config-list-ls and config-list-cat<br />
# web-app-deploy settings<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code><br />
<br />
<br />
== Deploying to a local server ==<br />
<br />
Turning on versioning:<br />
<br />
<code><br />
<pre><br />
$ cat /etc/resin/resin.properties | grep deploy<br />
<br />
Output:<br />
deploy_versioning : true<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
<br />
$ sudo grep "web-app-deploy" -A 1 /etc/resin/resin.xml <br />
<br />
Output:<br />
<web-app-deploy path="webapps" versioning="${deploy_versioning}"<br />
expand-preserve-fileset="WEB-INF/work/**"/><br />
<br />
</pre><br />
</code><br />
<br />
"if true, use the web-app's numeric suffix as a version"<br />
<br />
Run deploy command passing location of war file.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.war -name blog <br />
<br />
Output:<br />
Deployed production/webapp/default/blog from ./target/blog-0.1.0.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
To see the deployed you can use resinctl deploy-list<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
TODO explain production/webapp/default/blog<br />
TODO add a table<br />
TODO explain how to start up a server with different staging servers<br />
<br />
<br />
Now undeploy it:<br />
<br />
<code><br />
<pre><br />
$ resinctl undeploy blog<br />
<br />
Output:<br />
Undeployed blog from hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
At this point there should be nothing<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
</pre><br />
</code></div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-05T22:31:35Z<p>Rickhigh: /* Deploying to a local server */</p>
<hr />
<div># Setting up a user and password<br />
# Deploying to a local server<br />
# Deploying to a remote server<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
## license-add enabling Resin features<br />
# Deploy to a staging server<br />
## Setting up load balancer to not to deploy to staging server<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
## Installing mysql driver for a web application using config-deploy<br />
## Showing what is in remote config with config-list-ls and config-list-cat<br />
# web-app-deploy settings<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code><br />
<br />
<br />
== Deploying to a local server ==<br />
<br />
Turning on versioning:<br />
<br />
<code><br />
<pre><br />
$ cat /etc/resin/resin.properties | grep deploy<br />
<br />
Output:<br />
deploy_versioning : true<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
<br />
$ sudo grep "web-app-deploy" -A 1 /etc/resin/resin.xml <br />
<br />
Output:<br />
<web-app-deploy path="webapps" versioning="${deploy_versioning}"<br />
expand-preserve-fileset="WEB-INF/work/**"/><br />
<br />
</pre><br />
</code><br />
<br />
"if true, use the web-app's numeric suffix as a version"<br />
<br />
Run deploy command passing location of war file.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.war -name blog <br />
<br />
Output:<br />
Deployed production/webapp/default/blog from ./target/blog-0.1.0.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
To see the deployed you can use resinctl deploy-list<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy-list<br />
<br />
Output:<br />
production/webapp/default/blog<br />
</pre><br />
</code><br />
<br />
TODO explain production/webapp/default/blog<br />
<br />
<br />
Now undeploy it:<br />
<br />
<code><br />
<pre><br />
$ resinctl undeploy blog<br />
<br />
Output:<br />
Undeployed blog from hmux://127.0.0.1:6800<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
At this point there should be nothing<br />
$ resinctl deploy-list<br />
</pre><br />
</code></div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-05T22:24:11Z<p>Rickhigh: /* Deploying to a local server */</p>
<hr />
<div># Setting up a user and password<br />
# Deploying to a local server<br />
# Deploying to a remote server<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
## license-add enabling Resin features<br />
# Deploy to a staging server<br />
## Setting up load balancer to not to deploy to staging server<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
## Installing mysql driver for a web application using config-deploy<br />
## Showing what is in remote config with config-list-ls and config-list-cat<br />
# web-app-deploy settings<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code><br />
<br />
<br />
== Deploying to a local server ==<br />
<br />
Turning on versioning:<br />
<br />
<code><br />
<pre><br />
$ cat /etc/resin/resin.properties | grep deploy<br />
<br />
Output:<br />
deploy_versioning : true<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
<br />
$ sudo grep "web-app-deploy" -A 1 /etc/resin/resin.xml <br />
<br />
Output:<br />
<web-app-deploy path="webapps" versioning="${deploy_versioning}"<br />
expand-preserve-fileset="WEB-INF/work/**"/><br />
<br />
</pre><br />
</code><br />
<br />
"if true, use the web-app's numeric suffix as a version"<br />
<br />
Run deploy command passing location of war file.<br />
<br />
<code><br />
<pre><br />
$ resinctl deploy ./target/blog-0.1.0.war -name blog <br />
<br />
Output:<br />
Deployed production/webapp/default/blog from ./target/blog-0.1.0.war to hmux://127.0.0.1:6800<br />
</pre><br />
</code></div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-05T22:20:47Z<p>Rickhigh: </p>
<hr />
<div># Setting up a user and password<br />
# Deploying to a local server<br />
# Deploying to a remote server<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
## license-add enabling Resin features<br />
# Deploy to a staging server<br />
## Setting up load balancer to not to deploy to staging server<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
## Installing mysql driver for a web application using config-deploy<br />
## Showing what is in remote config with config-list-ls and config-list-cat<br />
# web-app-deploy settings<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code><br />
<br />
<br />
== Deploying to a local server ==<br />
<br />
Turning on versioning:<br />
<br />
<code><br />
<pre><br />
$ cat /etc/resin/resin.properties | grep deploy<br />
<br />
Output:<br />
deploy_versioning : true<br />
</pre><br />
</code><br />
<br />
<code><br />
<pre><br />
<br />
$ sudo grep "web-app-deploy" -A 1 /etc/resin/resin.xml <br />
<br />
Output:<br />
<web-app-deploy path="webapps" versioning="${deploy_versioning}"<br />
expand-preserve-fileset="WEB-INF/work/**"/><br />
<br />
</pre><br />
</code><br />
<br />
"if true, use the web-app's numeric suffix as a version"</div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-05T22:00:17Z<p>Rickhigh: </p>
<hr />
<div># Setting up a user and password<br />
# Deploying to a local server<br />
# Deploying to a remote server<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
## license-add enabling Resin features<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
## Installing mysql driver for a web application using config-deploy<br />
## Showing what is in remote config with config-list-ls and config-list-cat<br />
# web-app-deploy settings<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code></div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-05T21:55:19Z<p>Rickhigh: </p>
<hr />
<div># Setting up a user and password<br />
# Deploying to a local server<br />
# Deploying to a remote server<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
## Installing mysql driver for a web application using config-deploy<br />
## Showing what is in remote config<br />
# web-app-deploy settings<br />
<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code></div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-05T21:53:45Z<p>Rickhigh: </p>
<hr />
<div># Setting up a user and password<br />
# Deploying to a local server<br />
# Deploying to a remote server<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
## Installing mysql driver for a web application using config-deploy<br />
## Showing what is in remote config<br />
<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-ls - list contents of config dir (ex. ./lib)<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
</pre><br />
</code></div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-05T21:49:01Z<p>Rickhigh: </p>
<hr />
<div><br />
# Setting up a user and password<br />
# Deploying to a local server<br />
# Deploying to a remote server<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
# Common tasks<br />
## Deploying a new application deploy<br />
## Listing current versions of deployed application<br />
## Undeploying a new application<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production<br />
<br />
<code><br />
<pre><br />
$ resinctl | grep deploy <br />
deploy - deploys an application<br />
deploy-copy - copies an application<br />
deploy-list - lists all deployed applications<br />
deploy-restart - restarts an application<br />
deploy-start - starts an application<br />
deploy-stop - stops an application<br />
undeploy - undeploys an application<br />
config-deploy - deploys configuration directory<br />
config-undeploy - undeploys a config<br />
<br />
$ resinctl | grep config <br />
config-deploy - deploys configuration directory<br />
config-copy - copies configuration<br />
config-list - lists all deployed configurations<br />
config-list-cat - list contents of config file<br />
config-undeploy - undeploys a config<br />
<br />
</pre><br />
</code></div>Rickhighhttp://wiki3.caucho.com/Resin_Cloud_Deployment_ReferenceResin Cloud Deployment Reference2011-12-05T21:30:09Z<p>Rickhigh: New page: # Setting up a user and password # Deploying to a local server # Deploying to a remote server # Setting up a cloud topology ## Deploying to the Triad # Common tasks ## Using deploy-copy ...</p>
<hr />
<div><br />
<br />
# Setting up a user and password<br />
# Deploying to a local server<br />
# Deploying to a remote server<br />
# Setting up a cloud topology<br />
## Deploying to the Triad<br />
# Common tasks<br />
## Using deploy-copy to promote a release to production<br />
## Using deploy-copy to rollback a release that was deployed to production</div>Rickhigh