Provisioning a CI as a Service instance

thumbsshameServers

Nov 17, 2013 (3 years and 4 months ago)

89 views

1.
2.
3.
a.
i.
4.
Provisioning a CI as a Service instance
Contents
Provision a new EC2 CentOS instance for CI as a Service
Deploying to DEV or PROD
Other
Opening a port after provisioning the instance
Open ports to public
Provision a new EC2 CentOS instance for CI as a Service
To connect to EC2 instance (example):
ssh -i ciaas-test.pem
root@ec2-174-129-112-111.compute-1.amazonaws.com
Install prerequisite tools and verify they are available in the System path
 
Perform a checkout from
SVN
svn checkout http://stelligent.jira.com/svn/CIAAAS/trunk CIAAS --username
joe.smith
cd ~/CIAAS/provisioner-app
Create WAR file with Grails (Must have Grails 1.1.1 installed) by typing from private workspace location of
htt
p://stelligent.jira.com/svn/CIAAAS/trunk/provisioner-app/
svn up
grails war
It will create a file called
provisioner.war
From the EC2 instance
directory, copy the
to Tomcat webapps:
$HOME
provisioner.war
cp $HOME/provisioner.war $HOME/apache-tomcat-5.5.29/webapps
From MySQL, create the database on the local instance
4.
5.
6.
a.
7.
8.
9.
10.
mysql -h localhost -u root -p
DROP DATABASE IF EXISTS provisionerstelligent;
CREATE DATABASE provisionerstelligent DEFAULT CHARACTER SET latin1;
GRANT ALL ON provisionerstelligent.* TO 'provisioneruser'@'localhost'
IDENTIFIED BY 'dsa8das7';
GRANT ALL ON provisionerstelligent.* TO 'provisioneruser'@'%' IDENTIFIED
BY 'dsa8das7';
exit
Start the Apache Tomcat server
unzip apache-tomcat-5.5.29.zip
chmod +x apache-tomcat-5.5.29
cd $HOME/apache-tomcat-5.5.29/bin
chmod +x startup.sh
nohup ./startup.sh &
Start the Tomcat server from the
folder
/hudson/application/apache-tomcat-5.5.20/bin
Verify Tomcat is running by launching (ec2-
-111.compute-1.amazonaws.com is an
174-129-112
example)
from a web browser
http://ec2-174-129-112-111.compute-1.amazonaws.com:8080/
Run the local SQL files at
against the local
http://stelligent.jira.com/svn/CIAAAS/trunk/provisioner-app/src/sql
database
Install Apache ActiveMQ on the local instance using:
wget
http://gforge.nci.nih.gov/svnroot/commonlibrary/trunk/techstack-2008/linu
x/apache-activemq-5.2.0-bin.tar.gz
gzip -d -f ./apache-activemq-5.2.0-bin.tar.gz
tar -xvf apache-activemq-5.2.0-bin.tar
Start the Apache ActiveMQ
nohup ./apache-activemq-5.2.0/bin/activemq &
Run SQL statements
mysql -h localhost -u root -p
use provisionerstelligent;
source create_project_configuration_properties.sql;
source create_project_initialization.sql;
source create_project_tech_stack.sql;
exit
10.
a.
11.
12.
13.
ec2-
-111.compute-1.amazonaws.com is an example
174-129-112
Verify ActiveMQ is running by launching
http://ec2-174-129-112-111.compute-1.amazonaws.com:8161
from a web browser
/admin/
Copy the resources directory (
) to the
http://stelligent.jira.com/svn/CIAAAS/trunk/provisioner-app/resources
Tomcat
folder
../apache-tomcat-5.5.20/bin
Create an empty directory called
under
(in Windows) or
(
provisioner-key
%USERPROFILE%
$USER_HOME
on *nix environments)
mkdir provisioner-key
ec2-
-111.compute-1.amazonaws.com is an example
174-129-112
Login to the Provisioner
as

http://ec2-174-129-112-111.compute-1.amazonaws.com:8080/provisioner
admin
and provision an instance. This will install Java 1.5, ant 1.8 and MySQL and a CI server on the provisioned
instance.
Deploying to DEV or PROD
# From workstation
ssh -i ciaas-test.pem root@ec2-75-101-234-54.compute-1.amazonaws.com
rm -r -f ~/CIAAS
svn checkout http://stelligent.jira.com/svn/CIAAAS/trunk CIAAS --username
joe.smith
cd ~/CIAAS/provisioner-app
grails war
ssh hudsonuser@provisioner.stelligent.com
cd ~/application/apache-tomcat-5.5.20/bin
./shutdown.sh
cd ~/application/apache-tomcat-5.5.20/webapps
rm -r -f provisioner provisioner.war
# From ec2-75-101-234-54.compute-1.amazonaws.com
scp /root/CIAAS/provisioner-app/target/provisioner.war
hudsonuser@provisioner.stelligent.com:/mnt/hudsonuser/application/apache-tomcat
-5.5.20/webapps
# From provisioner.stelligent.com
rm -r -f ~/CIAAS
cd ~
svn checkout http://stelligent.jira.com/svn/CIAAAS/trunk CIAAS --username
joe.smith
cd ~/CIAAS/provisioner-app/src/sql
mysql -h localhost -u root -p
DROP DATABASE IF EXISTS provisionerstelligent;
CREATE DATABASE provisionerstelligent DEFAULT CHARACTER SET latin1;
GRANT ALL ON provisionerstelligent.* TO 'provisioneruser'@'localhost'
IDENTIFIED BY 'dsa8das7';
GRANT ALL ON provisionerstelligent.* TO 'provisioneruser'@'%' IDENTIFIED BY
'dsa8das7';
use provisionerstelligent;
source create_project_configuration_properties.sql;
source create_project_initialization.sql;
source create_project_tech_stack.sql;
rm -r -f ~/application/apache-tomcat-5.5.20/bin/resources
rm -r -f ~/resources
cp -r ~/CIAAS/provisioner-app/resources ~/
cp -r ~/CIAAS/provisioner-app/resources ~/application/apache-tomcat-5.5.20/bin
cd ~
nohup ./application/apache-tomcat-5.5.20/bin/startup.sh &
Other
ec2-
-111.compute-1.amazonaws.com is an example
174-129-112
scp -i ciaas-test.pem ~/tmp/jdk-6u21-linux-i586.bin
root@ec2-174-129-112-111.compute-1.amazonaws.com:/root
1.
2.
3.
4.
Opening a port after provisioning the instance
Open ports to public
Download the API tools
wget http://s3.amazonaws.com/ec2-downloads/ec2-api-tools.zip
Unzip the API tools and set JAVA_HOME and EC2_HOME variables
unzip ec2-api-tools.zip
Download the X.509 soap key from amazon account (
https://aws-portal.amazon.com/gp/aws/developer/acco
)
unt/index.html?action=access-key
scp ~/tmp/cert-QHNGZPGMLILOD6QI5FQP4R4GCWBDFADC.pem
hudsonuser@ec2-184-73-134-171.compute-1.amazonaws.com:/mnt/hudsonuser/
scp ~/tmp/rsa-APKAIFML4N5O7M2E4SRQ.pem
hudsonuser@ec2-184-73-134-171.compute-1.amazonaws.com:/mnt/hudsonuser/
open the port using ec2-authorize
ec2-authorize -K pk-Z6Q7VNSX7SCEANGOOAWRPMDA4MIRU46P.pem -C
cert-Z6Q7VNSX7SCOAWROOAWPMDA2MIRFU46P.pem default -P tcp -p 31210