You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

48 lines
799 B

# -*- coding: utf-8 -*-
from fabric.api import * # noqa
from deploy.common import BRANCH, PROJECT_NAME
from deploy.stage import HOSTS, USER, PASS
PROJECT_DIR = f'projects/{PROJECT_NAME}'
env.user = USER
env.password = PASS
env.hosts = HOSTS
@task
def pull():
with cd(PROJECT_DIR):
run(f'git pull origin {BRANCH}')
@task
def docker_rebuild():
with cd(PROJECT_DIR):
run('docker-compose build')
run('docker-compose down')
run('docker-compose up -d')
@task
def docker_restart():
with cd(PROJECT_DIR):
run('docker-compose restart web')
@task
def docker_bash():
with cd(PROJECT_DIR):
sudo('docker-compose exec web bash')
@task
def upgrade():
pull()
docker_rebuild()
@task
def update():
pull()
docker_restart()