From 6c3f8f688491fcaf21fd490362c024440a1dcc58 Mon Sep 17 00:00:00 2001 From: Samuel Dion-Girardeau Date: Sat, 16 Jul 2016 06:49:30 -0700 Subject: [PATCH 1/4] Ensure the egg is a directory, not a zip Prevents NotADirectoryError's in flask templates Ref.: https://github.com/pallets/flask/issues/1562 https://github.com/pallets/flask/issues/1645 --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index edce534..f6c0408 100644 --- a/setup.py +++ b/setup.py @@ -32,5 +32,6 @@ setup( 'Programming Language :: Python :: 3.3', 'Topic :: Software Development :: Libraries :: Python Modules', ], + zip_safe=False, ) From b34b5c4b69f9fdea4f679bfb29eec7c57b7e1750 Mon Sep 17 00:00:00 2001 From: Samuel Dion-Girardeau Date: Sat, 16 Jul 2016 06:57:18 -0700 Subject: [PATCH 2/4] Add Dockerfile/.dockerignore files --- .dockerignore | 20 ++++++++++++++++++++ Dockerfile | 23 +++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..67d158d --- /dev/null +++ b/.dockerignore @@ -0,0 +1,20 @@ +# Source +.bumpversion.cfg +.dockerignore +.gitignore +.travis.yml +CONTRIBUTING.rst +docker-compose.yml +Dockerfile +requirements.txt +tests.py +tox.ini + +# Generated +.tox +.coverage +*.rdb +junit*xml + +# Other +.project diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..257f59d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM python:3.3 + +ENV APP_DIR=/usr/src/snappass + +RUN groupadd -r snappass && \ + useradd -r -g snappass snappass && \ + mkdir -p $APP_DIR + +WORKDIR $APP_DIR + +COPY ["setup.py", "MANIFEST.in", "README.rst", "AUTHORS.rst", "$APP_DIR/"] +COPY ["./snappass", "$APP_DIR/snappass"] + +RUN python setup.py install && \ + chown -R snappass $APP_DIR && \ + chgrp -R snappass $APP_DIR + +USER snappass + +# Default Flask port +EXPOSE 5000 + +CMD ["snappass"] From fb020522ad72e0b9250bfcb93a8ce05314862e9b Mon Sep 17 00:00:00 2001 From: Samuel Dion-Girardeau Date: Sat, 16 Jul 2016 07:01:29 -0700 Subject: [PATCH 3/4] Add compose file for easy setup --- docker-compose.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..3007635 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,13 @@ +--- +snappass: + image: snappass + ports: + - "5000:5000" + links: + - "redis:redis" + environment: + - REDIS_HOST=redis + - NO_SSL=True + +redis: + image: "redis:latest" From 98c3ffe3e57756a19dda6f064fe0768c957b7a45 Mon Sep 17 00:00:00 2001 From: Samuel Dion-Girardeau Date: Sat, 16 Jul 2016 07:11:36 -0700 Subject: [PATCH 4/4] Document Docker setup steps --- README.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.rst b/README.rst index 500e8e1..915b854 100644 --- a/README.rst +++ b/README.rst @@ -59,3 +59,16 @@ be kept secret. See the `Flask Documentation`_ for more information. need to change this. `NO_SSL` if you are not using SSL. + +Docker +------ + +Alternatively, you can use `Docker`_ to install and run SnapPass: +.. _Docker: https://www.docker.com/ + +:: + + $ docker build -t snappass . + $ docker-compose up -d + +This will pull all dependencies, i.e. Redis and appropriate Python version.