diff --git a/.gitignore b/.gitignore index be876a7..6b0f790 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,9 @@ conf/env !form.html /static/vendor +# deploy settings +/deploy/stage.py + ######################All system################################################ # Compiled source # ################### @@ -196,3 +199,4 @@ target/ *.css.map ################################################################################ + diff --git a/deploy/common.py b/deploy/common.py new file mode 100644 index 0000000..7a4f9d3 --- /dev/null +++ b/deploy/common.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +PROJECT_NAME = 'dokumentor' +REPO = 'git@bitbucket.org:Air51/dokumentor_dev.git' +BRANCH = 'develop' diff --git a/deploy/stage.py b/deploy/stage.py new file mode 100644 index 0000000..525ba05 --- /dev/null +++ b/deploy/stage.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +USER = 'mitri4' +PASS = '9091324913Dasha' +HOSTS = ['mitri4.pro:8022'] diff --git a/deploy/stage.py.example b/deploy/stage.py.example new file mode 100644 index 0000000..8475f7e --- /dev/null +++ b/deploy/stage.py.example @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +from deploy.common import * # noqa + +USER = 'username' +PASS = 'password' +HOSTS = ['domain_name:ssh_port'] + diff --git a/fabfile.py b/fabfile.py new file mode 100644 index 0000000..6cac381 --- /dev/null +++ b/fabfile.py @@ -0,0 +1,30 @@ +# -*- 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_update(): + with cd(PROJECT_DIR): + run('docker-compose build') + run('docker-compose down') + run('docker-compose up -d') + + +@task +def update(): + pull() + docker_update() diff --git a/requirements/local.txt b/requirements/local.txt index 3911e19..10335e2 100644 --- a/requirements/local.txt +++ b/requirements/local.txt @@ -5,3 +5,5 @@ sqlparse==0.2.3 django-eml-email-backend==0.1 ipdb==0.10.3 ptpython==0.39 +Fabric3==1.13.1.post1 +Jinja2==2.9.6