Skip to content

Commit

Permalink
use redis as message broker (as apposite to filesystem based)
Browse files Browse the repository at this point in the history
  • Loading branch information
ciur committed Dec 27, 2020
1 parent 8ad83bd commit 968f37b
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 18 deletions.
7 changes: 1 addition & 6 deletions docker/1.4/app.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,10 @@ RUN echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen && locale-gen
ENV LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8


RUN git clone https://github.com/ciur/papermerge --branch v1.5.4 -q --depth 1 /opt/app
RUN git clone https://github.com/ciur/papermerge --branch v1.5.5 -q --depth 1 /opt/app

RUN mkdir -p /opt/media

# For broker queue. Change ownership
# so that mounted volume won't make it root-owned
RUN mkdir /opt/app/queue
RUN chown www:www /opt/app/queue

COPY config/app.production.py /opt/app/config/settings/production.py
COPY config/papermerge.config.py /opt/app/papermerge.conf.py
COPY app.startup.sh /opt/app/startup.sh
Expand Down
4 changes: 4 additions & 0 deletions docker/1.4/config/app.production.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@

ALLOWED_HOSTS = ['*']

CELERY_BROKER_URL = "redis://redis/0"
CELERY_BROKER_TRANSPORT_OPTIONS = {}
CELERY_RESULT_BACKEND = "redis://redis/0"

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
Expand Down
4 changes: 4 additions & 0 deletions docker/1.4/config/worker.production.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
ALLOWED_HOSTS = ['*']


CELERY_BROKER_URL = "redis://redis/0"
CELERY_BROKER_TRANSPORT_OPTIONS = {}
CELERY_RESULT_BACKEND = "redis://redis/0"

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
Expand Down
18 changes: 12 additions & 6 deletions docker/1.4/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3.7'
services:
app:
image: eugenci/papermerge:1.5.4
image: eugenci/papermerge:1.5.5
build:
context: .
dockerfile: app.dockerfile
Expand All @@ -10,9 +10,9 @@ services:
- "8000:8000"
depends_on:
- db
- redis
volumes:
- media_root:/opt/media
- broker_queue:/opt/app/queue
environment:
- DJANGO_SETTINGS_MODULE=config.settings.production
- POSTGRES_USER=dbuser
Expand All @@ -29,15 +29,21 @@ services:
- POSTGRES_USER=dbuser
- POSTGRES_PASSWORD=dbpass
- POSTGRES_DB=dbname
redis:
container_name: 'redis'
image: 'redis:6'
ports:
- '127.0.0.1:6379:6379'
volumes:
- 'redisdata:/data'
worker:
image: eugenci/papermerge-worker:1.5.4
image: eugenci/papermerge-worker:1.5.5
build:
context: .
dockerfile: worker.dockerfile
container_name: papermerge_worker
volumes:
- media_root:/opt/media
- broker_queue:/opt/app/queue
environment:
- DJANGO_SETTINGS_MODULE=config.settings.production
- POSTGRES_USER=dbuser
Expand All @@ -47,5 +53,5 @@ services:
- POSTGRES_PORT=5432
volumes:
postgres_data:
broker_queue:
media_root:
media_root:
redisdata:
7 changes: 1 addition & 6 deletions docker/1.4/worker.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,10 @@ RUN echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen && locale-gen
ENV LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8


RUN git clone https://github.com/ciur/papermerge --branch v1.5.4 -q --depth 1 /opt/app
RUN git clone https://github.com/ciur/papermerge --branch v1.5.5 -q --depth 1 /opt/app

RUN mkdir -p /opt/media

# For broker queue. Change ownership
# so that mounted volume won't make it root-owned
RUN mkdir /opt/app/queue
RUN chown www:www /opt/app/queue

COPY config/worker.production.py /opt/app/config/settings/production.py
COPY config/papermerge.config.py /opt/app/papermerge.conf.py
COPY worker.startup.sh /opt/app/startup.sh
Expand Down

0 comments on commit 968f37b

Please sign in to comment.