Skip to content

Commit 522f959

Browse files
authoredJun 21, 2024··
CC-2137 NZSL move Signbank to poetry (#171)
##JIRA Ticket [CC-2137 NZSL: move signbank to Poetry](https://ackama.atlassian.net/browse/CC-2137) ## Changes - `requirements.*` files removed - `pyproject.toml` and `poetry.lock` added - unpinned all dependencies - added `depends_on` and `healthcheck` to `docker-compose.yml` to avoid database race condition on local dev - exposed port `5432` on local dev - `0.0.0.0` added to `DEFAULT_ALLOWED_HOSTS`
1 parent a27d457 commit 522f959

File tree

6 files changed

+685
-27
lines changed

6 files changed

+685
-27
lines changed
 

‎Dockerfile

+8-5
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ FROM python:3.9
1414

1515
ENV DJANGO_SETTINGS_MODULE=signbank.settings.development
1616

17-
CMD pip install -r requirements.txt && \
18-
bin/develop.py migrate --noinput && \
17+
RUN pip install "poetry==1.8.3"
18+
19+
CMD bin/develop.py migrate --noinput && \
1920
bin/develop.py createcachetable && \
2021
(\
2122
(test $DJANGO_SETTINGS_MODULE = 'signbank.settings.development' && \
@@ -44,8 +45,10 @@ RUN echo "APT::Install-Recommends \"0\";" >> /etc/apt/apt.conf.d/02recommends &&
4445

4546
# Install requirements
4647
WORKDIR /app
47-
ADD requirements.txt /app
48-
RUN pip --no-cache-dir install --src=/opt pyinotify -r requirements.txt
48+
ADD pyproject.toml poetry.lock /app/
49+
RUN poetry config installer.max-workers 10 && \
50+
poetry config virtualenvs.create false && \
51+
poetry install -v --no-root
4952

5053
# Copy frontend assets
5154
COPY --from=node /app/signbank/static/js ./signbank/static/js
@@ -55,4 +58,4 @@ COPY --from=node /app/signbank/static/css ./signbank/static/css
5558
ADD . /app
5659

5760
# Collect static assets
58-
RUN bin/develop.py collectstatic
61+
RUN bin/develop.py collectstatic --no-input

‎docker-compose.yml

+10
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,20 @@ services:
1616
links:
1717
- database
1818
- mail
19+
depends_on:
20+
database:
21+
condition: service_healthy
1922
database:
2023
image: postgres:14
2124
environment:
2225
- "POSTGRES_PASSWORD=postgres"
26+
ports:
27+
- 5432:5432
28+
healthcheck:
29+
test: ["CMD", "/usr/bin/pg_isready", "-h", "database", "-p", "5432", "-U", "postgres", "-d", "postgres"]
30+
interval: 3s
31+
timeout: 2s
32+
retries: 5
2333
mail:
2434
image: djfarrelly/maildev
2535
ports:

‎poetry.lock

+630
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎pyproject.toml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[tool.poetry]
2+
name = "nzsl-signbank"
3+
version = "0.1.0"
4+
description = "Web based database for sign language lexicons and corpuses. Fork of NGT-signbank."
5+
authors = ["Ackama <info@ackama.com>"]
6+
license = "BSD-3-Clause license"
7+
readme = "README.md"
8+
homepage = "https://signbank.nzsl.nz/"
9+
repository = "https://github.com/ODNZSL/NZSL-signbank"
10+
11+
[tool.poetry.dependencies]
12+
python = "^3.9"
13+
django = "~3.2.25"
14+
django-bootstrap3 = "*"
15+
django-contrib-comments = "*"
16+
django-debug-toolbar = "*"
17+
django-guardian = "*"
18+
django-modeltranslation = "*"
19+
django-notifications-hq = "*"
20+
django-queryset-csv = "*"
21+
django-registration = "*"
22+
django-reversion = "*"
23+
django-storages = "*"
24+
django-summernote = "*"
25+
django-tagging = "*"
26+
boto3 = "*"
27+
certifi = "*"
28+
dj-database-url = "*"
29+
gunicorn = "*"
30+
psycopg2 = "*"
31+
sentry-sdk = "*"
32+
whitenoise = "*"
33+
34+
[build-system]
35+
requires = ["poetry-core"]
36+
build-backend = "poetry.core.masonry.api"

‎requirements.txt

-21
This file was deleted.

‎signbank/settings/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@
265265
DEBUG = os.environ.get('DEBUG', 'false').lower() == 'true'
266266

267267
# Set ALLOWED_HOSTS from an environment variable, with defaults
268-
DEFAULT_ALLOWED_HOSTS = ['127.0.0.1', 'localhost']
268+
DEFAULT_ALLOWED_HOSTS = ['127.0.0.1', 'localhost', '0.0.0.0']
269269
ALLOWED_HOSTS = os.environ.get("ALLOWED_HOSTS").split(
270270
",") if os.getenv("ALLOWED_HOSTS") else DEFAULT_ALLOWED_HOSTS
271271

0 commit comments

Comments
 (0)
Please sign in to comment.