forked from wooey/Wooey
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request wooey#233 from wooey/add-docker
Docker setup with some test fixes
- Loading branch information
Showing
14 changed files
with
169 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,3 +58,6 @@ target/ | |
|
||
# IDE | ||
.idea | ||
|
||
# Template files | ||
docker/docker-compose.override.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
FROM python:2.7 | ||
|
||
ENV BUILD_DIR=/wooey_build | ||
|
||
RUN pip install psycopg2 | ||
|
||
COPY setup.py requirements.txt MANIFEST.in Makefile README.md ${BUILD_DIR}/ | ||
COPY scripts ${BUILD_DIR}/scripts | ||
COPY wooey ${BUILD_DIR}/wooey | ||
COPY tests ${BUILD_DIR}/tests | ||
|
||
WORKDIR ${BUILD_DIR} | ||
|
||
RUN pip install -r requirements.txt | ||
RUN pip install -e . | ||
|
||
RUN chmod -R a+rwx ${BUILD_DIR} | ||
|
||
WORKDIR / | ||
ARG WOOEY_PROJECT=docker_wooey | ||
|
||
RUN wooify -p ${WOOEY_PROJECT} | ||
|
||
WORKDIR ${WOOEY_PROJECT} | ||
|
||
COPY docker/scripts/run-server run-server | ||
|
||
# Make volumes and make sure the wooey directory is r/w by all. By default, | ||
# docker will create volumes as root so this is needed. | ||
RUN mkdir ${WOOEY_PROJECT}/user_uploads && \ | ||
chmod -R a+rwx /${WOOEY_PROJECT} | ||
|
||
EXPOSE 8080 | ||
|
||
CMD ["sh", "-c", "make -C ${BUILD_DIR} test"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
./wooey-compose run --rm --service-ports celery "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# This file should be renamed to docker-compose.overrides.yml with whatever | ||
# overrides are specific to the particular setup | ||
version: '2.1' | ||
|
||
services: | ||
wooey: | ||
volumes: | ||
- ../wooey:/docker_wooey/wooey | ||
- ../../clinto/clinto:/usr/local/lib/python3.6/site-packages/clinto | ||
ports: | ||
- 8080:8080 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
version: '2.1' | ||
volumes: | ||
user_uploads: | ||
wooey_db: | ||
|
||
services: | ||
common: | ||
build: | ||
context: .. | ||
dockerfile: docker/Dockerfile | ||
image: wooey:dev | ||
volumes : | ||
- ./user_settings.py:/docker_wooey/docker_wooey/settings/user_settings.py | ||
- user_uploads:/docker_wooey/docker_wooey/user_uploads | ||
environment: | ||
AMQP_URL: amqp://rabbit:5672 | ||
DATABASE_NAME: wooey | ||
DATABASE_USER: wooey | ||
DATABASE_URL: db | ||
DATABASE_PASSWORD: wooey | ||
user: 1000:1000 | ||
|
||
wooey: | ||
extends: common | ||
ports: | ||
- 8081:8080 | ||
depends_on: | ||
- rabbit | ||
- db | ||
command: ./run-server | ||
|
||
celery: | ||
extends: common | ||
command: celery worker -A docker_wooey -c 4 --beat -l info -s schedule | ||
|
||
rabbit: | ||
image: rabbitmq | ||
|
||
db: | ||
image: postgres | ||
volumes: | ||
- wooey_db:/var/lib/postgresql/data | ||
environment: | ||
POSTGRES_USER: wooey | ||
POSTGRES_PASSWORD: wooey | ||
POSTGRES_DB: wooey |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
./wooey-compose run --rm wooey python manage.py "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
./wooey-compose run --rm wooey "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
./wooey-compose run --rm --service-ports wooey "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
python manage.py migrate | ||
python manage.py collectstatic -c --noinput | ||
python manage.py runserver 0.0.0.0:8080 |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import os | ||
from .wooey_settings import * | ||
|
||
# Whether to allow anonymous job submissions, set False to disallow 'guest' job submissions | ||
WOOEY_ALLOW_ANONYMOUS = True | ||
|
||
## Celery related options | ||
INSTALLED_APPS += ( | ||
'django_celery_results', | ||
) | ||
|
||
WOOEY_CELERY = True | ||
CELERY_RESULT_BACKEND = 'django-db' | ||
CELERY_BROKER_URL = 'amqp://guest@rabbit' | ||
CELERY_TRACK_STARTED = True | ||
CELERY_SEND_EVENTS = True | ||
CELERY_IMPORTS = ('wooey.tasks') | ||
CELERY_TASK_SERIALIZER = 'json' | ||
CELERY_TASK_ACKS_LATE = True | ||
|
||
# the directory for uploads (physical directory) | ||
MEDIA_ROOT = os.path.join(BASE_DIR, 'user_uploads') | ||
# the url mapping | ||
MEDIA_URL = '/uploads/' | ||
|
||
# the directory to store our webpage assets (images, javascript, etc.) | ||
STATIC_ROOT = os.path.join(BASE_DIR, 'static') | ||
# the url mapping | ||
STATIC_URL = '/static/' | ||
## Here is a setup example for production servers | ||
|
||
## A postgres database -- for multiple users a sqlite based database is asking for trouble | ||
|
||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.postgresql_psycopg2', | ||
# for production environments, these should be stored as environment variables | ||
# I also recommend the django-heroku-postgresify package for a super simple setup | ||
'NAME': os.environ.get('DATABASE_NAME', 'wooey'), | ||
'USER': os.environ.get('DATABASE_USER', 'wooey'), | ||
'PASSWORD': os.environ.get('DATABASE_PASSWORD', 'wooey'), | ||
'HOST': os.environ.get('DATABASE_URL', 'localhost'), | ||
'PORT': os.environ.get('DATABASE_PORT', '5432') | ||
} | ||
} | ||
|
||
ALLOWED_HOSTS = ( | ||
'localhost', | ||
'127.0.0.1', | ||
) | ||
|
||
AUTHENTICATION_BACKEND = 'django.contrib.auth.backends.ModelBackend' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
docker-compose -p wooey "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters