Skip to content

Commit

Permalink
Ensure Python >= 3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
kofrezo committed Jul 19, 2023
1 parent 2b900ac commit e7cb79d
Show file tree
Hide file tree
Showing 5 changed files with 141 additions and 93 deletions.
8 changes: 4 additions & 4 deletions .docker/web/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Pipenv seems to not work with bullseye (yet)
FROM python:3.7-buster
FROM python:3.9-bullseye

ENV PYTHONUNBUFFERED=1

COPY entrypoint.sh /

WORKDIR /code

RUN echo "deb http://apt.postgresql.org/pub/repos/apt buster-pgdg main" > /etc/apt/sources.list.d/pgdg.list
RUN echo "deb http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main" > /etc/apt/sources.list.d/pgdg.list
RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -

RUN apt update && \
apt install -y pipenv postgresql-client-14
apt install -y postgresql-client-15 && \
pip3 install --upgrade pip pipenv

ENTRYPOINT ["/entrypoint.sh"]
16 changes: 8 additions & 8 deletions .docker/web/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
source .env

# Install or update dependencies on every start in case something changed
pipenv install --dev
python3 -m pipenv install --dev

# Wait for database to be available before running migrations
until pg_isready -h "$POSTGRES_HOST" -U "$POSTGRES_USER" &> /dev/null; do
Expand All @@ -12,23 +12,23 @@ until pg_isready -h "$POSTGRES_HOST" -U "$POSTGRES_USER" &> /dev/null; do
done

# Apply pending migrations on every start
pipenv run python -m serveradmin migrate --no-input
pipenv run python -m serveradmin migrate --database=powerdns --no-input
python3 -m pipenv run python -m serveradmin migrate --no-input
python3 -m pipenv run python -m serveradmin migrate --database=powerdns --no-input

# Requires Django >= 3.x
# pipenv run python -m serveradmin createsuper --no-input
pipenv run python -m serveradmin createdefaultuser
python3 -m pipenv run python -m serveradmin createdefaultuser

# Create default application
pipenv run python -m serveradmin createapp --non-interactive
python3 -m pipenv run python -m serveradmin createapp --non-interactive

echo -e "
********************************************************************************
\e[32m[TIPS]\e[39m
- Run 'docker-compose exec web /bin/bash' to access web service
- Run 'pipenv run python -m serveradmin -h' in web service to access django commands
- Run 'pipenv run python -m adminapi example.com' in web service to make adminapi queries
- Run 'python3 -m pipenv run python -m serveradmin -h' in web service to access django commands
- Run 'python3 -m pipenv run python -m adminapi example.com' in web service to make adminapi queries
\e[33mAccess serveradmin from your browser via:\e[39m
- URL: http://127.0.0.1:8000
Expand All @@ -39,4 +39,4 @@ echo -e "
"

# Start development server reachable for host machine
pipenv run python -m serveradmin runserver 0.0.0.0:8000
python3 -m pipenv run python -m serveradmin runserver 0.0.0.0:8000
2 changes: 0 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ jobs:
strategy:
matrix:
python:
- "3.7"
- "3.8"
- "3.9"
- "3.10"

Expand Down
6 changes: 5 additions & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ django_compressor = "<3.0.0"
paramiko = "~=2.10"
pexpect = "<5.0.0"
rich = "*"
typing-extensions = "*"

[dev-packages]
# Used to build the sphinx docs
Expand All @@ -45,4 +46,7 @@ faker = "<14.0.0"
tblib = "*"

[requires]
python_version = "3.7"
python_version = "3.9"

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

0 comments on commit e7cb79d

Please sign in to comment.