-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update python/django and strip out celery
- Loading branch information
Showing
40 changed files
with
434 additions
and
617 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 |
---|---|---|
|
@@ -3,6 +3,8 @@ | |
settings.pyc | ||
settings_local.py | ||
*.ged | ||
tmp/ | ||
files/ | ||
data/ | ||
.env | ||
.tmp/ | ||
.files/ | ||
.data/ | ||
.tmp/ |
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 |
---|---|---|
@@ -1,6 +1,10 @@ | ||
.DS_Store | ||
*.py[co] | ||
*.zip | ||
.env | ||
.tmp/ | ||
.data/ | ||
.files/ | ||
|
||
# Packages | ||
*.egg | ||
|
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 |
---|---|---|
@@ -1,12 +1,20 @@ | ||
FROM python:2.7-alpine3.7 | ||
FROM python:3.7-alpine3.7 | ||
|
||
WORKDIR /app/ | ||
COPY ./reqs.frozen.pip /app/ | ||
COPY ./reqs.pip /app/ | ||
ENV LIBRARY_PATH=/lib:/usr/lib | ||
RUN apk --update add jpeg-dev zlib-dev build-base mariadb-dev && \ | ||
pip install -r reqs.frozen.pip && \ | ||
apk add mariadb-client-libs && \ | ||
apk del build-base mariadb-dev | ||
RUN apk --update add jpeg-dev zlib-dev build-base && \ | ||
pip install -r reqs.pip && \ | ||
apk del build-base | ||
|
||
# Create a non-root user | ||
RUN addgroup -S appgroup && adduser -S app -G appgroup | ||
|
||
COPY ./ /app/ | ||
RUN mkdir -p /static && python manage.py collectstatic -c --noinput | ||
RUN mkdir -p /static && \ | ||
chown app /static /app && \ | ||
python manage.py collectstatic -c --noinput | ||
|
||
USER app | ||
|
||
CMD uvicorn --host=0.0.0.0 asgi:application |
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,8 @@ | ||
import os | ||
from django.core.asgi import get_asgi_application | ||
from django_simple_task import django_simple_task_middlware | ||
|
||
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' | ||
|
||
app = get_asgi_application() | ||
application = django_simple_task_middlware(app) |
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 |
---|---|---|
@@ -1,63 +1,24 @@ | ||
version: '2.2' | ||
services: | ||
# Dev services | ||
avahi: | ||
container_name: 'avahi' | ||
image: 'enernoclabs/avahi:latest' | ||
network_mode: 'host' | ||
logging: | ||
driver: 'none' | ||
db: | ||
container_name: 'db' | ||
image: 'mysql:5.7' | ||
ports: | ||
- '3306:3306' | ||
environment: | ||
MYSQL_ROOT_PASSWORD: 'docker' | ||
MYSQL_DATABASE: 'gedgo' | ||
MYSQL_USER: 'gedgo' | ||
MYSQL_PASSWORD: 'gedgo' | ||
volumes: | ||
- './tmp:/gedgo_tmp' | ||
logging: | ||
driver: 'none' | ||
redis: | ||
container_name: 'redis' | ||
image: 'redis' | ||
ports: | ||
- '6379' | ||
logging: | ||
driver: 'none' | ||
# Application | ||
app: | ||
build: '.' | ||
image: 'gedgo_app' | ||
env_file: '.env' | ||
container_name: 'gedgo_app' | ||
command: ['python', 'manage.py', 'runserver', '0.0.0.0:8000'] | ||
# command: ['python', 'manage.py', 'runserver', '0.0.0.0:8000'] | ||
command: ['uvicorn', '--host=0.0.0.0', '--reload', 'asgi:application'] | ||
ports: | ||
- '8000:8000' | ||
volumes: | ||
- './:/app' | ||
links: | ||
- 'db' | ||
- 'redis' | ||
- '.data/:/data' | ||
web: | ||
image: 'nginx:alpine' | ||
command: 'nginx -g "daemon off;"' | ||
volumes: | ||
- './gedgo-web.conf:/etc/nginx/conf.d/default.conf:ro' | ||
- './files:/src/files:ro' | ||
- './.files:/src/files:ro' | ||
ports: | ||
- '80:80' | ||
links: | ||
- 'app' | ||
worker: | ||
container_name: 'gedgo_worker' | ||
image: 'gedgo_app' | ||
command: ['celery', '-A', 'gedgo.tasks', 'worker', '--loglevel=debug'] | ||
volumes: | ||
- './:/app' | ||
links: | ||
- 'app' | ||
- 'db' | ||
- 'redis' | ||
depends_on: | ||
- 'app' |
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 |
---|---|---|
@@ -1,10 +0,0 @@ | ||
from django.conf import settings | ||
import redis as Redis | ||
|
||
redis = None | ||
if hasattr(settings, 'GEDGO_REDIS_SERVER'): | ||
try: | ||
redis = Redis.StrictRedis(host=settings.GEDGO_REDIS_SERVER) | ||
redis.ping() | ||
except Exception as e: | ||
print e | ||
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
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
Oops, something went wrong.