diff --git a/deploy/dev-server-deploy b/deploy/dev-server-deploy index 9897238..cc5409a 100755 --- a/deploy/dev-server-deploy +++ b/deploy/dev-server-deploy @@ -1,6 +1,7 @@ if [ -z "$1" ]; then echo "Must supply name"; exit 0; fi -server="red" +source ../config.hosts +server=$M_HOST_DEV echo stopping... ssh $1@$server "cd deploy && ./shutdown" diff --git a/deploy/dev-tomcat-restart b/deploy/dev-tomcat-restart index a7489ca..10eed8a 100755 --- a/deploy/dev-tomcat-restart +++ b/deploy/dev-tomcat-restart @@ -1,5 +1,6 @@ -server="red" +source ../config.hosts +server=$M_HOST_DEV echo restarting... ssh tomcat@$server "cd deploy && ./restart" diff --git a/deploy/dev-watch b/deploy/dev-watch index 49d044b..e5fa021 100755 --- a/deploy/dev-watch +++ b/deploy/dev-watch @@ -1,5 +1,6 @@ if [ -z "$1" ]; then echo "Must supply name"; exit 0; fi -server="red" +source ../config.hosts +server=$M_HOST_DEV ssh $1@$server "tail -n 100 -f run.log" diff --git a/deploy/server-deploy b/deploy/server-deploy index ca440a7..ea4d2ec 100755 --- a/deploy/server-deploy +++ b/deploy/server-deploy @@ -1,6 +1,7 @@ if [ -z "$1" ]; then echo "Must supply name"; exit 0; fi -server="blue" +source ../config.hosts +server=$M_HOST_PROD echo stopping... ssh $1@$server "cd deploy && ./shutdown" diff --git a/deploy/server-restart b/deploy/server-restart index 1f23982..2d354ab 100755 --- a/deploy/server-restart +++ b/deploy/server-restart @@ -1,6 +1,7 @@ if [ -z "$1" ]; then echo "Must supply name"; exit 0; fi -server="blue" +source ../config.hosts +server=$M_HOST_PROD echo stopping... ssh $1@$server "cd deploy && ./shutdown" diff --git a/deploy/server-shutdown b/deploy/server-shutdown index d1a35c3..f618532 100755 --- a/deploy/server-shutdown +++ b/deploy/server-shutdown @@ -1,6 +1,7 @@ if [ -z "$1" ]; then echo "Must supply name"; exit 0; fi -server="blue" +source ../config.hosts +server=$M_HOST_PROD echo stopping... ssh $1@$server "cd deploy && ./shutdown" diff --git a/deploy/tomcat-restart b/deploy/tomcat-restart index b27ae35..1cd6017 100755 --- a/deploy/tomcat-restart +++ b/deploy/tomcat-restart @@ -1,5 +1,6 @@ -server="blue" +source ../config.hosts +server=$M_HOST_PROD echo restarting... ssh tomcat@$server "cd deploy && ./restart" diff --git a/host.config b/host.config new file mode 100644 index 0000000..039cb2c --- /dev/null +++ b/host.config @@ -0,0 +1,3 @@ +M_ROOT="ubuntu" +M_HOST_PROD="your-prod-host" +M_HOST_DEV="your-dev-host" diff --git a/install/README_FIRST_EVEN_IF_YOU_DONT_WANT_TO b/install/README_FIRST_EVEN_IF_YOU_DONT_WANT_TO new file mode 100644 index 0000000..15c9e28 --- /dev/null +++ b/install/README_FIRST_EVEN_IF_YOU_DONT_WANT_TO @@ -0,0 +1,23 @@ +Things you must do for this to work out of the box: + + +1. You must have .ssh keys for this account.. + +If you don't have them, generate them by googling "generate .ssh keys" and doing whatever it says. + + + + + +2. You must go into the requirements directory and + + a. run "./get_rsa_pub" + + b. if you are going to install to an ec2 instance, + you must create the prod and dev instance and copy the key.pem file into requirements. + and then soft link the ec2-key.pem to your file. + + c. and then, this is really important, you must + +MUAHAHAHAHHAHAHA... just kidding, I'll write the rest soon. + diff --git a/install/create-server-account-user.remote b/install/create-server-account-user.remote new file mode 100755 index 0000000..b6b7855 --- /dev/null +++ b/install/create-server-account-user.remote @@ -0,0 +1,13 @@ +set -x + +USER=$1 + +sudo useradd -m $USER +sudo usermod -s /bin/bash $USER +sudo mkdir ../$USER/.ssh +sudo cp authorized_keys ../$USER/.ssh + +sudo chown $USER ../$USER/.ssh ../$USER/.ssh/* +sudo chgrp $USER ../$USER/.ssh ../$USER/.ssh/* +sudo chmod 0700 ../$USER/.ssh +sudo chmod 0644 ../$USER/.ssh/authorized_keys diff --git a/install/create-server-accounts b/install/create-server-accounts new file mode 100755 index 0000000..199914d --- /dev/null +++ b/install/create-server-accounts @@ -0,0 +1,12 @@ +if [ -z "$1" ]; then echo "Must supply name"; exit 0; fi + +set -x +source ../host.config + +M_HOST=$1 + +scp -i requirements/ec2-key.pem requirements/id_rsa.pub $M_ROOT@$M_HOST:authorized_keys +scp -i requirements/ec2-key.pem create-server-accounts.remote $M_ROOT@$M_HOST: +scp -i requirements/ec2-key.pem create-server-account-user.remote $M_ROOT@$M_HOST: +ssh -i requirements/ec2-key.pem $M_ROOT@$M_HOST ./create-server-accounts.remote + diff --git a/install/create-server-accounts.remote b/install/create-server-accounts.remote new file mode 100755 index 0000000..cd2397c --- /dev/null +++ b/install/create-server-accounts.remote @@ -0,0 +1,8 @@ +set -x + +./create-server-account-user.remote james +./create-server-account-user.remote mail-user +./create-server-account-user.remote mail-key +./create-server-account-user.remote tomcat +./create-server-account-user.remote tunnel +./create-server-account-user.remote tools diff --git a/install/requirements/ec2-key.pem b/install/requirements/ec2-key.pem new file mode 120000 index 0000000..dfb6447 --- /dev/null +++ b/install/requirements/ec2-key.pem @@ -0,0 +1 @@ +your-ec2-key.pem \ No newline at end of file diff --git a/install/requirements/get_rsa_pub b/install/requirements/get_rsa_pub new file mode 100755 index 0000000..f178af9 --- /dev/null +++ b/install/requirements/get_rsa_pub @@ -0,0 +1 @@ +cp ~/.ssh/id_rsa.pub . diff --git a/install/setup-james b/install/setup-james new file mode 100755 index 0000000..74cf22a --- /dev/null +++ b/install/setup-james @@ -0,0 +1,7 @@ +set -x + +M_HOST=$1 + +scp setup-james.remote james@$M_HOST: +ssh james@$M_HOST ./setup-james.remote + diff --git a/install/setup-james.remote b/install/setup-james.remote new file mode 100755 index 0000000..a5133f6 --- /dev/null +++ b/install/setup-james.remote @@ -0,0 +1,11 @@ +set -x + +wget http://apache.mirrors.pair.com//james/apache-james/3.0beta4/apache-james-3.0-beta4-app.tar.gz +tar xzvf apache-james-3.0-beta4-app.tar.gz + +ln -s apache-james-3.0-beta4 apache-james +cd apache-james +mv conf conf-original +ln -s ../apache-james-conf conf + +echo The final pieces will be installed during deploy diff --git a/install/setup-servers b/install/setup-servers new file mode 100755 index 0000000..12b10be --- /dev/null +++ b/install/setup-servers @@ -0,0 +1,9 @@ +set -x +source ../host.config + +./create-server-accounts $M_HOST_PROD +./create-server-accounts $M_HOST_DEV + +./setup-james $M_HOST_PROD +./setup-james $M_HOST_DEV +