Skip to content

Commit 85e603b

Browse files
authored
Update test configuration and environment (#430)
* Update PostgreSQL client for web service to 17 * Run tests with Python 3.13 * Run tests with PostgreSQL 17 * Update web server to Debian Trixie and Python 3.13 * Specify support Python versions >=3.9,<3.14 * Update docker compose and pipenv setup
1 parent 81900f1 commit 85e603b

6 files changed

Lines changed: 243 additions & 228 deletions

File tree

.docker/web/Dockerfile

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
FROM python:3.9-bullseye
1+
FROM python:3.13-trixie
22

33
ENV PYTHONUNBUFFERED=1
44

55
COPY entrypoint.sh /
66

77
WORKDIR /code
88

9-
RUN echo "deb http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main" > /etc/apt/sources.list.d/pgdg.list
10-
RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
11-
129
RUN apt update && \
13-
apt install -y postgresql-client-15 && \
14-
pip3 install --upgrade pip pipenv
10+
apt install -y postgresql-client-17 && \
11+
python -m pip install pipenv
1512

16-
ENTRYPOINT ["/entrypoint.sh"]
13+
ENTRYPOINT ["/entrypoint.sh"]

.docker/web/entrypoint.sh

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
source .env
44

55
# Install or update dependencies on every start in case something changed
6-
python3 -m pipenv install --dev
6+
pipenv install --dev
7+
8+
# Some users prefer to develop on their host rather than containers and have adjusted .env
9+
if [ $POSTGRES_HOST == "localhost" ]; then
10+
echo -e "\033[33mWARNING: Your \$POSTGRES_HOST variable points to localhost not db!\033[0m"
11+
fi
712

813
# Wait for database to be available before running migrations
914
until pg_isready -h "$POSTGRES_HOST" -U "$POSTGRES_USER" &> /dev/null; do
@@ -12,22 +17,22 @@ until pg_isready -h "$POSTGRES_HOST" -U "$POSTGRES_USER" &> /dev/null; do
1217
done
1318

1419
# Apply pending migrations on every start
15-
python3 -m pipenv run python -m serveradmin migrate --no-input
20+
pipenv run python -m serveradmin migrate --no-input
1621

1722
# Requires Django >= 3.x
1823
# pipenv run python -m serveradmin createsuper --no-input
19-
python3 -m pipenv run python -m serveradmin createdefaultuser
24+
pipenv run python -m serveradmin createdefaultuser
2025

2126
# Create default application
22-
python3 -m pipenv run python -m serveradmin createapp --non-interactive
27+
pipenv run python -m serveradmin createapp --non-interactive
2328

2429
echo -e "
2530
********************************************************************************
2631
2732
\e[32m[TIPS]\e[39m
2833
- Run 'docker compose exec web /bin/bash' to access web service
29-
- Run 'python3 -m pipenv run python -m serveradmin -h' in web service to access django commands
30-
- Run 'python3 -m pipenv run python -m adminapi example.com' in web service to make adminapi queries
34+
- Run 'pipenv run python -m serveradmin -h' in web service to access django commands
35+
- Run 'pipenv run python -m adminapi example.com' in web service to make adminapi queries
3136
3237
\e[33mAccess serveradmin from your browser via:\e[39m
3338
- URL: http://127.0.0.1:8000
@@ -38,4 +43,4 @@ echo -e "
3843
"
3944

4045
# Start development server reachable for host machine
41-
python3 -m pipenv run python -m serveradmin runserver 0.0.0.0:8000
46+
pipenv run python -m serveradmin runserver 0.0.0.0:8000

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ jobs:
1515
matrix:
1616
python:
1717
- "3.9"
18-
- "3.10"
18+
- "3.13"
1919

2020
services:
2121
db:
22-
image: 'postgres:15'
22+
image: 'postgres:17'
2323
env:
2424
POSTGRES_USER: serveradmin
2525
POSTGRES_PASSWORD: serveradmin

Pipfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ faker = "<14.0.0"
4646
tblib = "*"
4747

4848
[requires]
49-
python_version = "3.9"
49+
python_version = "3.13"
5050

5151
[production]
5252
sentry-sdk = {version = "*", extras = ["django"]}

0 commit comments

Comments
 (0)