Skip to content

Commit

Permalink
Merge pull request #51 from beatonma/4.0.2
Browse files Browse the repository at this point in the history
4.0.2
  • Loading branch information
beatonma committed May 27, 2023
2 parents eba82cf + 04bb581 commit 02d75fd
Show file tree
Hide file tree
Showing 41 changed files with 612 additions and 631 deletions.
17 changes: 11 additions & 6 deletions .dockerignore
@@ -1,9 +1,14 @@
env/
htmlcov/
docs/
dist/
build/
*.egg-info/
*.sqlite3
*.gitbundle
.idea/
.git/
*.egg-info
.github/
.pytest_cache/
__pycache__/
env/
env-minimum/
env-no-wagtail/
dist/
build/
wiki/
9 changes: 9 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,14 @@
# Changelog

## 4.0.2 (2023-05-27)
- Resolves [#50](https://github.com/beatonma/django-wm/issues/50): broken search field on QuotableAdmin.
- Added tests for admin pages to avoid that sort of thing happening again.
- Minor touch-ups for the admin pages.
- Source and target URL fields are now read-only.
- Added appropriate search fields and list filters for each model.
- `quote` field now uses a textarea widget for comfier editing.


## 4.0.1 (2022-12-22)

- Added management command `mentions_reverify [filters ...] [--all]`
Expand Down
79 changes: 79 additions & 0 deletions Dockerfile
@@ -0,0 +1,79 @@
FROM python:3.11-alpine AS common
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONBUFFERED=1

RUN apk add curl

WORKDIR /var/www/static

WORKDIR /tmp/src/
COPY ./mentions ./mentions
COPY ./tests ./tests
COPY ./pyproject.toml .
COPY ./requirements.txt .
COPY ./setup.cfg .
COPY ./runtests.py .
RUN --mount=type=cache,target=/root/.cache/pip pip install -r /tmp/src/requirements.txt
RUN python /tmp/src/runtests.py

WORKDIR /project
COPY ./sample-project/requirements.txt /project
RUN --mount=type=cache,target=/root/.cache/pip pip install -r /project/requirements.txt

# Pass a random CACHEBUST value to ensure data is updated and not taken from cache.
ARG CACHEBUST=0
RUN echo "CACHEBUST: $CACHEBUST"

WORKDIR /project

COPY ./sample-project/docker/entrypoint.sh /

ENTRYPOINT ["/entrypoint.sh"]


################################################################################
FROM common AS with_celery

# Install extra dependencies but remove our package - will be mounted in compose
# to allow Django runserver to reload on code changes.
RUN --mount=type=cache,target=/root/.cache/pip pip install -e /tmp/src[celery,test]
RUN pip uninstall -y django-wm
RUN rm -r /tmp/src

CMD ["python", "manage.py", "sample_app_init"]


################################################################################
FROM common AS with_wagtail

# Install extra dependencies but remove our package - will be mounted in compose
# to allow Django runserver to reload on code changes.
RUN --mount=type=cache,target=/root/.cache/pip pip install -e /tmp/src[wagtail,test]
RUN pip uninstall -y django-wm
RUN rm -r /tmp/src

CMD ["python", "manage.py", "wagtail_app_init"]


################################################################################
FROM with_celery AS with_celery_celery

ENTRYPOINT celery -A sample_project worker -l info


################################################################################
FROM with_celery AS with_celery_cron

COPY ./sample-project/docker/with-celery/cron-schedule /
RUN crontab /cron-schedule

ENTRYPOINT crond -l 2 -f


################################################################################
FROM with_wagtail AS with_wagtail_cron

COPY ./sample-project/docker/with-wagtail/cron-schedule /
RUN crontab /cron-schedule

ENTRYPOINT crond -l 2 -f
98 changes: 0 additions & 98 deletions docker-compose.upgrade-check.yml

This file was deleted.

115 changes: 68 additions & 47 deletions docker-compose.yml
@@ -1,4 +1,4 @@
version: "3"
version: "3.9"

# Run two instances of `sample-project`
#
Expand All @@ -11,81 +11,102 @@ version: "3"
# - Uses `cron` to handle webmentions, scheduled to run every minute.
# - Also uses Wagtail.
#
# Each instance can send mentions to the other one.
# - Each instance can send mentions to the other one
# - Each instance has a cron job which has a chance of sending a mention to the
# other each minute.

x-healthy: &healthy
interval: 10s
timeout: 2s
retries: 3
start_period: 20s

x-database: &database
image: postgres
healthcheck:
test: [ "CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}" ]
<<: *healthy

x-app-volumes: &app-volumes
volumes:
- ./sample-project:/project
- ./mentions:/project/mentions

x-with-celery: &with-celery
env_file:
- ./sample-project/docker/.env
- ./sample-project/docker/with-celery/.env

x-with-wagtail: &with-wagtail
env_file:
- ./sample-project/docker/.env
- ./sample-project/docker/with-wagtail/.env


services:
# This version uses Celery
with-celery-db:
image: postgres
env_file:
- ./sample-project/docker/.env
- ./sample-project/docker/with-celery/.env
ports:
- "5432"
<<: [*with-celery, *database]

with-celery-rabbitmq:
image: rabbitmq:3-alpine
env_file:
- ./sample-project/docker/.env
- ./sample-project/docker/with-celery/.env
<<: *with-celery
healthcheck:
test: rabbitmq-diagnostics -q ping
<<: *healthy
ports:
- "5672"

with-celery-web.org:
<<: [*with-celery, *app-volumes]
build:
dockerfile: ./sample-project/docker/with-celery/Dockerfile
context: .
target: with_celery
depends_on:
- with-celery-db
- with-celery-rabbitmq
env_file:
- ./sample-project/docker/.env
- ./sample-project/docker/with-celery/.env
with-celery-db:
condition: service_healthy
healthcheck:
test: "curl --fail http://localhost"
ports:
- "8001:80"
command: ["bash", "/usr/src/app/docker/wait-for-it.sh", "with-celery-db:5432", "--", "bash", "/usr/src/app/docker/with-celery/entrypoint.sh"]

with-celery-cron:
with-celery-celery:
<<: [*with-celery, *app-volumes]
build:
dockerfile: ./sample-project/docker/with-celery/Dockerfile
context: .
target: with_celery_celery
depends_on:
- with-celery-db
- with-celery-web.org
env_file:
- ./sample-project/docker/.env
- ./sample-project/docker/with-celery/.env
command: crond -l 2 -f

with-celery-rabbitmq:
condition: service_healthy
with-celery-web.org:
condition: service_healthy

with-celery-cron:
<<: [*with-celery, *app-volumes]
build:
target: with_celery_cron
depends_on:
with-celery-web.org:
condition: service_healthy

# This version uses Wagtail and does not use Celery
# This version uses Wagtail and does not use Celery
with-wagtail-db:
image: postgres
env_file: ./sample-project/docker/with-wagtail/.env
<<: [*with-wagtail, *database]

with-wagtail-web.org:
<<: [*with-wagtail, *app-volumes]
build:
dockerfile: ./sample-project/docker/with-wagtail/Dockerfile
context: .
target: with_wagtail
depends_on:
- with-wagtail-db
env_file:
- ./sample-project/docker/.env
- ./sample-project/docker/with-wagtail/.env
with-wagtail-db:
condition: service_healthy
healthcheck:
test: "curl --fail http://localhost"
ports:
- "8002:80"
command: ["bash", "/usr/src/app/docker/wait-for-it.sh", "with-wagtail-db:5432", "--", "bash", "/usr/src/app/docker/with-wagtail/entrypoint.sh"]

with-wagtail-cron:
<<: [*with-wagtail, *app-volumes]
build:
dockerfile: ./sample-project/docker/with-wagtail/Dockerfile
context: .
target: with_wagtail_cron
depends_on:
- with-wagtail-db
- with-wagtail-web.org
env_file:
- ./sample-project/docker/.env
- ./sample-project/docker/with-wagtail/.env
command: crond -l 2 -f
with-wagtail-web.org:
condition: service_healthy
2 changes: 1 addition & 1 deletion mentions/__init__.py
@@ -1,2 +1,2 @@
__version__ = "4.0.1"
__version__ = "4.0.2"
__url__ = "https://github.com/beatonma/django-wm/"

0 comments on commit 02d75fd

Please sign in to comment.