From 13b1ad3f92461349221f71df58ba3386c5207ae0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20B=C3=B6hner-Figas?= Date: Tue, 20 Sep 2016 16:31:54 +0200 Subject: [PATCH 1/5] Add additional secret copy task --- ade25/fabfiles/project/db.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ade25/fabfiles/project/db.py b/ade25/fabfiles/project/db.py index 8c3f640..15fba17 100644 --- a/ade25/fabfiles/project/db.py +++ b/ade25/fabfiles/project/db.py @@ -1,5 +1,7 @@ # -*- coding: utf-8 -*- """Module providing database management tasks""" +from StringIO import StringIO +from ConfigParser import SafeConfigParser from fabric.api import env from fabric.api import task from fabric.api import run @@ -89,3 +91,17 @@ def get_secrets(): local_dir="./secret.cfg", upload=False, ) + + +@task +def show_secrets(): + """Copy admin user to clipboard""" + path = '{0}/secret.cfg'.format(env.code_root) + fd = StringIO() + get(path, fd) + fd.seek(0) + config_parser = SafeConfigParser(allow_no_value=True) + config_parser.readfp(fd) + secret = config_parser.get('passwords', 'zope-admin') + local('echo "{0}" | pbcopy'.format(secret)) + print('The admin secret is: {0}'.format(secret)) From 26989b966b506d0e1e105a065ba261054d5ff9c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20B=C3=B6hner-Figas?= Date: Thu, 22 Mar 2018 11:17:00 +0100 Subject: [PATCH 2/5] Add basic docker support --- ade25/fabfiles/__init__.py | 1 + ade25/fabfiles/docker/__init__.py | 3 +++ ade25/fabfiles/docker/compose.py | 22 ++++++++++++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 ade25/fabfiles/docker/__init__.py create mode 100644 ade25/fabfiles/docker/compose.py diff --git a/ade25/fabfiles/__init__.py b/ade25/fabfiles/__init__.py index 3ca46a3..f35c875 100644 --- a/ade25/fabfiles/__init__.py +++ b/ade25/fabfiles/__init__.py @@ -1,2 +1,3 @@ import project import server +import docker \ No newline at end of file diff --git a/ade25/fabfiles/docker/__init__.py b/ade25/fabfiles/docker/__init__.py new file mode 100644 index 0000000..9630c6c --- /dev/null +++ b/ade25/fabfiles/docker/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- +"""Module providing docker support""" +import controls \ No newline at end of file diff --git a/ade25/fabfiles/docker/compose.py b/ade25/fabfiles/docker/compose.py new file mode 100644 index 0000000..9b63058 --- /dev/null +++ b/ade25/fabfiles/docker/compose.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +"""Module providing docker compose commands""" +from fabric import api +from fabric.api import task + + +@task +def build(): + """ Build docker container """ + build_dir = '{0}/build'.format(api.env.local_root) + configuration = '-f docker-compose.yml -f docker-compose.traefik.yml' + with api.lcd(build_dir): + api.local('docker-compose {0} build'.format(configuration)) + + +@task +def run(): + """ Run docker container """ + build_dir = '{0}/build'.format(api.env.local_root) + configuration = '-f docker-compose.yml -f docker-compose.traefik.yml' + with api.lcd(build_dir): + api.local('docker-compose {0} up'.format(configuration)) From c6472d24d05850ab2c511eeecdfb86787efeb2a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20B=C3=B6hner-Figas?= Date: Thu, 22 Mar 2018 11:39:12 +0100 Subject: [PATCH 3/5] Fix import error --- ade25/fabfiles/docker/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ade25/fabfiles/docker/__init__.py b/ade25/fabfiles/docker/__init__.py index 9630c6c..0aed640 100644 --- a/ade25/fabfiles/docker/__init__.py +++ b/ade25/fabfiles/docker/__init__.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- """Module providing docker support""" -import controls \ No newline at end of file +import compose \ No newline at end of file From 63310ab62caa35c800606eff099d4fb2f3c0853e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20B=C3=B6hner-Figas?= Date: Thu, 22 Mar 2018 12:12:27 +0100 Subject: [PATCH 4/5] Update compose task --- ade25/fabfiles/docker/compose.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/ade25/fabfiles/docker/compose.py b/ade25/fabfiles/docker/compose.py index 9b63058..05f179d 100644 --- a/ade25/fabfiles/docker/compose.py +++ b/ade25/fabfiles/docker/compose.py @@ -8,15 +8,21 @@ def build(): """ Build docker container """ build_dir = '{0}/build'.format(api.env.local_root) - configuration = '-f docker-compose.yml -f docker-compose.traefik.yml' - with api.lcd(build_dir): - api.local('docker-compose {0} build'.format(configuration)) + configuration = '-f {0}/docker-compose.yml'.format(build_dir) + traefik = '-f {0}/docker-compose.traefik.yml'.format(build_dir) + with api.lcd(api.env.local_root): + api.local('docker-compose {0} {1} build'.format( + configuration, traefik) + ) @task def run(): """ Run docker container """ build_dir = '{0}/build'.format(api.env.local_root) - configuration = '-f docker-compose.yml -f docker-compose.traefik.yml' - with api.lcd(build_dir): - api.local('docker-compose {0} up'.format(configuration)) + configuration = '-f {0}/docker-compose.yml'.format(build_dir) + traefik = '-f {0}/docker-compose.traefik.yml'.format(build_dir) + with api.lcd(api.env.local_root): + api.local('docker-compose {0} {1} up'.format( + configuration, traefik) + ) From 353c4d2c065e729843bf38151caae920de4abb8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20B=C3=B6hner-Figas?= Date: Mon, 14 May 2018 13:21:19 +0200 Subject: [PATCH 5/5] Add fabric verion 1 pins --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 27ab28e..2f95a4e 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ include_package_data=True, zip_safe=False, install_requires=[ - 'Fabric', + 'Fabric==1.14.0', 'cuisine', 'setuptools', 'slacker',