Skip to content

Commit 19305b8

Browse files
committed
iDrop Web hostname reconfigured by cron now.
1 parent 7b71b92 commit 19305b8

11 files changed

+96
-25
lines changed

README.md

+11-3
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,24 @@ Image.
77
This is meant to be installed on an Ubuntu 12.04 Amazon Machine Image.
88
To find an appropriate target, see http://cloud-images.ubuntu.com/locator/ec2/
99

10-
Use the following process to bootstrap the AWS image.
10+
Use the following process to bootstrap the AWS image. The process:
11+
* installs git,
12+
* clones this repository,
13+
* downloads and installs iRODS and iDrop Web 2, and their dependencies,
14+
* installs a cron job to update the iDrop Web 2 config on hostname changes.
1115

1216
```bash
1317
sudo apt-get -y install git
14-
cd /home/ubuntu
18+
cd /opt
1519
git clone https://github.com/beppodb/irods-aws
16-
cd /home/ubuntu/irods-aws
20+
cd /opt/irods-aws
1721
./deploy.sh
1822
sudo shred -u /etc/ssh/*_key /etc/ssh/*_key.pub
1923
sudo shred -u /home/ubuntu/.ssh/authorized_keys
2024
sudo shred -u /home/ubuntu/.*history
2125
history -c
2226
```
27+
28+
The resultant iRODS installation has a single user with a password that is
29+
generated randomly on creation of the instance. Instructions for setting a
30+
new password are in ./per-once/motd.tail, which is displayed at instance login.

deploy.sh

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
#!/bin/bash
2-
sudo cp ./per-boot/* /var/lib/cloud/scripts/per-boot
2+
3+
# deploy.sh
4+
# Deploys iRODS and iDrop Web to an Amazon Machine Image. Includes per-instance script
5+
# to generate random password for iRODS administrator account (i.e., rods).
6+
7+
IRODS_VERSION=$1
8+
DB_PLUGIN_VERSION=$2
9+
310
sudo cp ./per-instance/* /var/lib/cloud/scripts/per-instance
411
cd ./per-once
5-
./build.sh
12+
./build.sh $IRODS_VERSION $DB_PLUGIN_VERSION

per-boot/50-config.sh

-8
This file was deleted.

per-instance/50-genresp.sh

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
#!/bin/bash
2-
RESPFILE="/home/ubuntu/setup_responses"
2+
3+
# 50-genresp.sh
4+
# Generates responses for iRODS' setup_irods.sh script.
5+
# Zone SID, agent key, database admin, and admin password are all randomized.
6+
7+
RESPFILE="/opt/irods-aws/setup_responses"
38

49
echo "irods" > $RESPFILE # service account user ID
510
echo "irods" >> $RESPFILE # service account password

per-instance/51-setupdb.sh

+5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
#!/bin/bash
2+
3+
# 51-setupdb.sh
4+
# Sets up a Postgres database for iRODS by creating a database and user and granting
5+
# privileges to the user.
6+
27
RESPFILE="/home/ubuntu/setup_responses"
38
DBUSER=`tail -n 3 $RESPFILE | head -n 1`
49
DBPASS=`tail -n 2 $RESPFILE | head -n 1`

per-instance/52-config.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
#!/bin/bash
2-
sudo su -c "/var/lib/irods/packaging/setup_irods.sh </home/ubuntu/setup_responses"
2+
3+
# 52-config.sh
4+
# Configures iRODS using the response values in /opt/irods-aws/setup_responses
5+
6+
sudo su -c "/var/lib/irods/packaging/setup_irods.sh < /opt/irods-aws/setup_responses"

per-minute/update-idw-cfg.sh

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
oldFQDN=`sed -n 's/.*serverURL = "http:\/\/\(.*\)".*/\1/p' idrop-web-config2.groovy`
3+
FQDN=`ec2metadata --public-hostname`
4+
5+
if [ "$FQDN" != "$oldFQDN" ]
6+
then
7+
sed -i 's/serverURL.*/serverURL = \"http:\/\/'"$FQDN"'\" \}/g' /etc/idrop-web/idrop-web-config2.groovy
8+
service tomcat6 restart
9+
echo $FQDN > /var/tmp/FQDN
10+
fi

