Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
potzenheimer committed Sep 20, 2018
2 parents fe5e5b8 + 353c4d2 commit a9a7fbb
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 1 deletion.
1 change: 1 addition & 0 deletions ade25/fabfiles/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
import project
import server
import docker
3 changes: 3 additions & 0 deletions ade25/fabfiles/docker/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
"""Module providing docker support"""
import compose
28 changes: 28 additions & 0 deletions ade25/fabfiles/docker/compose.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# -*- 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 {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 {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)
)
16 changes: 16 additions & 0 deletions ade25/fabfiles/project/db.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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))
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
include_package_data=True,
zip_safe=False,
install_requires=[
'Fabric',
'Fabric==1.14.0',
'cuisine',
'setuptools',
'slacker',
Expand Down

0 comments on commit a9a7fbb

Please sign in to comment.