Can I run systemctl restart gunicorn && systemctl restart nginx
without sudo
? Currently I get:
out: Authentication is required to reload 'gunicorn.service'.
out: Authenticating as: myuser
out: Password:
# coding: utf-8
from fabric.api import *
from fabric.colors import green, red
def production():
env.host_string = '159.xxx.xxx.xx'
env.user = 'myuser'
path = "/home/myuser/myproject/myproject"
print(red("Beginning Deploy:"))
with cd(path):
with prefix('. /home/myuser/myproject/myenv/bin/activate'):
run("pwd")
print(green("Pulling master from git..."))
run("git pull")
print(green("Migrate the database..."))
run("python3 manage.py migrate")
print(green("Restart the uwsgi process"))
run("systemctl restart gunicorn && systemctl restart nginx")
print(red("DONE!"))