diff --git a/deploy/dev-web-deploy b/deploy/dev-web-deploy index 8e53368..11642da 100755 --- a/deploy/dev-web-deploy +++ b/deploy/dev-web-deploy @@ -1,2 +1,5 @@ -rsync -avL --exclude="WEB-INF" --delete ../gwt/war/ red:www/ +source ./config.hosts +server=$M_HOST_DEV + +rsync -avL --exclude="WEB-INF" --delete ../gwt/war/ www@$server: diff --git a/deploy/dev-web-restart b/deploy/dev-web-restart new file mode 100755 index 0000000..15a62e4 --- /dev/null +++ b/deploy/dev-web-restart @@ -0,0 +1,5 @@ +source ./config.hosts +server=$M_HOST_DEV + +scp dev-web-restart.remote www@$server: +ssh www@$server ./dev-web-restart.remote diff --git a/deploy/dev-web-restart.remote b/deploy/dev-web-restart.remote new file mode 100755 index 0000000..6e7a206 --- /dev/null +++ b/deploy/dev-web-restart.remote @@ -0,0 +1,2 @@ +killall -u www python +python -m SimpleHTTPServer > http.log 2>&1 & diff --git a/deploy/web. b/deploy/web. new file mode 100644 index 0000000..e69de29 diff --git a/deploy/web/catalog b/deploy/web/catalog new file mode 100755 index 0000000..58e0f33 --- /dev/null +++ b/deploy/web/catalog @@ -0,0 +1,5 @@ +cd ~ +mkdir -p deploy-catalog +V=`date "+%Y%m%d_%H%M%S"` + +tar -czf deploy-catalog/deploy_$V.tar.gz deploy diff --git a/deploy/web/resources/final.crt b/deploy/web/resources/final.crt new file mode 120000 index 0000000..fef4f37 --- /dev/null +++ b/deploy/web/resources/final.crt @@ -0,0 +1 @@ +../../../keys/nginx/final.crt \ No newline at end of file diff --git a/deploy/web/resources/final.key b/deploy/web/resources/final.key new file mode 120000 index 0000000..20ddbc7 --- /dev/null +++ b/deploy/web/resources/final.key @@ -0,0 +1 @@ +../../../keys/nginx/final.key \ No newline at end of file diff --git a/deploy/web/resources/nginx.conf b/deploy/web/resources/nginx.conf new file mode 100644 index 0000000..6314037 --- /dev/null +++ b/deploy/web/resources/nginx.conf @@ -0,0 +1,56 @@ + +#user nobody; +worker_processes 1; + +error_log ~/run.log; +#error_log logs/error.log notice; +#error_log logs/error.log info; + +#pid logs/nginx.pid; + + +events { + worker_connections 1024; +} + + +http { + include mime.types; + default_type application/octet-stream; + + #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + # '$status $body_bytes_sent "$http_referer" ' + # '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log ~/run.log main; + + sendfile on; + #tcp_nopush on; + + #keepalive_timeout 0; + keepalive_timeout 65; + + gzip on; + + # HTTPS server + # + server { + listen 443; +# server_name mail.mailiverse.com; + + ssl on; + ssl_certificate ~/resources/nginx-ssl.crt; + ssl_certificate_key ~/resources/nginx-ssl.key; + + ssl_session_timeout 5m; + + ssl_protocols SSLv2 SSLv3 TLSv1; + ssl_ciphers HIGH:!aNULL:!MD5; + ssl_prefer_server_ciphers on; + + location / { + autoindex off; + root ~/www/; + } + } +} diff --git a/deploy/web/run b/deploy/web/run new file mode 100755 index 0000000..9bdacce --- /dev/null +++ b/deploy/web/run @@ -0,0 +1,8 @@ +./setup + +echo "----------------------------------------------" >> ../run.log +date >> ../run.log +echo "----------------------------------------------" >> ../run.log + +/usr/bin/nginx -t -c ~/resources/nginx.conf + diff --git a/deploy/web/setup b/deploy/web/setup new file mode 100755 index 0000000..e66315d --- /dev/null +++ b/deploy/web/setup @@ -0,0 +1,3 @@ +cd ~ +ln -fs deploy/resources + diff --git a/deploy/web/shutdown b/deploy/web/shutdown new file mode 100755 index 0000000..df0f3e4 --- /dev/null +++ b/deploy/web/shutdown @@ -0,0 +1 @@ +/usr/bin/nginx -c ~/resources/nginx.conf -s stop diff --git a/deploy/web/www b/deploy/web/www new file mode 120000 index 0000000..cec6c33 --- /dev/null +++ b/deploy/web/www @@ -0,0 +1 @@ +../www \ No newline at end of file diff --git a/ext/apache-tomcat.tar.gz b/ext/apache-tomcat.tar.gz new file mode 120000 index 0000000..e9d450e --- /dev/null +++ b/ext/apache-tomcat.tar.gz @@ -0,0 +1 @@ +apache-tomcat-7.0.37.tar.gz \ No newline at end of file diff --git a/gwt/.settings/com.google.gwt.eclipse.core.prefs b/gwt/.settings/com.google.gwt.eclipse.core.prefs index fb8b63a..1f6c4b7 100644 --- a/gwt/.settings/com.google.gwt.eclipse.core.prefs +++ b/gwt/.settings/com.google.gwt.eclipse.core.prefs @@ -1,4 +1,4 @@ eclipse.preferences.version=1 entryPointModules= filesCopiedToWebInfLib=gwt-servlet.jar -gwtCompileSettings=PGd3dC1jb21waWxlLXNldHRpbmdzPjxsb2ctbGV2ZWw+SU5GTzwvbG9nLWxldmVsPjxvdXRwdXQtc3R5bGU+T0JGVVNDQVRFRDwvb3V0cHV0LXN0eWxlPjxleHRyYS1hcmdzPjwhW0NEQVRBW11dPjwvZXh0cmEtYXJncz48dm0tYXJncz48IVtDREFUQVstWG14NTEybSAtRGd3dC51c2VhcmNoaXZlcz1mYWxzZV1dPjwvdm0tYXJncz48ZW50cnktcG9pbnQtbW9kdWxlPmNvbS5tYWlsaXZlcnNlLmd3dC5NYWlsaXZlcnNlX0dXVDwvZW50cnktcG9pbnQtbW9kdWxlPjwvZ3d0LWNvbXBpbGUtc2V0dGluZ3M+ +gwtCompileSettings=PGd3dC1jb21waWxlLXNldHRpbmdzPjxsb2ctbGV2ZWw+SU5GTzwvbG9nLWxldmVsPjxvdXRwdXQtc3R5bGU+UFJFVFRZPC9vdXRwdXQtc3R5bGU+PGV4dHJhLWFyZ3M+PCFbQ0RBVEFbXV0+PC9leHRyYS1hcmdzPjx2bS1hcmdzPjwhW0NEQVRBWy1YbXg1MTJtIC1EZ3d0LnVzZWFyY2hpdmVzPWZhbHNlXV0+PC92bS1hcmdzPjxlbnRyeS1wb2ludC1tb2R1bGU+Y29tLm1haWxpdmVyc2UuZ3d0Lk1haWxpdmVyc2VfR1dUPC9lbnRyeS1wb2ludC1tb2R1bGU+PC9nd3QtY29tcGlsZS1zZXR0aW5ncz4\= diff --git a/gwt/build.xml b/gwt/build.xml new file mode 100644 index 0000000..e1cb7d0 --- /dev/null +++ b/gwt/build.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/install/THE_SMALLEST_EC2_INSTANCE_YOU_CAN_RUN b/install/THE_SMALLEST_EC2_INSTANCE_YOU_CAN_RUN new file mode 100644 index 0000000..e16cd87 --- /dev/null +++ b/install/THE_SMALLEST_EC2_INSTANCE_YOU_CAN_RUN @@ -0,0 +1,4 @@ +AMI: debian-6.0-squeeze-base-i386-20110417 + +you will need to run: ./enable-sudo ADDRESSOFYOURMACHINE + diff --git a/install/create-server-account-user.remote b/install/create-server-account-user.remote index 94f48f5..9fc3dd4 100755 --- a/install/create-server-account-user.remote +++ b/install/create-server-account-user.remote @@ -2,13 +2,20 @@ set -x USER=$1 -sudo useradd -m $USER -sudo usermod -s /bin/bash $USER -sudo mkdir ../$USER/.ssh -cat authorized_keys | sudo tee -a ../$USER/.ssh/authorized_keys +if [ "$USER" == "root" ] +then + USER_DIR='.' +else + USER_DIR="/home/$USER" + sudo useradd -m $USER + sudo usermod -s /bin/bash $USER +fi -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 -sudo chmod 0700 ../$USER +sudo mkdir $USER_DIR/.ssh +cat authorized_keys | sudo tee -a $USER_DIR/.ssh/authorized_keys + +sudo chown $USER $USER_DIR/.ssh $USER_DIR/.ssh/* +sudo chgrp $USER $USER_DIR/.ssh $USER_DIR/.ssh/* +sudo chmod 0700 $USER_DIR/.ssh +sudo chmod 0644 $USER_DIR/.ssh/authorized_keys +sudo chmod 0700 $USER_DIR diff --git a/install/create-server-accounts b/install/create-server-accounts index ce41de4..0866f18 100755 --- a/install/create-server-accounts +++ b/install/create-server-accounts @@ -1,8 +1,7 @@ if [ -z "$1" ]; then echo "Must supply name"; exit 0; fi set -x -source requirements/server_root_account - +M_ROOT=`cat requirements/server_root_account` M_HOST=$1 scp requirements/id_rsa.pub $M_ROOT@$M_HOST:authorized_keys diff --git a/install/create-server-accounts.remote b/install/create-server-accounts.remote index cd2397c..56c954f 100755 --- a/install/create-server-accounts.remote +++ b/install/create-server-accounts.remote @@ -1,5 +1,6 @@ set -x +./create-server-account-user.remote web ./create-server-account-user.remote james ./create-server-account-user.remote mail-user ./create-server-account-user.remote mail-key diff --git a/install/enable_ec2_login b/install/enable-ec2-login similarity index 88% rename from install/enable_ec2_login rename to install/enable-ec2-login index ed518a3..869c5ad 100755 --- a/install/enable_ec2_login +++ b/install/enable-ec2-login @@ -1,8 +1,7 @@ if [ -z "$1" ]; then echo "Must supply name"; exit 0; fi set -x -source requirements/server_root_account - +M_ROOT=`cat requirements/server_root_account` M_HOST=$1 scp -i requirements/ec2-key.pem requirements/id_rsa.pub $M_ROOT@$M_HOST:authorized_keys diff --git a/install/enable-sudo b/install/enable-sudo new file mode 100755 index 0000000..99f6f5b --- /dev/null +++ b/install/enable-sudo @@ -0,0 +1,8 @@ +if [ -z "$1" ]; then echo "Must supply name"; exit 0; fi + +set -x +M_ROOT=`cat requirements/server_root_account` +M_HOST=$1 + +scp -i requirements/ec2-key.pem enable-sudo.remote $M_ROOT@$M_HOST: +ssh -i requirements/ec2-key.pem $M_ROOT@$M_HOST ./enable-sudo.remote diff --git a/install/enable-sudo.remote b/install/enable-sudo.remote new file mode 100755 index 0000000..d6e6220 --- /dev/null +++ b/install/enable-sudo.remote @@ -0,0 +1,3 @@ +apt-get update +apt-get install sudo + diff --git a/install/requirements/server_root_account b/install/requirements/server_root_account index fdce4ce..d8649da 100644 --- a/install/requirements/server_root_account +++ b/install/requirements/server_root_account @@ -1 +1 @@ -M_ROOT='ubuntu' +root diff --git a/install/setup-java b/install/setup-java index 573c57a..a71e4cc 100755 --- a/install/setup-java +++ b/install/setup-java @@ -1,6 +1,6 @@ set -x -source requirements/server_root_account +M_ROOT=`cat requirements/server_root_account` M_HOST=$1 scp setup-java.remote $M_ROOT@$M_HOST: diff --git a/install/setup-mysql b/install/setup-mysql index 5de6492..2266509 100755 --- a/install/setup-mysql +++ b/install/setup-mysql @@ -1,6 +1,6 @@ set -x -source requirements/server_root_account +M_ROOT=`cat requirements/server_root_account` MAIL_PASSWORD=`cat ../passwords/mail` MAIL_EXTRA_PASSWORD=`cat ../passwords/mail_extra` diff --git a/install/setup-server b/install/setup-server index 334d72d..fe9370d 100755 --- a/install/setup-server +++ b/install/setup-server @@ -8,3 +8,6 @@ M_HOST=$1 ./setup-james $M_HOST ./setup-java $M_HOST ./setup-mysql $M_HOST +./setup-tomcat $M_HOST +./setup-web $M_HOST + diff --git a/install/setup-tomcat b/install/setup-tomcat new file mode 100755 index 0000000..4b58416 --- /dev/null +++ b/install/setup-tomcat @@ -0,0 +1,8 @@ +set -x + +M_HOST=$1 + +scp ../ext/apache-tomcat.tar.gz tomcat@$M_HOST: +scp setup-tomcat.remote tomcat@$M_HOST: + +ssh tomcat@$M_HOST ./setup-tomcat.remote diff --git a/install/setup-tomcat.remote b/install/setup-tomcat.remote new file mode 100755 index 0000000..3f23047 --- /dev/null +++ b/install/setup-tomcat.remote @@ -0,0 +1,10 @@ +set -x + +tar -xzvf apache-tomcat.tar.gz +ln -s apache-tomcat-* tomcat + +ln -s tomcat/logs/catalina.out run.log +mv tomcat/webapps tomcat/webapps.original +mkdir tomcat/webapps + +cd tomcat/webapps && ln -s ../../deploy/WebServer.war Mailiverse.war diff --git a/install/setup-web b/install/setup-web new file mode 100755 index 0000000..e07ab9f --- /dev/null +++ b/install/setup-web @@ -0,0 +1,7 @@ +set -x + +M_ROOT=`cat requirements/server_root_account` +M_HOST=$1 + +scp setup-web.remote $M_ROOT@$M_HOST: +ssh $M_ROOT@$M_HOST ./setup-web.remote diff --git a/install/setup-web.remote b/install/setup-web.remote new file mode 100755 index 0000000..464cb38 --- /dev/null +++ b/install/setup-web.remote @@ -0,0 +1,3 @@ +set -x + +sudo apt-get install nginx --yes