|
|
|
@ -19,9 +19,19 @@ export DJANGO_SETTINGS_MODULE=project.settings.prod
|
|
|
|
|
NODE_ENV='staging'
|
|
|
|
|
export NODE_ENV='staging'
|
|
|
|
|
export NODEPORT=$nodePort
|
|
|
|
|
export djangoURL="http://$name.staging.bytedev.co"
|
|
|
|
|
|
|
|
|
|
git clone $sshURL .
|
|
|
|
|
|
|
|
|
|
echo "creating apache VirtualHost file and showing down"
|
|
|
|
|
|
|
|
|
|
echo "<VirtualHost *:80>" > /etc/apache2/sites-enabled/$name.conf
|
|
|
|
|
echo " ServerName $name.staging.bytedev.co" >> /etc/apache2/sites-enabled/$name.conf
|
|
|
|
|
echo " DocumentRoot $workingPath/static/error_pages" >> /etc/apache2/sites-enabled/$name.conf
|
|
|
|
|
echo "</VirtualHost>" >> /etc/apache2/sites-enabled/$name.conf
|
|
|
|
|
|
|
|
|
|
/usr/sbin/service apache2 reload
|
|
|
|
|
|
|
|
|
|
./scripts/setup.sh
|
|
|
|
|
|
|
|
|
|
source env/bin/activate
|
|
|
|
@ -46,10 +56,11 @@ git checkout $name
|
|
|
|
|
python3 manage.py collectstatic --noinput
|
|
|
|
|
python3 manage.py migrate
|
|
|
|
|
chmod 777 db.sqlite3
|
|
|
|
|
chmod 777 -R .track-storage
|
|
|
|
|
|
|
|
|
|
forever stop $workingPath/node_rtc/app.js
|
|
|
|
|
echo "starting node app on port $nodePort"
|
|
|
|
|
forever start $workingPath/node_rtc/app.js -l
|
|
|
|
|
forever start $workingPath/node_rtc/app.js
|
|
|
|
|
|
|
|
|
|
echo "creating apache VirtualHost file"
|
|
|
|
|
|
|
|
|
@ -61,15 +72,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 " <Location '/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 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 " </Location>" >> /etc/apache2/sites-enabled/$name.conf
|
|
|
|
|
echo " RewriteEngine On" >> /etc/apache2/sites-enabled/$name.conf
|
|
|
|
|
echo " RewriteCond %{HTTP:UPGRADE} ^WebSocket\$ [NC]" >> /etc/apache2/sites-enabled/$name.conf
|
|
|
|
|
echo " RewriteCond %{HTTP:CONNECTION} Upgrade\$ [NC]" >> /etc/apache2/sites-enabled/$name.conf
|
|
|
|
|
echo " RewriteRule .* ws://localhost:$nodePort%{REQUEST_URI} [P]" >> /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 /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 "</VirtualHost>" >> /etc/apache2/sites-enabled/$name.conf
|
|
|
|
|
|
|
|
|
|
/usr/sbin/service apache2 restart
|
|
|
|
|
/usr/sbin/service apache2 reload
|
|
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
|