per-once/build.sh

+19-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
11
#!/bin/bash
2+
3+
# build.sh
4+
# Installs iRODS and iDrop Web
5+
6+
IRODS_VERSION=$1
7+
DB_PLUGIN_VERSION=$2
8+
29
sudo apt-get update
3-
sudo apt-get -y install postgresql openjdk-6-jdk tomcat6
4-
wget ftp://ftp.renci.org/pub/irods/releases/4.0.3/irods-icat-4.0.3-64bit.deb
5-
wget ftp://ftp.renci.org/pub/irods/releases/4.0.3/irods-database-plugin-postgres-1.3.deb
6-
sudo dpkg -i irods-database-plugin-postgres-1.3.deb irods-icat-4.0.3-64bit.deb
10+
sudo apt-get -y install postgresql openjdk-7-jdk tomcat7
11+
wget ftp://ftp.renci.org/pub/irods/releases/${IRODS_VERSION}/irods-icat-${IRODS_VERSION}-64bit.deb
12+
wget ftp://ftp.renci.org/pub/irods/releases/${IRODS_VERSION}/irods-database-plugin-postgres-${DB_PLUGIN_VERSION}.deb
13+
sudo dpkg -i irods-database-plugin-postgres-${DB_PLUGIN_VERSION}.deb irods-icat-${IRODS_VERSION}-64bit.deb
714
sudo apt-get -f -y install
815
wget http://people.renci.org/~danb/FOR_DEMOS/iDrop-Web-2/idrop-web2.war
16+
sudo update-java-alternatives -s java-1.7.0-openjdk-amd64
917
sudo mkdir /etc/idrop-web
10-
sudo mkdir /etc/tomcat6
11-
sudo cp ./server.xml /etc/tomcat6
18+
sudo mkdir /etc/tomcat7
19+
sudo cp ./server.xml /etc/tomcat7
1220
sudo cp ./idrop-web-config2.groovy /etc/idrop-web
13-
sudo cp ./idrop-web2.war /var/lib/tomcat6/webapps/ROOT.war
14-
sudo rm -rf /var/lib/tomcat6/webapps/ROOT
21+
sudo cp ./idrop-web2.war /var/lib/tomcat7/webapps/ROOT.war
22+
sudo rm -rf /var/lib/tomcat7/webapps/ROOT
23+
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
24+
sudo cp ./motd.tail /etc
25+
sudo cp ./*.cron /etc/cron.d

per-once/motd.tail

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
This instance has irods-aws installed.
2+
3+
irods-aws is a reference installation of iRODS and iDrop Web 2 on
4+
Amazon's Elastic Compute Cloud (EC2).
5+
6+
The source files for irods-aws are located at
7+
https://github.com/beppodb/irods-aws
8+
9+
The default iRODS installation's zone is named "tempZone".
10+
It has a single resource named "demoResc".
11+
It has a single user, the iRODS administrator, "rods".
12+
13+
The password for rods is randomly generated. You will probably want
14+
to change this password.
15+
16+
To change the iRODS password, use the following commands:
17+
sudo su - irods
18+
iadmin moduser rods password <new password>
19+
iinit
20+
21+
To change the name of the default zone, use the following command:
22+
iadmin modzone tempZone name <new zonename>
23+
24+
When changing the zone name, you will also need to modify the
25+
default zone name in:
26+
/var/lib/irods/.irods/.irodsEnv
27+
/etc/idrop-web/idrop-web-config.groovy
28+
29+
30+

per-once/update-idw-cfg.cron

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* * * * * root /opt/irods-aws/update-idw-cfg.sh

startover.sh

-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
sudo dpkg -P irods-icat irods-database-plugin-postgres
22
sudo rm -rf /tmp/irods /etc/irods /var/lib/irods
3-
4-

0 commit comments

Comments
 (0)