asd
This commit is contained in:
parent
994a3297c9
commit
3a060d5477
10
create.sh
10
create.sh
@ -3,6 +3,8 @@
|
|||||||
name="$1"
|
name="$1"
|
||||||
sshURL="$2"
|
sshURL="$2"
|
||||||
|
|
||||||
|
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 /var/www/gitwrapper/$name
|
||||||
@ -17,15 +19,19 @@ git clone $sshURL .
|
|||||||
|
|
||||||
./scripts/setup.sh
|
./scripts/setup.sh
|
||||||
|
|
||||||
|
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 "checking out to prod for set up"
|
||||||
git checkout prod
|
git checkout prod
|
||||||
|
|
||||||
python manage.py createcachetable
|
python3 manage.py createcachetable
|
||||||
python3 manage.py migrate
|
python3 manage.py migrate
|
||||||
python3 manage.py loaddata /var/www/django.json
|
python3 manage.py loaddata /var/www/django.json
|
||||||
|
|
||||||
|
echo "checking out to $name for set up"
|
||||||
git checkout $name
|
git checkout $name
|
||||||
|
|
||||||
./scripts/setup.sh
|
./scripts/setup.sh
|
||||||
@ -34,6 +40,8 @@ python3 manage.py collectstatic --noinput
|
|||||||
python3 manage.py migrate
|
python3 manage.py migrate
|
||||||
chmod 777 db.sqlite3
|
chmod 777 db.sqlite3
|
||||||
|
|
||||||
|
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 /var/www/gitwrapper/$name/staticfiles" >> /etc/apache2/sites-enabled/$name.conf
|
||||||
|
@ -10,18 +10,21 @@ var install_dir = '/var/www/gitwrapper/'
|
|||||||
|
|
||||||
var calls = {
|
var calls = {
|
||||||
create: function(req, res, name, sshURL){
|
create: function(req, res, name, sshURL){
|
||||||
|
console.log("create =========================");
|
||||||
return exec('bash /var/www/gitdeploy/create.sh '+name+' '+sshURL, function(err, stdout, stderr){
|
return exec('bash /var/www/gitdeploy/create.sh '+name+' '+sshURL, function(err, stdout, stderr){
|
||||||
console.log(err, stdout, stderr);
|
console.log(err, stdout, stderr);
|
||||||
return res.json({ title: stdout });
|
return res.json({ title: stdout });
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
update: function(req, res, name, sshURL){
|
update: function(req, res, name, sshURL){
|
||||||
|
console.log("update =========================");
|
||||||
return exec('bash /var/www/gitdeploy/update.sh '+name+' '+sshURL, function(err, stdout, stderr){
|
return exec('bash /var/www/gitdeploy/update.sh '+name+' '+sshURL, function(err, stdout, stderr){
|
||||||
console.log(err, stdout, stderr);
|
console.log(err, stdout, stderr);
|
||||||
return res.json({ title: stdout });
|
return res.json({ title: stdout });
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
delete: function(req, res, name, sshURL){
|
delete: function(req, res, name, sshURL){
|
||||||
|
console.log("delete =========================");
|
||||||
return exec('bash /var/www/gitdeploy/delete.sh '+name+' '+sshURL, function(err, stdout, stderr){
|
return exec('bash /var/www/gitdeploy/delete.sh '+name+' '+sshURL, function(err, stdout, stderr){
|
||||||
console.log(err, stdout, stderr);
|
console.log(err, stdout, stderr);
|
||||||
return res.json({ title: stdout });
|
return res.json({ title: stdout });
|
||||||
|
Loading…
x
Reference in New Issue
Block a user