Skip to content

Instantly share code, notes, and snippets.

@eduardogpg
Created February 1, 2023 23:46
Show Gist options
  • Select an option

  • Save eduardogpg/9f77fc19e9f8a8b4f09d8e66d4c30e55 to your computer and use it in GitHub Desktop.

Select an option

Save eduardogpg/9f77fc19e9f8a8b4f09d8e66d4c30e55 to your computer and use it in GitHub Desktop.
from fabric.api import run
from fabric.api import env, cd, prefix, sudo
from fabric.api import local
env.hosts = ['104.236.4.54']
env.user = 'eduardo'
env.key_filename = '/home/eduardo/.ssh/id_ed25519.pub'
def deploy():
print('>>> Nos contamos a nuestro servidor remoto.')
with cd('project'):
with cd('cf_medical'):
run('git pull')
with prefix('source env/bin/activate'):
run('pip install -r requirements.txt')
run('python manage.py migrate')
run('python manage.py collectstatic --noinput')
sudo('sudo systemctl restart django')
sudo('sudo systemctl restart nginx')
print("Proceso de deploy finalizado")
def master(commit):
local('git add --all')
local(f'git commit -m "{commit}"')
local('git push origin master')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment