Skip to content
This repository was archived by the owner on Mar 27, 2023. It is now read-only.

Commit 951dd49

Browse files
committed
removed unused env vars, removed watch scripts for celery, added watchdog to dev deps, improved docker-compose context issues, improved quasar start script
1 parent 88b566c commit 951dd49

File tree

12 files changed

+50
-108
lines changed

12 files changed

+50
-108
lines changed

.env.template

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
SECRET_KEY=secret
22
DEBUG=True
33

4-
POSTGRES_NAME=postgres
5-
POSTGRES_USERNAME=postgres
6-
POSTGRES_PASSWORD=postgres
7-
POSTGRES_SERVICE_HOST=postgres
8-
POSTGRES_SERVICE_PORT=5432
9-
10-
114
# social auth
125
GITHUB_KEY=yourkey
136
GITHUB_SECRET=yoursecret
@@ -18,9 +11,6 @@ GOOGLE_OAUTH2_SECRET=abcde-fghij
1811
SOCIAL_AUTH_FACEBOOK_KEY = ''
1912
SOCIAL_AUTH_FACEBOOK_SECRET = ''
2013

21-
CELERY_BROKER_URL=redis://redis:6379/0
22-
CELERY_RESULT_BACKEND=redis://redis:6379/1
23-
2414
DJANGO_EMAIL_HOST=mailhog
2515
DJANGO_EMAIL_PORT=1025
2616

.python-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

backend/.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
media
2+
static

backend/apps/core/management/commands/watch_celery.py

Lines changed: 0 additions & 37 deletions
This file was deleted.

backend/apps/core/management/commands/watch_celery_beat.py

Lines changed: 0 additions & 33 deletions
This file was deleted.

backend/backend/settings/base.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,8 @@
1515
from kombu import Queue
1616
import redis
1717

18-
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
19-
BASE_DIR = os.path.dirname(
20-
os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
21-
)
22-
18+
# Build paths inside the project like this: BASE_DIR / 'subdir'.
19+
BASE_DIR = Path(__file__).resolve(strict=True).parent.parent.parent
2320

2421
# Quick-start development settings - unsuitable for production
2522
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
@@ -269,7 +266,7 @@
269266
# Assets
270267

271268
STATIC_URL = "/static/"
272-
STATIC_ROOT = "/static/"
269+
STATIC_ROOT = os.path.join(BASE_DIR, "media")
273270

274271
MEDIA_URL = "/media/"
275272
MEDIA_ROOT = os.path.join(BASE_DIR, "media")

backend/requirements/dev.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,8 @@ django-extensions==2.2.9 # NOTE: in installed_apps
33
Werkzeug==1.0.1 # used for runserver_plus exception console
44
ipython==7.14.0
55
jupyter==1.0.0
6-
gql==2.0.0
6+
gql==2.0.0
7+
8+
watchdog==0.10.3
9+
pyyaml==5.3.1
10+
argh==0.26.2

docker-compose.yml

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ services:
4040
nginx:
4141
container_name: nginx
4242
build:
43-
context: .
44-
dockerfile: nginx/dev/Dockerfile
43+
context: ./nginx
44+
dockerfile: dev/Dockerfile
4545
ports:
4646
- "80:80"
4747
depends_on:
@@ -129,18 +129,42 @@ services:
129129
celery:
130130
<<: *backend
131131
container_name: celery
132-
command: bash -c 'python3 manage.py watch_celery --queue default --concurrency=2'
133-
volumes:
134-
- ./backend:/code
132+
command:
133+
- "watchmedo"
134+
- "auto-restart"
135+
- "--directory=./"
136+
- "--pattern=*.py"
137+
- "--recursive"
138+
- "--"
139+
- "celery"
140+
- "worker"
141+
- "--app=backend.celery_app:app"
142+
- "-Q"
143+
- "default"
144+
- "--concurrency=1"
145+
- "--loglevel=INFO"
135146
ports: []
136147

137148
beat:
138149
<<: *backend
139-
build:
140-
context: ./backend
141-
dockerfile: scripts/dev/Dockerfile
142150
container_name: beat
143-
command: /start_beat.sh
151+
command:
152+
- "sh"
153+
- "-c"
154+
- |
155+
# remove celerybeat.pid and celerybeat-schedule if they exist
156+
rm -f /code/celerybeat*;
157+
watchmedo \
158+
auto-restart \
159+
--directory=./ \
160+
--pattern=*.py \
161+
--recursive \
162+
-- \
163+
celery \
164+
beat \
165+
--app=backend.celery_app:app \
166+
--loglevel=INFO \
167+
--pidfile=/code/celerybeat.pid
144168
volumes:
145169
- ./backend:/code
146170
ports: []
@@ -150,7 +174,7 @@ services:
150174
container_name: flower
151175
command: --url_prefix=flower --inspect_timeout=20000
152176
environment:
153-
- CELERY_BROKER_URL=${CELERY_BROKER_URL}
177+
- CELERY_BROKER_URL=redis://redis:6379/0
154178
- FLOWER_PORT=5555
155179
ports:
156180
- 5555:5555

nginx/dev/Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
FROM nginx:1.18.0-alpine
2-
COPY nginx/dev/dev.conf /etc/nginx/nginx.conf
3-
COPY backend/static /usr/src/app/static/
2+
COPY dev/dev.conf /etc/nginx/nginx.conf
43
EXPOSE 80
54
CMD ["nginx", "-g", "daemon off;"]

quasar/.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

quasar/Dockerfile

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
1-
FROM node:12.16.3
1+
FROM node:10-alpine
22

33
WORKDIR /app/
44

55
COPY . .
66

7-
RUN npm install -g @quasar/cli && \
8-
npm install -g @vue/cli && \
9-
npm install -g @vue/cli-init
10-
11-
COPY start_dev.sh .
12-
137
CMD ["/app/start_dev.sh"]

quasar/start_dev.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
#!/bin/bash
1+
#!/bin/sh
2+
3+
npm install -g @quasar/cli
24

35
npm install
46

0 commit comments

Comments
 (0)