-
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.
Add docker files for running the demo site
- Loading branch information
1 parent
17f7e62
commit e7c9d7f
Showing
4 changed files
with
135 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# | ||
# Environment variables used for running the demo site using docker | ||
# | ||
|
||
# Service: db | ||
# Rather than set POSTGRES_PASSWORD (required) and leave POSTGRES_USER and | ||
# so POSTGRES_DB to default to "postgres" we set the variables to the name | ||
# of the app so it mirrors the configuration for locally installed services | ||
# which might be shared between sites. However, the value of doing this is | ||
# that you easily initialize the database with dumps from production where | ||
# the ownership of the tables is defined. | ||
|
||
PGHOST=db | ||
POSTGRES_DB=feeds | ||
POSTGRES_USER=feeds | ||
POSTGRES_PASSWORD=feeds | ||
|
||
# Service: broker | ||
# This, like the db service, simply mirrors the configuration for rabbitmq | ||
# being installed locally and possibly shared between sites. | ||
|
||
RABBITMQ_DEFAULT_USER=feeds | ||
RABBITMQ_DEFAULT_PASS=feeds | ||
RABBITMQ_DEFAULT_VHOST=feeds | ||
|
||
# Services: web, celery, celery-beat | ||
# Environment variables used in Django settings | ||
|
||
CELERY_BROKER_URL=amqp://feeds:feeds@broker:5672/feeds | ||
|
||
DB_HOST=db |
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,44 @@ | ||
# | ||
# Dockerfile: configuration for building the images for the web app, | ||
# celery-beat and celery-worker. | ||
# | ||
|
||
# Base python image | ||
FROM python:3.11.5-bookworm | ||
# Add the site to the python path | ||
ENV PYTHONPATH /code | ||
# Send all output on stdout and stderr straight to the container logs | ||
ENV PYTHONUNBUFFERED 1 | ||
# Set the locale | ||
ENV LC_ALL C.UTF-8 | ||
# Terminals support 256 colours | ||
ENV TERM xterm-256color | ||
|
||
# Set the project directory | ||
|
||
RUN mkdir /code | ||
WORKDIR /code | ||
|
||
# Install dependencies | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends | ||
|
||
RUN apt-get install -y --no-install-recommends \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Install requirements | ||
|
||
COPY requirements/dev.txt /tmp/requirements.txt | ||
|
||
# Copy across all the files needed to install feeds as an editable | ||
# package since the volunme has not been mounted yet. | ||
|
||
COPY setup.py . | ||
COPY README.md . | ||
COPY src ./src | ||
|
||
RUN pip install --upgrade setuptools pip wheel\ | ||
&& pip install pip-tools\ | ||
&& pip install -r /tmp/requirements.txt |
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,57 @@ | ||
version: '3.1' | ||
|
||
services: | ||
db: | ||
image: postgres:15 | ||
ports: | ||
- "15432:5432" | ||
volumes: | ||
- ${DB_DATA_DIR-./.data/db}:/var/lib/postgresql/data | ||
env_file: | ||
- .env.docker | ||
|
||
broker: | ||
image: rabbitmq:3.11.9-management | ||
env_file: | ||
- .env.docker | ||
|
||
web: | ||
stdin_open: true | ||
tty: true | ||
build: . | ||
command: /code/docker-init.sh | ||
volumes: &web-volumes | ||
- ./:/code | ||
ports: | ||
- "8000:8000" | ||
depends_on: &web-depends-on | ||
- db | ||
- broker | ||
env_file: | ||
- .env.docker | ||
|
||
flower: | ||
image: mher/flower | ||
ports: | ||
- "15555:5555" | ||
command: celery flower --broker_api=http://feeds:feeds@broker:15672/api/feeds | ||
depends_on: | ||
- broker | ||
env_file: | ||
- .env.docker | ||
|
||
celery-beat: | ||
build: . | ||
command: celery --app feeds beat --loglevel debug | ||
volumes: *web-volumes | ||
depends_on: *web-depends-on | ||
env_file: | ||
- .env.docker | ||
|
||
celery-worker: | ||
build: . | ||
command: celery --app feeds worker --loglevel debug | ||
volumes: *web-volumes | ||
depends_on: *web-depends-on | ||
env_file: | ||
- .env.docker |
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,3 @@ | ||
#!/bin/bash | ||
python /code/manage.py migrate | ||
python /code/manage.py runserver 0.0.0.0:8000 |