From 90168cd563003ea372118799158cd256cee11e8d Mon Sep 17 00:00:00 2001
From: Eliot Berriot <contact@eliotberriot.com>
Date: Mon, 19 Jun 2017 23:35:50 +0200
Subject: [PATCH] More production like docker-compose, tweaked static_url so it
 does not clash with the frontend

---
 .gitignore                |  3 +++
 config/settings/common.py |  2 +-
 demo/load-demo-data.sh    |  2 +-
 docker-compose.yml        | 42 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 47 insertions(+), 2 deletions(-)
 create mode 100644 docker-compose.yml

diff --git a/.gitignore b/.gitignore
index d53908c..b2d6c1a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -67,3 +67,6 @@ mailhog
 *.sqlite3
 
 music
+media
+staticfiles
+static
diff --git a/config/settings/common.py b/config/settings/common.py
index ceee21f..5c55dfd 100644
--- a/config/settings/common.py
+++ b/config/settings/common.py
@@ -199,7 +199,7 @@ CRISPY_TEMPLATE_PACK = 'bootstrap3'
 STATIC_ROOT = str(ROOT_DIR('staticfiles'))
 
 # See: https://docs.djangoproject.com/en/dev/ref/settings/#static-url
-STATIC_URL = '/static/'
+STATIC_URL = env("STATIC_URL", default='/static/')
 
 # See: https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#std:setting-STATICFILES_DIRS
 STATICFILES_DIRS = (
diff --git a/demo/load-demo-data.sh b/demo/load-demo-data.sh
index aae3b30..c09c507 100755
--- a/demo/load-demo-data.sh
+++ b/demo/load-demo-data.sh
@@ -10,4 +10,4 @@ cat demo/demo-user.py | python manage.py shell --plain
 
 echo "Importing demo tracks..."
 
-python manage.py import_files "/app/music/**/*.ogg" --recursive --noinput
+python manage.py import_files "/music/**/*.ogg" --recursive --noinput
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..4f79eb3
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,42 @@
+version: '2'
+services:
+    postgres:
+      image: postgres:9.5
+
+    api:
+      build: .
+      links:
+        - postgres
+        - redis
+      command: ./compose/django/gunicorn.sh
+      env_file: .env
+      volumes:
+        - ./media:/app/funkwhale_api/media
+        - ./staticfiles:/app/staticfiles
+        - ./music:/music
+      ports:
+        - "127.0.0.1:6001:5000"
+
+    redis:
+      image: redis:3.0
+
+    celeryworker:
+      build: .
+      env_file: .env
+      links:
+       - postgres
+       - redis
+      command: celery -A funkwhale_api.taskapp worker -l INFO
+      volumes:
+        - ./media:/app/funkwhale_api/media
+        - ./music:/music
+      environment:
+        - C_FORCE_ROOT=True
+
+    celerybeat:
+      build: .
+      env_file: .env
+      links:
+        - postgres
+        - redis
+      command: celery -A funkwhale_api.taskapp beat -l INFO
-- 
GitLab