From e0963c1c299ef2cf9c3d02de964b3f86baa20f44 Mon Sep 17 00:00:00 2001 From: william mantly Date: Sat, 1 Oct 2016 00:16:40 -0400 Subject: [PATCH 01/25] node --- create.sh | 24 +++++++++++++++++++----- update.sh | 15 +++++++++++++-- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/create.sh b/create.sh index b7429a8..e3c5ca7 100644 --- a/create.sh +++ b/create.sh @@ -7,14 +7,19 @@ echo "starting $sshURL on $name" eval "$(ssh-agent -s)" ssh-add /root/.ssh/id_github_rsa -mkdir /var/www/gitwrapper/$name -cd /var/www/gitwrapper/$name +mkdir $workingPath +cd $workingPath chmod 777 . echo `pwd` +workingPath = /var/www/gitwrapper/$name +nodePort = `./random_port.py` DJANGO_SETTINGS_MODULE=project.settings.prod export DJANGO_SETTINGS_MODULE=project.settings.prod +NODE_ENV = 'staging' +export NODE_ENV = 'staging' + git clone $sshURL . ./scripts/setup.sh @@ -23,6 +28,7 @@ source env/bin/activate cp /var/www/local_settings.py project/settings/local_settings.py echo "BRANCH = '$name'" >> project/settings/local_settings.py +echo "NODEPORT = '$name'" >> project/settings/local_settings.py echo "checking out to prod for set up" git checkout prod @@ -40,14 +46,22 @@ python3 manage.py collectstatic --noinput python3 manage.py migrate chmod 777 db.sqlite3 +echo "starting node add" +forever stop $workingPath/node_rtc/app.js +forever start $workingPath/node_rtc/app.js + echo "creating apache VirtualHost file" echo "" > /etc/apache2/sites-enabled/$name.conf echo " ServerName $name.staging.bytedev.co" >> /etc/apache2/sites-enabled/$name.conf -echo " Alias /static /var/www/gitwrapper/$name/staticfiles" >> /etc/apache2/sites-enabled/$name.conf -echo " WSGIDaemonProcess $name python-path=/var/www/gitwrapper/$name:/var/www/gitwrapper/$name/env:/var/www/gitwrapper/$name/env/lib/python3.5/site-packages" >> /etc/apache2/sites-enabled/$name.conf +echo " Alias /static $workingPath/staticfiles" >> /etc/apache2/sites-enabled/$name.conf +echo " WSGIDaemonProcess $name python-path=$workingPath:$workingPath/env:$workingPath/env/lib/python3.5/site-packages" >> /etc/apache2/sites-enabled/$name.conf echo " WSGIProcessGroup $name" >> /etc/apache2/sites-enabled/$name.conf -echo " WSGIScriptAlias / /var/www/gitwrapper/$name/project/wsgi.py" >> /etc/apache2/sites-enabled/$name.conf +echo " WSGIScriptAlias / $workingPath/project/wsgi.py" >> /etc/apache2/sites-enabled/$name.conf +echo " " >> /etc/apache2/sites-enabled/$name.conf +echo " ProxyPass http://localhost:$nodePort/V1" >> /etc/apache2/sites-enabled/$name.conf +echo " ProxyPassReverse http://localhost:$nodePort/V1" >> /etc/apache2/sites-enabled/$name.conf +echo " " >> /etc/apache2/sites-enabled/$name.conf echo "" >> /etc/apache2/sites-enabled/$name.conf /usr/sbin/service apache2 restart diff --git a/update.sh b/update.sh index 4b8b3bb..57a126c 100644 --- a/update.sh +++ b/update.sh @@ -1,12 +1,16 @@ #!/bin/bash name="$1" sshURL="$2" +workingPath = /var/www/gitwrapper/$name +nodePort = `./random_port.py` eval "$(ssh-agent -s)" ssh-add /root/.ssh/id_github_rsa + + DJANGO_SETTINGS_MODULE=project.settings.prod export DJANGO_SETTINGS_MODULE=project.settings.prod -cd /var/www/gitwrapper/$name +cd $workingPath source env/bin/activate @@ -14,13 +18,20 @@ git stash git pull --force origin $name ./scripts/setup.sh +source env/bin/activate -python3 manage.py collectstatic --noinput +# python3 manage.py collectstatic --noinput python3 manage.py migrate chmod 777 . chmod 777 db.sqlite3 +echo "starting node app" +NODE_ENV = 'staging' +export NODE_ENV = 'staging' +forever stop $workingPath/node_rtc/app.js +forever start $workingPath/node_rtc/app.js + /usr/sbin/service apache2 restart exit 0 From 2f3dacb5690937c3dc2eb17137df94a0e349adb2 Mon Sep 17 00:00:00 2001 From: william mantly Date: Sat, 1 Oct 2016 00:27:46 -0400 Subject: [PATCH 02/25] node --- create.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/create.sh b/create.sh index e3c5ca7..72d83d0 100644 --- a/create.sh +++ b/create.sh @@ -13,12 +13,12 @@ chmod 777 . echo `pwd` workingPath = /var/www/gitwrapper/$name -nodePort = `./random_port.py` +nodePort = `./node_rtc/random_port.py` DJANGO_SETTINGS_MODULE=project.settings.prod export DJANGO_SETTINGS_MODULE=project.settings.prod -NODE_ENV = 'staging' -export NODE_ENV = 'staging' +NODE_ENV ='staging' +export NODE_ENV ='staging' git clone $sshURL . From 7fc8010a606a5ccd90381bf19f99c42f1889a4c6 Mon Sep 17 00:00:00 2001 From: william mantly Date: Sat, 1 Oct 2016 00:34:00 -0400 Subject: [PATCH 03/25] node --- create.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/create.sh b/create.sh index 72d83d0..57e8b6a 100644 --- a/create.sh +++ b/create.sh @@ -2,6 +2,8 @@ name="$1" sshURL="$2" +nodePort = `./random_port.py` +workingPath = /var/www/gitwrapper/$name echo "starting $sshURL on $name" @@ -12,13 +14,11 @@ cd $workingPath chmod 777 . echo `pwd` -workingPath = /var/www/gitwrapper/$name -nodePort = `./node_rtc/random_port.py` DJANGO_SETTINGS_MODULE=project.settings.prod export DJANGO_SETTINGS_MODULE=project.settings.prod -NODE_ENV ='staging' -export NODE_ENV ='staging' +NODE_ENV='staging' +export NODE_ENV='staging' git clone $sshURL . @@ -27,8 +27,8 @@ git clone $sshURL . source env/bin/activate cp /var/www/local_settings.py project/settings/local_settings.py -echo "BRANCH = '$name'" >> project/settings/local_settings.py -echo "NODEPORT = '$name'" >> project/settings/local_settings.py +echo "BRANCH='$name'" >> project/settings/local_settings.py +echo "NODEPORT='$name'" >> project/settings/local_settings.py echo "checking out to prod for set up" git checkout prod From 7437a9fe3b55192601d7a724a90688590780a674 Mon Sep 17 00:00:00 2001 From: william mantly Date: Sat, 1 Oct 2016 00:38:00 -0400 Subject: [PATCH 04/25] node --- create.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/create.sh b/create.sh index 57e8b6a..907b75c 100644 --- a/create.sh +++ b/create.sh @@ -3,7 +3,7 @@ name="$1" sshURL="$2" nodePort = `./random_port.py` -workingPath = /var/www/gitwrapper/$name +workingPath=/var/www/gitwrapper/$name echo "starting $sshURL on $name" From 847407beee988deff597bf5d7576ace54a45418c Mon Sep 17 00:00:00 2001 From: william mantly Date: Sat, 1 Oct 2016 00:48:22 -0400 Subject: [PATCH 05/25] node --- create.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/create.sh b/create.sh index 907b75c..9858008 100644 --- a/create.sh +++ b/create.sh @@ -46,8 +46,8 @@ python3 manage.py collectstatic --noinput python3 manage.py migrate chmod 777 db.sqlite3 -echo "starting node add" forever stop $workingPath/node_rtc/app.js +echo "starting node add" forever start $workingPath/node_rtc/app.js echo "creating apache VirtualHost file" From bfba08b1db18642fcaa5942903d01212d4870404 Mon Sep 17 00:00:00 2001 From: william mantly Date: Sat, 1 Oct 2016 14:21:34 -0400 Subject: [PATCH 06/25] node --- create.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/create.sh b/create.sh index 9858008..ae5f89e 100644 --- a/create.sh +++ b/create.sh @@ -59,8 +59,8 @@ echo " WSGIDaemonProcess $name python-path=$workingPath:$workingPath/env:$wor echo " WSGIProcessGroup $name" >> /etc/apache2/sites-enabled/$name.conf echo " WSGIScriptAlias / $workingPath/project/wsgi.py" >> /etc/apache2/sites-enabled/$name.conf echo " " >> /etc/apache2/sites-enabled/$name.conf -echo " ProxyPass http://localhost:$nodePort/V1" >> /etc/apache2/sites-enabled/$name.conf -echo " ProxyPassReverse http://localhost:$nodePort/V1" >> /etc/apache2/sites-enabled/$name.conf +echo " ProxyPass http://localhost:$nodePort/socket.io" >> /etc/apache2/sites-enabled/$name.conf +echo " ProxyPassReverse http://localhost:$nodePort/socket.io" >> /etc/apache2/sites-enabled/$name.conf echo " " >> /etc/apache2/sites-enabled/$name.conf echo "" >> /etc/apache2/sites-enabled/$name.conf From 0cfb5e54f99a04425948441785e9b712d8f099e9 Mon Sep 17 00:00:00 2001 From: william mantly Date: Sat, 1 Oct 2016 14:36:30 -0400 Subject: [PATCH 07/25] node --- create.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/create.sh b/create.sh index ae5f89e..20d4d18 100644 --- a/create.sh +++ b/create.sh @@ -2,7 +2,7 @@ name="$1" sshURL="$2" -nodePort = `./random_port.py` +nodePort=`./random_port.py` workingPath=/var/www/gitwrapper/$name echo "starting $sshURL on $name" @@ -47,7 +47,7 @@ python3 manage.py migrate chmod 777 db.sqlite3 forever stop $workingPath/node_rtc/app.js -echo "starting node add" +echo "starting node app on port $nodePort" forever start $workingPath/node_rtc/app.js echo "creating apache VirtualHost file" From 28160bb7eb48ff2700f396f164e2aa037703ded0 Mon Sep 17 00:00:00 2001 From: william mantly Date: Sat, 1 Oct 2016 14:47:51 -0400 Subject: [PATCH 08/25] node --- create.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/create.sh b/create.sh index 20d4d18..26e4bbf 100644 --- a/create.sh +++ b/create.sh @@ -19,6 +19,7 @@ export DJANGO_SETTINGS_MODULE=project.settings.prod NODE_ENV='staging' export NODE_ENV='staging' +export NODEPORT=$nodePort git clone $sshURL . From bc1bb7fea2d532c00803d102e68bfb2e29b6e3c7 Mon Sep 17 00:00:00 2001 From: william mantly Date: Sat, 1 Oct 2016 15:23:01 -0400 Subject: [PATCH 09/25] node --- create.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/create.sh b/create.sh index 26e4bbf..605b6ea 100644 --- a/create.sh +++ b/create.sh @@ -59,10 +59,12 @@ echo " Alias /static $workingPath/staticfiles" >> /etc/apache2/sites-enabled/ echo " WSGIDaemonProcess $name python-path=$workingPath:$workingPath/env:$workingPath/env/lib/python3.5/site-packages" >> /etc/apache2/sites-enabled/$name.conf echo " WSGIProcessGroup $name" >> /etc/apache2/sites-enabled/$name.conf echo " WSGIScriptAlias / $workingPath/project/wsgi.py" >> /etc/apache2/sites-enabled/$name.conf -echo " " >> /etc/apache2/sites-enabled/$name.conf -echo " ProxyPass http://localhost:$nodePort/socket.io" >> /etc/apache2/sites-enabled/$name.conf -echo " ProxyPassReverse http://localhost:$nodePort/socket.io" >> /etc/apache2/sites-enabled/$name.conf -echo " " >> /etc/apache2/sites-enabled/$name.conf +echo " # socket.io conf" >> /etc/apache2/sites-enabled/$name.conf +echo " RewriteEngine On" >> /etc/apache2/sites-enabled/$name.conf +echo " RewriteCond %{REQUEST_URI} ^/socket.io/1/websocket [NC]" >> /etc/apache2/sites-enabled/$name.conf +echo " RewriteRule /(.*) ws://localhost:$nodePort/$1 [P,L]" >> /etc/apache2/sites-enabled/$name.conf +echo " ProxyPass /socket.io http://localhost:$nodePort/socket.io" >> /etc/apache2/sites-enabled/$name.conf +echo " ProxyPassReverse /socket.io http://localhost:$nodePort/socket.io" >> /etc/apache2/sites-enabled/$name.conf echo "" >> /etc/apache2/sites-enabled/$name.conf /usr/sbin/service apache2 restart From ece6c19ca3bb95882e8712775dc8983798de62c2 Mon Sep 17 00:00:00 2001 From: william mantly Date: Sat, 1 Oct 2016 15:37:05 -0400 Subject: [PATCH 10/25] node --- create.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/create.sh b/create.sh index 605b6ea..7ca526e 100644 --- a/create.sh +++ b/create.sh @@ -62,7 +62,7 @@ echo " WSGIScriptAlias / $workingPath/project/wsgi.py" >> /etc/apache2/sites- echo " # socket.io conf" >> /etc/apache2/sites-enabled/$name.conf echo " RewriteEngine On" >> /etc/apache2/sites-enabled/$name.conf echo " RewriteCond %{REQUEST_URI} ^/socket.io/1/websocket [NC]" >> /etc/apache2/sites-enabled/$name.conf -echo " RewriteRule /(.*) ws://localhost:$nodePort/$1 [P,L]" >> /etc/apache2/sites-enabled/$name.conf +echo " RewriteRule /(.*) ws://localhost:$nodePort/\$1 [P,L]" >> /etc/apache2/sites-enabled/$name.conf echo " ProxyPass /socket.io http://localhost:$nodePort/socket.io" >> /etc/apache2/sites-enabled/$name.conf echo " ProxyPassReverse /socket.io http://localhost:$nodePort/socket.io" >> /etc/apache2/sites-enabled/$name.conf echo "" >> /etc/apache2/sites-enabled/$name.conf From 7be2696c71d94d0f944655cb5f7b5c062ed77bfe Mon Sep 17 00:00:00 2001 From: william mantly Date: Sat, 1 Oct 2016 16:01:35 -0400 Subject: [PATCH 11/25] node --- create.sh | 1 + update.sh | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/create.sh b/create.sh index 7ca526e..acf2808 100644 --- a/create.sh +++ b/create.sh @@ -30,6 +30,7 @@ source env/bin/activate cp /var/www/local_settings.py project/settings/local_settings.py echo "BRANCH='$name'" >> project/settings/local_settings.py echo "NODEPORT='$name'" >> project/settings/local_settings.py +echo $nodePort > env/nodePort echo "checking out to prod for set up" git checkout prod diff --git a/update.sh b/update.sh index 57a126c..52e897f 100644 --- a/update.sh +++ b/update.sh @@ -2,7 +2,6 @@ name="$1" sshURL="$2" workingPath = /var/www/gitwrapper/$name -nodePort = `./random_port.py` eval "$(ssh-agent -s)" ssh-add /root/.ssh/id_github_rsa @@ -20,15 +19,17 @@ git pull --force origin $name ./scripts/setup.sh source env/bin/activate -# python3 manage.py collectstatic --noinput +python3 manage.py collectstatic --noinput python3 manage.py migrate chmod 777 . chmod 777 db.sqlite3 echo "starting node app" -NODE_ENV = 'staging' -export NODE_ENV = 'staging' +NODE_ENV='staging' +export NODE_ENV='staging' +nodePort=cat env/nodePort +export NODEPORT=$nodePort forever stop $workingPath/node_rtc/app.js forever start $workingPath/node_rtc/app.js From b0b73cdb454da11133dacf74f7e69e46f26a1038 Mon Sep 17 00:00:00 2001 From: william mantly Date: Sat, 1 Oct 2016 16:13:27 -0400 Subject: [PATCH 12/25] node --- create.sh | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/create.sh b/create.sh index acf2808..527fa51 100644 --- a/create.sh +++ b/create.sh @@ -60,12 +60,23 @@ echo " Alias /static $workingPath/staticfiles" >> /etc/apache2/sites-enabled/ echo " WSGIDaemonProcess $name python-path=$workingPath:$workingPath/env:$workingPath/env/lib/python3.5/site-packages" >> /etc/apache2/sites-enabled/$name.conf echo " WSGIProcessGroup $name" >> /etc/apache2/sites-enabled/$name.conf echo " WSGIScriptAlias / $workingPath/project/wsgi.py" >> /etc/apache2/sites-enabled/$name.conf -echo " # socket.io conf" >> /etc/apache2/sites-enabled/$name.conf -echo " RewriteEngine On" >> /etc/apache2/sites-enabled/$name.conf -echo " RewriteCond %{REQUEST_URI} ^/socket.io/1/websocket [NC]" >> /etc/apache2/sites-enabled/$name.conf -echo " RewriteRule /(.*) ws://localhost:$nodePort/\$1 [P,L]" >> /etc/apache2/sites-enabled/$name.conf -echo " ProxyPass /socket.io http://localhost:$nodePort/socket.io" >> /etc/apache2/sites-enabled/$name.conf -echo " ProxyPassReverse /socket.io http://localhost:$nodePort/socket.io" >> /etc/apache2/sites-enabled/$name.conf +echo " // socket.io conf" >> /etc/apache2/sites-enabled/$name.conf + +echo " ProxyPreserveHost On" >> /etc/apache2/sites-enabled/$name.conf +echo " //these next two lines are to enable the wstunnel" >> /etc/apache2/sites-enabled/$name.conf +echo " ProxyPass /socket.io/1/websocket ws://localhost:$nodePort/socket.io/1/websocket" >> /etc/apache2/sites-enabled/$name.conf +echo " ProxyPassReverse /socket.io/1/websocket ws://localhost:$nodePort/socket.io/1/websocket" >> /etc/apache2/sites-enabled/$name.conf +echo " //this line is to retrieve the socket.io.js to use" >> /etc/apache2/sites-enabled/$name.conf +echo " ProxyPass /socket.io/ http://localhost:$nodePort/socket.io/" >> /etc/apache2/sites-enabled/$name.conf + + + + +# echo " RewriteEngine On" >> /etc/apache2/sites-enabled/$name.conf +# echo " RewriteCond %{REQUEST_URI} ^/socket.io/1/websocket [NC]" >> /etc/apache2/sites-enabled/$name.conf +# echo " RewriteRule /(.*) ws://localhost:$nodePort/\$1 [P,L]" >> /etc/apache2/sites-enabled/$name.conf +# echo " ProxyPass /socket.io http://localhost:$nodePort/socket.io" >> /etc/apache2/sites-enabled/$name.conf +# echo " ProxyPassReverse /socket.io http://localhost:$nodePort/socket.io" >> /etc/apache2/sites-enabled/$name.conf echo "" >> /etc/apache2/sites-enabled/$name.conf /usr/sbin/service apache2 restart From ea34a46d7555a884f264bffc9aa010f531569b36 Mon Sep 17 00:00:00 2001 From: william mantly Date: Sat, 1 Oct 2016 16:22:34 -0400 Subject: [PATCH 13/25] node --- create.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/create.sh b/create.sh index 527fa51..82f9f6d 100644 --- a/create.sh +++ b/create.sh @@ -60,13 +60,13 @@ echo " Alias /static $workingPath/staticfiles" >> /etc/apache2/sites-enabled/ echo " WSGIDaemonProcess $name python-path=$workingPath:$workingPath/env:$workingPath/env/lib/python3.5/site-packages" >> /etc/apache2/sites-enabled/$name.conf echo " WSGIProcessGroup $name" >> /etc/apache2/sites-enabled/$name.conf echo " WSGIScriptAlias / $workingPath/project/wsgi.py" >> /etc/apache2/sites-enabled/$name.conf -echo " // socket.io conf" >> /etc/apache2/sites-enabled/$name.conf +echo " # socket.io conf" >> /etc/apache2/sites-enabled/$name.conf echo " ProxyPreserveHost On" >> /etc/apache2/sites-enabled/$name.conf -echo " //these next two lines are to enable the wstunnel" >> /etc/apache2/sites-enabled/$name.conf +echo " # these next two lines are to enable the wstunnel" >> /etc/apache2/sites-enabled/$name.conf echo " ProxyPass /socket.io/1/websocket ws://localhost:$nodePort/socket.io/1/websocket" >> /etc/apache2/sites-enabled/$name.conf echo " ProxyPassReverse /socket.io/1/websocket ws://localhost:$nodePort/socket.io/1/websocket" >> /etc/apache2/sites-enabled/$name.conf -echo " //this line is to retrieve the socket.io.js to use" >> /etc/apache2/sites-enabled/$name.conf +echo " # this line is to retrieve the socket.io.js to use" >> /etc/apache2/sites-enabled/$name.conf echo " ProxyPass /socket.io/ http://localhost:$nodePort/socket.io/" >> /etc/apache2/sites-enabled/$name.conf From a0811cc7ccb756d7eb4137089cccfc87a0dbb1d7 Mon Sep 17 00:00:00 2001 From: william mantly Date: Sat, 1 Oct 2016 16:39:18 -0400 Subject: [PATCH 14/25] node --- create.sh | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/create.sh b/create.sh index 82f9f6d..b2a71d9 100644 --- a/create.sh +++ b/create.sh @@ -62,14 +62,21 @@ echo " WSGIProcessGroup $name" >> /etc/apache2/sites-enabled/$name.conf echo " WSGIScriptAlias / $workingPath/project/wsgi.py" >> /etc/apache2/sites-enabled/$name.conf echo " # socket.io conf" >> /etc/apache2/sites-enabled/$name.conf -echo " ProxyPreserveHost On" >> /etc/apache2/sites-enabled/$name.conf -echo " # these next two lines are to enable the wstunnel" >> /etc/apache2/sites-enabled/$name.conf -echo " ProxyPass /socket.io/1/websocket ws://localhost:$nodePort/socket.io/1/websocket" >> /etc/apache2/sites-enabled/$name.conf -echo " ProxyPassReverse /socket.io/1/websocket ws://localhost:$nodePort/socket.io/1/websocket" >> /etc/apache2/sites-enabled/$name.conf -echo " # this line is to retrieve the socket.io.js to use" >> /etc/apache2/sites-enabled/$name.conf -echo " ProxyPass /socket.io/ http://localhost:$nodePort/socket.io/" >> /etc/apache2/sites-enabled/$name.conf +echo " RewriteEngine on" >> /etc/apache2/sites-enabled/$name.conf +echo " RewriteCond %{QUERY_STRING} transport=polling" >> /etc/apache2/sites-enabled/$name.conf +echo " RewriteRule /(.*)$ http://localhost:$nodePort/\$1 [P]" >> /etc/apache2/sites-enabled/$name.conf +echo " ProxyRequests off" >> /etc/apache2/sites-enabled/$name.conf +echo " ProxyPass /socket.io/ ws://localhost:$nodePort/\socket.io/" >> /etc/apache2/sites-enabled/$name.conf +echo " ProxyPassReverse /socket.io/ ws://localhost:$nodePort/\socket.io/" >> /etc/apache2/sites-enabled/$name.conf + +# echo " ProxyPreserveHost On" >> /etc/apache2/sites-enabled/$name.conf +# echo " # these next two lines are to enable the wstunnel" >> /etc/apache2/sites-enabled/$name.conf +# echo " ProxyPass /socket.io/1/websocket ws://localhost:$nodePort/socket.io/1/websocket" >> /etc/apache2/sites-enabled/$name.conf +# echo " ProxyPassReverse /socket.io/1/websocket ws://localhost:$nodePort/socket.io/1/websocket" >> /etc/apache2/sites-enabled/$name.conf +# echo " # this line is to retrieve the socket.io.js to use" >> /etc/apache2/sites-enabled/$name.conf +# echo " ProxyPass /socket.io/ http://localhost:$nodePort/socket.io/" >> /etc/apache2/sites-enabled/$name.conf # echo " RewriteEngine On" >> /etc/apache2/sites-enabled/$name.conf From f1b329b7d7924da03d45a4d2a88ff28f0bbe92a5 Mon Sep 17 00:00:00 2001 From: william mantly Date: Sat, 1 Oct 2016 16:45:27 -0400 Subject: [PATCH 15/25] node --- create.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/create.sh b/create.sh index b2a71d9..f7422cb 100644 --- a/create.sh +++ b/create.sh @@ -62,14 +62,17 @@ echo " WSGIProcessGroup $name" >> /etc/apache2/sites-enabled/$name.conf echo " WSGIScriptAlias / $workingPath/project/wsgi.py" >> /etc/apache2/sites-enabled/$name.conf echo " # socket.io conf" >> /etc/apache2/sites-enabled/$name.conf -echo " RewriteEngine on" >> /etc/apache2/sites-enabled/$name.conf +echo " " >> /etc/apache2/sites-enabled/$name.conf +echo " ProxyPass http://localhost:$nodePort/socket.io" >> /etc/apache2/sites-enabled/$name.conf +echo " ProxyPassReverse http://localhost:$nodePort/socket.io" >> /etc/apache2/sites-enabled/$name.conf +echo " " >> /etc/apache2/sites-enabled/$name.conf -echo " RewriteCond %{QUERY_STRING} transport=polling" >> /etc/apache2/sites-enabled/$name.conf -echo " RewriteRule /(.*)$ http://localhost:$nodePort/\$1 [P]" >> /etc/apache2/sites-enabled/$name.conf - -echo " ProxyRequests off" >> /etc/apache2/sites-enabled/$name.conf -echo " ProxyPass /socket.io/ ws://localhost:$nodePort/\socket.io/" >> /etc/apache2/sites-enabled/$name.conf -echo " ProxyPassReverse /socket.io/ ws://localhost:$nodePort/\socket.io/" >> /etc/apache2/sites-enabled/$name.conf +# echo " RewriteEngine on" >> /etc/apache2/sites-enabled/$name.conf +# echo " RewriteCond %{QUERY_STRING} transport=polling" >> /etc/apache2/sites-enabled/$name.conf +# echo " RewriteRule /(.*)$ http://localhost:$nodePort/\$1 [P]" >> /etc/apache2/sites-enabled/$name.conf +# echo " ProxyRequests off" >> /etc/apache2/sites-enabled/$name.conf +# echo " ProxyPass /socket.io/ ws://localhost:$nodePort/\socket.io/" >> /etc/apache2/sites-enabled/$name.conf +# echo " ProxyPassReverse /socket.io/ ws://localhost:$nodePort/\socket.io/" >> /etc/apache2/sites-enabled/$name.conf # echo " ProxyPreserveHost On" >> /etc/apache2/sites-enabled/$name.conf # echo " # these next two lines are to enable the wstunnel" >> /etc/apache2/sites-enabled/$name.conf From 560629e5bbe825e5b37a5d725d09d241a43ef58e Mon Sep 17 00:00:00 2001 From: william mantly Date: Sat, 1 Oct 2016 16:51:56 -0400 Subject: [PATCH 16/25] node --- create.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/create.sh b/create.sh index f7422cb..6778fbc 100644 --- a/create.sh +++ b/create.sh @@ -65,6 +65,8 @@ echo " # socket.io conf" >> /etc/apache2/sites-enabled/$name.conf echo " " >> /etc/apache2/sites-enabled/$name.conf echo " ProxyPass http://localhost:$nodePort/socket.io" >> /etc/apache2/sites-enabled/$name.conf echo " ProxyPassReverse http://localhost:$nodePort/socket.io" >> /etc/apache2/sites-enabled/$name.conf +echo " ProxyPass ws://localhost:$nodePort/socket.io" >> /etc/apache2/sites-enabled/$name.conf +echo " ProxyPass wss://localhost:$nodePort/socket.io" >> /etc/apache2/sites-enabled/$name.conf echo " " >> /etc/apache2/sites-enabled/$name.conf # echo " RewriteEngine on" >> /etc/apache2/sites-enabled/$name.conf From 73e46f0ce9ba6eefb67a7d1be764adcfdf895738 Mon Sep 17 00:00:00 2001 From: william mantly Date: Sat, 1 Oct 2016 17:32:25 -0400 Subject: [PATCH 17/25] node --- create.sh | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/create.sh b/create.sh index 6778fbc..a28994b 100644 --- a/create.sh +++ b/create.sh @@ -63,32 +63,12 @@ echo " WSGIScriptAlias / $workingPath/project/wsgi.py" >> /etc/apache2/sites- echo " # socket.io conf" >> /etc/apache2/sites-enabled/$name.conf echo " " >> /etc/apache2/sites-enabled/$name.conf +echo " RewriteEngine On" >> /etc/apache2/sites-enabled/$name.conf +echo " RewriteCond %{REQUEST_URI} ^/socket.io/1/websocket [NC]" >> /etc/apache2/sites-enabled/$name.conf +echo " RewriteRule socket.io/(.*) ws://localhost:$nodePort/socket.io/\$1 [P,L]" >> /etc/apache2/sites-enabled/$name.conf echo " ProxyPass http://localhost:$nodePort/socket.io" >> /etc/apache2/sites-enabled/$name.conf echo " ProxyPassReverse http://localhost:$nodePort/socket.io" >> /etc/apache2/sites-enabled/$name.conf -echo " ProxyPass ws://localhost:$nodePort/socket.io" >> /etc/apache2/sites-enabled/$name.conf -echo " ProxyPass wss://localhost:$nodePort/socket.io" >> /etc/apache2/sites-enabled/$name.conf echo " " >> /etc/apache2/sites-enabled/$name.conf - -# echo " RewriteEngine on" >> /etc/apache2/sites-enabled/$name.conf -# echo " RewriteCond %{QUERY_STRING} transport=polling" >> /etc/apache2/sites-enabled/$name.conf -# echo " RewriteRule /(.*)$ http://localhost:$nodePort/\$1 [P]" >> /etc/apache2/sites-enabled/$name.conf -# echo " ProxyRequests off" >> /etc/apache2/sites-enabled/$name.conf -# echo " ProxyPass /socket.io/ ws://localhost:$nodePort/\socket.io/" >> /etc/apache2/sites-enabled/$name.conf -# echo " ProxyPassReverse /socket.io/ ws://localhost:$nodePort/\socket.io/" >> /etc/apache2/sites-enabled/$name.conf - -# echo " ProxyPreserveHost On" >> /etc/apache2/sites-enabled/$name.conf -# echo " # these next two lines are to enable the wstunnel" >> /etc/apache2/sites-enabled/$name.conf -# echo " ProxyPass /socket.io/1/websocket ws://localhost:$nodePort/socket.io/1/websocket" >> /etc/apache2/sites-enabled/$name.conf -# echo " ProxyPassReverse /socket.io/1/websocket ws://localhost:$nodePort/socket.io/1/websocket" >> /etc/apache2/sites-enabled/$name.conf -# echo " # this line is to retrieve the socket.io.js to use" >> /etc/apache2/sites-enabled/$name.conf -# echo " ProxyPass /socket.io/ http://localhost:$nodePort/socket.io/" >> /etc/apache2/sites-enabled/$name.conf - - -# echo " RewriteEngine On" >> /etc/apache2/sites-enabled/$name.conf -# echo " RewriteCond %{REQUEST_URI} ^/socket.io/1/websocket [NC]" >> /etc/apache2/sites-enabled/$name.conf -# echo " RewriteRule /(.*) ws://localhost:$nodePort/\$1 [P,L]" >> /etc/apache2/sites-enabled/$name.conf -# echo " ProxyPass /socket.io http://localhost:$nodePort/socket.io" >> /etc/apache2/sites-enabled/$name.conf -# echo " ProxyPassReverse /socket.io http://localhost:$nodePort/socket.io" >> /etc/apache2/sites-enabled/$name.conf echo "" >> /etc/apache2/sites-enabled/$name.conf /usr/sbin/service apache2 restart From 1c3901af276fd5d86fa20ae9604e150dbc03c4a1 Mon Sep 17 00:00:00 2001 From: william mantly Date: Sat, 1 Oct 2016 18:40:55 -0400 Subject: [PATCH 18/25] node --- create.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/create.sh b/create.sh index a28994b..a81eca9 100644 --- a/create.sh +++ b/create.sh @@ -29,7 +29,7 @@ source env/bin/activate cp /var/www/local_settings.py project/settings/local_settings.py echo "BRANCH='$name'" >> project/settings/local_settings.py -echo "NODEPORT='$name'" >> project/settings/local_settings.py +echo "NODEPORT='$nodePort'" >> project/settings/local_settings.py echo $nodePort > env/nodePort echo "checking out to prod for set up" From 38a592e29e92a3ecc79a658af2e85f553ee94ee8 Mon Sep 17 00:00:00 2001 From: william mantly Date: Sat, 1 Oct 2016 21:19:17 -0400 Subject: [PATCH 19/25] node --- create.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/create.sh b/create.sh index a81eca9..1d3bc2f 100644 --- a/create.sh +++ b/create.sh @@ -2,7 +2,7 @@ name="$1" sshURL="$2" -nodePort=`./random_port.py` +nodePort=`python -c 'import socket; s=socket.socket(); s.bind(("", 0)); print(s.getsockname()[1]); s.close()'` workingPath=/var/www/gitwrapper/$name echo "starting $sshURL on $name" From 7819cdda0dc071d50260be96e95b7e486391de04 Mon Sep 17 00:00:00 2001 From: william mantly Date: Sat, 1 Oct 2016 21:28:24 -0400 Subject: [PATCH 20/25] node --- create.sh | 4 ++-- update.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/create.sh b/create.sh index 1d3bc2f..cb91b78 100644 --- a/create.sh +++ b/create.sh @@ -48,9 +48,9 @@ python3 manage.py collectstatic --noinput python3 manage.py migrate chmod 777 db.sqlite3 -forever stop $workingPath/node_rtc/app.js +/usr/local/bin/forever stop $workingPath/node_rtc/app.js echo "starting node app on port $nodePort" -forever start $workingPath/node_rtc/app.js +/usr/local/bin/forever start $workingPath/node_rtc/app.js -l echo "creating apache VirtualHost file" diff --git a/update.sh b/update.sh index 52e897f..cf7bd6b 100644 --- a/update.sh +++ b/update.sh @@ -30,8 +30,8 @@ NODE_ENV='staging' export NODE_ENV='staging' nodePort=cat env/nodePort export NODEPORT=$nodePort -forever stop $workingPath/node_rtc/app.js -forever start $workingPath/node_rtc/app.js +/usr/local/bin/forever stop $workingPath/node_rtc/app.js +/usr/local/bin/forever start $workingPath/node_rtc/app.js /usr/sbin/service apache2 restart From e974481688483319e3a2c01d24606f0ca30e8c01 Mon Sep 17 00:00:00 2001 From: william mantly Date: Sat, 1 Oct 2016 21:42:10 -0400 Subject: [PATCH 21/25] node --- create.sh | 3 ++- update.sh | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/create.sh b/create.sh index cb91b78..afe0c16 100644 --- a/create.sh +++ b/create.sh @@ -1,5 +1,5 @@ #!/bin/bash - +PATH=PATH:/opt/someApp/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin name="$1" sshURL="$2" nodePort=`python -c 'import socket; s=socket.socket(); s.bind(("", 0)); print(s.getsockname()[1]); s.close()'` @@ -16,6 +16,7 @@ echo `pwd` DJANGO_SETTINGS_MODULE=project.settings.prod export DJANGO_SETTINGS_MODULE=project.settings.prod +export PATH=PATH NODE_ENV='staging' export NODE_ENV='staging' diff --git a/update.sh b/update.sh index cf7bd6b..09f45eb 100644 --- a/update.sh +++ b/update.sh @@ -2,15 +2,15 @@ name="$1" sshURL="$2" workingPath = /var/www/gitwrapper/$name - +PATH=PATH:/opt/someApp/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin eval "$(ssh-agent -s)" ssh-add /root/.ssh/id_github_rsa +cd $workingPath DJANGO_SETTINGS_MODULE=project.settings.prod export DJANGO_SETTINGS_MODULE=project.settings.prod -cd $workingPath - +export PATH=PATH source env/bin/activate git stash From 6b280d357a7a41e7a072e3f69e3f38e0481bca45 Mon Sep 17 00:00:00 2001 From: william mantly Date: Sat, 1 Oct 2016 21:46:30 -0400 Subject: [PATCH 22/25] node --- create.sh | 2 +- update.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/create.sh b/create.sh index afe0c16..73d9d59 100644 --- a/create.sh +++ b/create.sh @@ -1,5 +1,5 @@ #!/bin/bash -PATH=PATH:/opt/someApp/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games name="$1" sshURL="$2" nodePort=`python -c 'import socket; s=socket.socket(); s.bind(("", 0)); print(s.getsockname()[1]); s.close()'` diff --git a/update.sh b/update.sh index 09f45eb..e11932a 100644 --- a/update.sh +++ b/update.sh @@ -2,7 +2,7 @@ name="$1" sshURL="$2" workingPath = /var/www/gitwrapper/$name -PATH=PATH:/opt/someApp/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games eval "$(ssh-agent -s)" ssh-add /root/.ssh/id_github_rsa cd $workingPath From ca2132f372b61337a76028e3d0234ab37054a295 Mon Sep 17 00:00:00 2001 From: william mantly Date: Sat, 1 Oct 2016 21:49:14 -0400 Subject: [PATCH 23/25] node --- create.sh | 2 -- update.sh | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/create.sh b/create.sh index 73d9d59..21b6d2a 100644 --- a/create.sh +++ b/create.sh @@ -1,5 +1,4 @@ #!/bin/bash -PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games name="$1" sshURL="$2" nodePort=`python -c 'import socket; s=socket.socket(); s.bind(("", 0)); print(s.getsockname()[1]); s.close()'` @@ -16,7 +15,6 @@ echo `pwd` DJANGO_SETTINGS_MODULE=project.settings.prod export DJANGO_SETTINGS_MODULE=project.settings.prod -export PATH=PATH NODE_ENV='staging' export NODE_ENV='staging' diff --git a/update.sh b/update.sh index e11932a..6ab1b69 100644 --- a/update.sh +++ b/update.sh @@ -2,7 +2,7 @@ name="$1" sshURL="$2" workingPath = /var/www/gitwrapper/$name -PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games + eval "$(ssh-agent -s)" ssh-add /root/.ssh/id_github_rsa cd $workingPath @@ -10,7 +10,6 @@ cd $workingPath DJANGO_SETTINGS_MODULE=project.settings.prod export DJANGO_SETTINGS_MODULE=project.settings.prod -export PATH=PATH source env/bin/activate git stash From d85ba96a415e7e635ca49982787d5ba3bd64c0c5 Mon Sep 17 00:00:00 2001 From: william mantly Date: Sat, 1 Oct 2016 21:58:20 -0400 Subject: [PATCH 24/25] node --- create.sh | 4 ++-- update.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/create.sh b/create.sh index 21b6d2a..060b959 100644 --- a/create.sh +++ b/create.sh @@ -47,9 +47,9 @@ python3 manage.py collectstatic --noinput python3 manage.py migrate chmod 777 db.sqlite3 -/usr/local/bin/forever stop $workingPath/node_rtc/app.js +forever stop $workingPath/node_rtc/app.js echo "starting node app on port $nodePort" -/usr/local/bin/forever start $workingPath/node_rtc/app.js -l +forever start $workingPath/node_rtc/app.js -l echo "creating apache VirtualHost file" diff --git a/update.sh b/update.sh index 6ab1b69..d34c85b 100644 --- a/update.sh +++ b/update.sh @@ -29,8 +29,8 @@ NODE_ENV='staging' export NODE_ENV='staging' nodePort=cat env/nodePort export NODEPORT=$nodePort -/usr/local/bin/forever stop $workingPath/node_rtc/app.js -/usr/local/bin/forever start $workingPath/node_rtc/app.js +forever stop $workingPath/node_rtc/app.js +forever start $workingPath/node_rtc/app.js /usr/sbin/service apache2 restart From e119234161d2abb4bbeccb9a30ffa90c034ec791 Mon Sep 17 00:00:00 2001 From: william mantly Date: Sat, 1 Oct 2016 22:01:27 -0400 Subject: [PATCH 25/25] node --- update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update.sh b/update.sh index d34c85b..0069305 100644 --- a/update.sh +++ b/update.sh @@ -1,7 +1,7 @@ #!/bin/bash name="$1" sshURL="$2" -workingPath = /var/www/gitwrapper/$name +workingPath=/var/www/gitwrapper/$name eval "$(ssh-agent -s)" ssh-add /root/.ssh/id_github_rsa