11 Commits

Author SHA1 Message Date
74103cc401 ads 2016-09-30 18:22:13 -04:00
6a27b88465 naming error 2016-09-30 18:18:19 -04:00
d91df030be new work flow 1 2016-09-30 17:54:31 -04:00
2d027afa29 Update create.sh 2016-09-16 14:15:59 -04:00
27afb67a17 stuff 2016-06-17 01:19:20 -04:00
61af6f62b6 stuff 2016-06-17 01:05:53 -04:00
3ff71a5114 stuff 2016-06-17 00:31:13 -04:00
84ad1d92ec stuff 2016-06-17 00:13:03 -04:00
721e94e1e8 stuff 2016-06-16 23:56:31 -04:00
06c0e8b9dd Merge pull request #2 from wmantly/branches
stuff
2016-06-16 23:51:22 -04:00
f831addb5e Merge pull request #1 from wmantly/branches
Branches
2016-06-16 23:25:40 -04:00
6 changed files with 41 additions and 24 deletions

View File

@ -3,35 +3,42 @@
name="$1"
sshURL="$2"
nodePort=`./random_port.py`
eval "$(ssh-agent -s)"
ssh-add /root/.ssh/id_github_rsa
mkdir /var/www/gitwrapper/$name
cd /var/www/gitwrapper/$name
chmod 777 .
echo `pwd`
DJANGO_SETTINGS_MODULE=project.settings.prod
export DJANGO_SETTINGS_MODULE=project.settings.prod
git clone $sshURL .
virtualenv ./env
source env/bin/activate
pip install -r requirements.txt
./scripts/setup.sh
cp /var/www/local_settings.py project/settings/local_settings.py
echo "BRANCH = '$name'" >> project/settings/local_settings.py
python manage.py createcachetable
python3 manage.py migrate
python3 manage.py loaddata "/var/www/django.json"
# set up project from prod, load database
git checkout prod
./manage.py createcachetable
./manage.py migrate
./manage.py loaddata /var/www/django.json
git checkout $name
pip install -r requirements.txt
./scripts/setup.sh
python3 manage.py collectstatic --noinput
python3 manage.py migrate
chmod 777 .
# python3 manage.py collectstatic --noinput
./manage.py migrate
chmod 777 db.sqlite3
# set up apache vhost
echo "<VirtualHost *:80>" > /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
@ -40,7 +47,6 @@ 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 "</VirtualHost>" >> /etc/apache2/sites-enabled/$name.conf
service apache2 restart
/usr/sbin/service apache2 restart
exit 0

View File

@ -5,6 +5,6 @@ sshURL="$2"
rm -rf /var/www/gitwrapper/$name
rm /etc/apache2/sites-enabled/$name.conf
service apache2 reload
/usr/sbin/service apache2 restart
exit 0

9
random_port.py Executable file
View File

@ -0,0 +1,9 @@
#!/usr/bin/env python3
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(('', 0))
addr = s.getsockname()
print (addr[1])
s.close()
exit(0)

View File

@ -11,20 +11,20 @@ var install_dir = '/var/www/gitwrapper/'
var calls = {
create: function(req, res, name, sshURL){
return exec('bash /var/www/gitdeploy/create.sh '+name+' '+sshURL, function(err, stdout, stderr){
return res.json({ title: 'Express' });
console.log(err, stdout, stderr);
return res.json({ title: stdout });
});
},
update: function(req, res, name, sshURL){
return exec('bash /var/www/gitdeploy/update.sh '+name+' '+sshURL, function(err, stdout, stderr){
return res.json({ title: 'Express' });
console.log(err, stdout, stderr);
return res.json({ title: stdout });
});
},
delete: function(req, res, name, sshURL){
return exec('bash /var/www/gitdeploy/delete.sh '+name+' '+sshURL, function(err, stdout, stderr){
return res.json({ title: 'Express' });
console.log(err, stdout, stderr);
return res.json({ title: stdout });
});
}

0
test Normal file
View File

View File

@ -2,23 +2,25 @@
name="$1"
sshURL="$2"
# set up git to auth
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
source env/bin/activate
git stash
git pull --force origin $name
pip install -r requirements.txt
./scripts/setup.sh
python3 manage.py collectstatic --noinput
python3 manage.py migrate
chmod 777 .
chmod 777 db.sqlite3
service apache2 reload
/usr/sbin/service apache2 restart
exit 0