Last active
May 5, 2020 11:16
-
-
Save astrotars/d2976cae528e040cd1b4e792f26502e7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fabric.api import * | |
# host | |
env.hosts = ['104.248.51.33'] | |
# username | |
env.user = 'root' | |
# or, specify path to server public key here: | |
env.key_filename = '~/.ssh/id_rsa.pub' | |
# specify path to deploy root dir - you need to create this | |
env.deploy_project_root = '/var/www/Winds' | |
def move(): | |
# move to the correct directory | |
with cd('%s' % env.deploy_project_root): | |
# pull latest code | |
print('fetching updates from github') | |
sudo('git pull origin master') | |
def install(): | |
# install dependencies for root build | |
sudo('cd %s' % (env.deploy_project_root + '/ && yarn install --production')) | |
# install dependencies for api build | |
sudo('cd %s' % (env.deploy_project_root + '/api && yarn install --production')) | |
def restart(): | |
# restart pm2 | |
sudo('cd %s' % (env.deploy_project_root + '/ && pm2 restart all --update-env')) | |
def deploy(): | |
move() | |
install() | |
restart() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment