commit
08ec8f8002
33
create.sh
33
create.sh
@ -2,19 +2,25 @@
|
|||||||
|
|
||||||
name="$1"
|
name="$1"
|
||||||
sshURL="$2"
|
sshURL="$2"
|
||||||
|
nodePort=`./random_port.py`
|
||||||
|
workingPath=/var/www/gitwrapper/$name
|
||||||
|
|
||||||
echo "starting $sshURL on $name"
|
echo "starting $sshURL on $name"
|
||||||
|
|
||||||
eval "$(ssh-agent -s)"
|
eval "$(ssh-agent -s)"
|
||||||
ssh-add /root/.ssh/id_github_rsa
|
ssh-add /root/.ssh/id_github_rsa
|
||||||
mkdir /var/www/gitwrapper/$name
|
mkdir $workingPath
|
||||||
cd /var/www/gitwrapper/$name
|
cd $workingPath
|
||||||
chmod 777 .
|
chmod 777 .
|
||||||
echo `pwd`
|
echo `pwd`
|
||||||
|
|
||||||
DJANGO_SETTINGS_MODULE=project.settings.prod
|
DJANGO_SETTINGS_MODULE=project.settings.prod
|
||||||
export DJANGO_SETTINGS_MODULE=project.settings.prod
|
export DJANGO_SETTINGS_MODULE=project.settings.prod
|
||||||
|
|
||||||
|
NODE_ENV='staging'
|
||||||
|
export NODE_ENV='staging'
|
||||||
|
export NODEPORT=$nodePort
|
||||||
|
|
||||||
git clone $sshURL .
|
git clone $sshURL .
|
||||||
|
|
||||||
./scripts/setup.sh
|
./scripts/setup.sh
|
||||||
@ -22,7 +28,9 @@ git clone $sshURL .
|
|||||||
source env/bin/activate
|
source env/bin/activate
|
||||||
|
|
||||||
cp /var/www/local_settings.py project/settings/local_settings.py
|
cp /var/www/local_settings.py project/settings/local_settings.py
|
||||||
echo "BRANCH = '$name'" >> project/settings/local_settings.py
|
echo "BRANCH='$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"
|
echo "checking out to prod for set up"
|
||||||
git checkout prod
|
git checkout prod
|
||||||
@ -40,14 +48,27 @@ python3 manage.py collectstatic --noinput
|
|||||||
python3 manage.py migrate
|
python3 manage.py migrate
|
||||||
chmod 777 db.sqlite3
|
chmod 777 db.sqlite3
|
||||||
|
|
||||||
|
forever stop $workingPath/node_rtc/app.js
|
||||||
|
echo "starting node app on port $nodePort"
|
||||||
|
forever start $workingPath/node_rtc/app.js
|
||||||
|
|
||||||
echo "creating apache VirtualHost file"
|
echo "creating apache VirtualHost file"
|
||||||
|
|
||||||
echo "<VirtualHost *:80>" > /etc/apache2/sites-enabled/$name.conf
|
echo "<VirtualHost *:80>" > /etc/apache2/sites-enabled/$name.conf
|
||||||
echo " ServerName $name.staging.bytedev.co" >> /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 " Alias /static $workingPath/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 " 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 " 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 " # 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 "</VirtualHost>" >> /etc/apache2/sites-enabled/$name.conf
|
echo "</VirtualHost>" >> /etc/apache2/sites-enabled/$name.conf
|
||||||
|
|
||||||
/usr/sbin/service apache2 restart
|
/usr/sbin/service apache2 restart
|
||||||
|
14
update.sh
14
update.sh
@ -1,12 +1,15 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
name="$1"
|
name="$1"
|
||||||
sshURL="$2"
|
sshURL="$2"
|
||||||
|
workingPath = /var/www/gitwrapper/$name
|
||||||
|
|
||||||
eval "$(ssh-agent -s)"
|
eval "$(ssh-agent -s)"
|
||||||
ssh-add /root/.ssh/id_github_rsa
|
ssh-add /root/.ssh/id_github_rsa
|
||||||
|
|
||||||
|
|
||||||
DJANGO_SETTINGS_MODULE=project.settings.prod
|
DJANGO_SETTINGS_MODULE=project.settings.prod
|
||||||
export DJANGO_SETTINGS_MODULE=project.settings.prod
|
export DJANGO_SETTINGS_MODULE=project.settings.prod
|
||||||
cd /var/www/gitwrapper/$name
|
cd $workingPath
|
||||||
|
|
||||||
source env/bin/activate
|
source env/bin/activate
|
||||||
|
|
||||||
@ -14,6 +17,7 @@ git stash
|
|||||||
git pull --force origin $name
|
git pull --force origin $name
|
||||||
|
|
||||||
./scripts/setup.sh
|
./scripts/setup.sh
|
||||||
|
source env/bin/activate
|
||||||
|
|
||||||
python3 manage.py collectstatic --noinput
|
python3 manage.py collectstatic --noinput
|
||||||
python3 manage.py migrate
|
python3 manage.py migrate
|
||||||
@ -21,6 +25,14 @@ python3 manage.py migrate
|
|||||||
chmod 777 .
|
chmod 777 .
|
||||||
chmod 777 db.sqlite3
|
chmod 777 db.sqlite3
|
||||||
|
|
||||||
|
echo "starting node app"
|
||||||
|
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/sbin/service apache2 restart
|
/usr/sbin/service apache2 restart
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user