New WaitingListEntry #33
|
@ -7,7 +7,6 @@ steps:
|
||||||
- name: docker
|
- name: docker
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
environment:
|
environment:
|
||||||
DJANGO_ENV: production
|
|
||||||
BUILD: "${DRONE_COMMIT_SHA}"
|
BUILD: "${DRONE_COMMIT_SHA}"
|
||||||
settings:
|
settings:
|
||||||
repo: docker.data.coop/membersystem
|
repo: docker.data.coop/membersystem
|
||||||
|
@ -17,7 +16,6 @@ steps:
|
||||||
password:
|
password:
|
||||||
from_secret: DOCKER_PASSWORD
|
from_secret: DOCKER_PASSWORD
|
||||||
build_args_from_env:
|
build_args_from_env:
|
||||||
- DJANGO_ENV
|
|
||||||
- BUILD
|
- BUILD
|
||||||
tags:
|
tags:
|
||||||
- "${DRONE_BUILD_NUMBER}"
|
- "${DRONE_BUILD_NUMBER}"
|
||||||
|
|
|
@ -6,4 +6,3 @@ DATABASE_URL=postgres://postgres:postgres@postgres:5432/postgres
|
||||||
# Use something along the the following if you are not using docker
|
# Use something along the the following if you are not using docker
|
||||||
# DATABASE_URL=postgres://postgres:postgres@localhost:5432/datacoop_membersystem
|
# DATABASE_URL=postgres://postgres:postgres@localhost:5432/datacoop_membersystem
|
||||||
DEBUG=True
|
DEBUG=True
|
||||||
DJANGO_ENV=development
|
|
||||||
|
|
16
Dockerfile
16
Dockerfile
|
@ -7,16 +7,12 @@ ENV PYTHONFAULTHANDLER=1 \
|
||||||
PIP_NO_CACHE_DIR=off \
|
PIP_NO_CACHE_DIR=off \
|
||||||
PIP_DISABLE_PIP_VERSION_CHECK=on \
|
PIP_DISABLE_PIP_VERSION_CHECK=on \
|
||||||
PIP_DEFAULT_TIMEOUT=100
|
PIP_DEFAULT_TIMEOUT=100
|
||||||
ARG DJANGO_ENV
|
|
||||||
ARG BUILD
|
ARG BUILD
|
||||||
ENV BUILD ${BUILD}
|
ENV BUILD ${BUILD}
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
RUN groupadd -g 1000 www && useradd -u 1000 -ms /bin/bash -g www www
|
RUN groupadd -g 1000 www && useradd -u 1000 -ms /bin/bash -g www www \
|
||||||
COPY --chown=www:www . .
|
|
||||||
RUN mkdir /app/src/static \
|
|
||||||
&& chown www:www /app/src/static \
|
|
||||||
&& apt-get update \
|
&& apt-get update \
|
||||||
&& apt-get install -y \
|
&& apt-get install -y \
|
||||||
binutils \
|
binutils \
|
||||||
|
@ -29,8 +25,14 @@ RUN mkdir /app/src/static \
|
||||||
libgdk-pixbuf2.0-0 \
|
libgdk-pixbuf2.0-0 \
|
||||||
libffi-dev \
|
libffi-dev \
|
||||||
shared-mime-info \
|
shared-mime-info \
|
||||||
gettext \
|
gettext
|
||||||
&& pip install . \
|
|
||||||
|
COPY --chown=www:www . .
|
||||||
|
|
||||||
|
RUN mkdir /app/src/static \
|
||||||
|
&& chown www:www /app/src/static
|
||||||
|
|
||||||
|
RUN pip install . \
|
||||||
&& django-admin compilemessages
|
&& django-admin compilemessages
|
||||||
|
|
||||||
ENTRYPOINT ["./entrypoint.sh"]
|
ENTRYPOINT ["./entrypoint.sh"]
|
||||||
|
|
26
Makefile
26
Makefile
|
@ -1,6 +1,5 @@
|
||||||
DOCKER_COMPOSE = COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker compose
|
DOCKER_COMPOSE = COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker compose
|
||||||
DOCKER_RUN = ${DOCKER_COMPOSE} run -u `id -u`
|
DOCKER_RUN = ${DOCKER_COMPOSE} run -u `id -u`
|
||||||
DOCKER_BUILD = DOCKER_BUILDKIT=1 docker build
|
|
||||||
DOCKER_CONTAINER_NAME = backend
|
DOCKER_CONTAINER_NAME = backend
|
||||||
MANAGE_EXEC = python /app/src/manage.py
|
MANAGE_EXEC = python /app/src/manage.py
|
||||||
MANAGE_COMMAND = ${DOCKER_RUN} ${DOCKER_CONTAINER_NAME} ${MANAGE_EXEC}
|
MANAGE_COMMAND = ${DOCKER_RUN} ${DOCKER_CONTAINER_NAME} ${MANAGE_EXEC}
|
||||||
|
@ -10,12 +9,6 @@ init: setup_venv pre_commit_install migrate
|
||||||
run:
|
run:
|
||||||
${DOCKER_COMPOSE} up
|
${DOCKER_COMPOSE} up
|
||||||
|
|
||||||
setup_venv:
|
|
||||||
rm -rf venv
|
|
||||||
python3.11 -m venv venv;
|
|
||||||
venv/bin/python -m pip install wheel setuptools;
|
|
||||||
venv/bin/python -m pip install pre-commit boto3 pip-tools;
|
|
||||||
|
|
||||||
pre_commit_install:
|
pre_commit_install:
|
||||||
venv/bin/pre-commit install
|
venv/bin/pre-commit install
|
||||||
|
|
||||||
|
@ -37,22 +30,5 @@ shell:
|
||||||
manage_command:
|
manage_command:
|
||||||
${MANAGE_COMMAND} ${ARGS}
|
${MANAGE_COMMAND} ${ARGS}
|
||||||
|
|
||||||
add_dependency:
|
build_dev_docker_image:
|
||||||
${DOCKER_RUN} ${DOCKER_CONTAINER_NAME} poetry add --lock ${DEPENDENCY}
|
|
||||||
|
|
||||||
add_dev_dependency:
|
|
||||||
${DOCKER_RUN} ${DOCKER_CONTAINER_NAME} poetry add -D --lock ${DEPENDENCY}
|
|
||||||
|
|
||||||
poetry_lock:
|
|
||||||
${DOCKER_RUN} ${DOCKER_CONTAINER_NAME} poetry lock --no-update
|
|
||||||
|
|
||||||
poetry_command:
|
|
||||||
${DOCKER_RUN} ${DOCKER_CONTAINER_NAME} poetry ${COMMAND}
|
|
||||||
|
|
||||||
build_dev_docker_image: compile_requirements
|
|
||||||
${DOCKER_COMPOSE} build ${DOCKER_CONTAINER_NAME}
|
${DOCKER_COMPOSE} build ${DOCKER_CONTAINER_NAME}
|
||||||
|
|
||||||
compile_requirements:
|
|
||||||
./venv/bin/pip-compile --output-file requirements/base.txt requirements/base.in
|
|
||||||
./venv/bin/pip-compile --output-file requirements/test.txt requirements/test.in
|
|
||||||
./venv/bin/pip-compile --output-file requirements/dev.txt requirements/dev.in
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
Copy over the .env.example file to .env and adjust DATABASE_URL accordingly
|
Copy over the .env.example file to .env and adjust DATABASE_URL accordingly
|
||||||
|
|
||||||
$ cp .env.example .env
|
$ cp .env.example .env
|
||||||
|
|
||||||
### Docker
|
### Docker
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ Activate the venv
|
||||||
|
|
||||||
Install requirements
|
Install requirements
|
||||||
|
|
||||||
$ pip install -r requirements/dev.txt
|
$ pip install .
|
||||||
|
|
||||||
Run migrations
|
Run migrations
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
version: '3.7'
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
|
||||||
backend:
|
backend:
|
||||||
|
@ -13,7 +11,8 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- ./:/app/
|
- ./:/app/
|
||||||
depends_on:
|
depends_on:
|
||||||
- postgres
|
postgres:
|
||||||
|
condition: service_healthy
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
|
|
||||||
|
@ -25,6 +24,13 @@ services:
|
||||||
- 5432:5432
|
- 5432:5432
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
|
# This healthcheck has a large number of retries, this is currently based on the number of
|
||||||
|
# retries necessary to get the database running in GitHub Actions.
|
||||||
|
healthcheck:
|
||||||
|
test: [ "CMD-SHELL", "pg_isready -U postgres -d postgres" ]
|
||||||
|
interval: 5s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 30
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
postgres_data:
|
postgres_data:
|
||||||
|
|
|
@ -1,16 +1,5 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
echo "Waiting for postgres..."
|
|
||||||
|
|
||||||
POSTGRES_PORT=${POSTGRES_PORT:-5432}
|
|
||||||
POSTGRES_HOST=${POSTGRES_HOST:-localhost}
|
|
||||||
|
|
||||||
while ! nc -z "$POSTGRES_HOST" "$POSTGRES_PORT"; do
|
|
||||||
sleep 0.1
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "PostgreSQL started"
|
|
||||||
|
|
||||||
# Only migrate, collectstatic and compilemessages if we are NOT in development
|
# Only migrate, collectstatic and compilemessages if we are NOT in development
|
||||||
if [ -z "$DEBUG" ]; then
|
if [ -z "$DEBUG" ]; then
|
||||||
python src/manage.py migrate;
|
python src/manage.py migrate;
|
||||||
|
|
Loading…
Reference in a new issue