Skip to content

Commit

Permalink
Add Dockerfile ready for deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidLemayian committed Aug 24, 2017
1 parent 38ecbf5 commit 390c614
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 18 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -8,9 +8,13 @@ pyenv/*
.cache
*.sublime*

build
dist

connectedafrica/static/vendor/*
connectedafrica/static/gen/*
connectedafrica/static/.webassets-cache/*
settings.py

data/.cache/*
data/gdocs/*.csv
Expand Down
10 changes: 10 additions & 0 deletions Dockerfile
@@ -0,0 +1,10 @@
FROM granoproject/base:latest

# Node dependencies
RUN npm --quiet --silent install -g bower uglify-js less

COPY . /siyazana
WORKDIR /siyazana
RUN python setup.py -qq install

CMD gunicorn -w 3 -t 1800 connectedafrica.manage:app
14 changes: 7 additions & 7 deletions fabfile.py
Expand Up @@ -5,7 +5,7 @@
from fabric.context_managers import shell_env


VIRTUALENV_DIR = 'connectedafrica_ve'
VIRTUALENV_DIR = 'siyazana'
CODE_DIR = 'connectedafrica'
PROD_HOSTS = ['ec2-54-76-245-198.eu-west-1.compute.amazonaws.com']
PACKAGES = (
Expand All @@ -21,13 +21,13 @@
SERVER_NAMES = 'siyazana.co.za'
PROXY_PORT = 5001
PROXY_HOST = '127.0.0.1'
LOG_DIR = 'connectedafrica_logs'
LOG_DIR = 'siyazana_logs'


@task
def prod():
env.deploy_user = 'connectedafrica'
env.deploy_dir = '/home/connectedafrica/'
env.deploy_user = 'ubuntu'
env.deploy_dir = '/home/ubuntu/siyazana'
env.branch = 'master'
env.nginx_bind = '127.0.0.1:80'
env.hosts = PROD_HOSTS
Expand Down Expand Up @@ -59,7 +59,7 @@ def deploy():

if not exists(repo_dir):
with cd(env.deploy_dir):
sudo('git clone -b %s https://github.com/codeforafrica/connectedAFRICA.git %s'
sudo('git clone -b %s https://github.com/ANCIR/siyazana.co.za.git %s'
% (env.branch, repo_dir), user=env.deploy_user)
else:
with cd(repo_dir):
Expand All @@ -72,10 +72,10 @@ def deploy():

# render and upload templates
upload_template(os.path.join(os.path.dirname(__file__), 'deploy/nginx.template'),
'/etc/nginx/sites-enabled/connectedafrica.conf',
'/etc/nginx/sites-enabled/siyazana.conf',
get_nginx_template_context(), use_sudo=True, backup=False)
upload_template(os.path.join(os.path.dirname(__file__), 'deploy/supervisor.template'),
'/etc/supervisor/conf.d/connectedafrica.conf',
'/etc/supervisor/conf.d/siyazana.conf',
get_supervisor_template_context(), use_sudo=True, backup=False)
# make sure logging dir exists and update processes
log_dir = os.path.join(env.deploy_dir, LOG_DIR)
Expand Down
21 changes: 10 additions & 11 deletions setup.py
Expand Up @@ -2,25 +2,25 @@


setup(
name='connectedAFRICA',
name='Siyazana',
version='0.1',
description="Politically exposed persons in South Africa",
long_description=None,
classifiers=[],
keywords='',
author='Friedrich Lindenberg',
author_email='info@connectedafrica.org',
url='https://github.com/codeforafrica/connectedAFRICA',
author='Code for Africa',
author_email='support@codeforafrica.org',
url='https://github.com/ANCIR/siyazana.co.za',
license='MIT',
packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
zip_safe=False,
install_requires=[
"granoloader>=0.1",
"grano-client>=0.2.4",
"granoloader",
"grano-client",
"gunicorn==19.0",
"Fabric==1.9.0",
"Flask==0.10.1",
"Flask-Assets==0.10",
"Flask==0.12.2",
"Flask-Assets==0.12",
"Flask-Script==2.0.5",
"Flask-FlatPages==0.5",
"Flask-Cache==0.13.1",
Expand All @@ -36,10 +36,9 @@
"apikit>=0.0.1",
"Unidecode==0.04.16"
],
# until file support branches have landed
dependency_links=[
"git+https://github.com/granoproject/granoloader.git@file-support#egg=granoloader",
"git+https://github.com/Rizziepit/grano-client.git@file_support#egg=grano-client",
"https://github.com/CodeForAfrica/granoloader/tarball/master#egg=granoloader",
"https://github.com/CodeForAfrica/grano-client/tarball/master#egg=grano-client",
],
tests_require=[],
entry_points=""" """,
Expand Down

0 comments on commit 390c614

Please sign in to comment.