Skip to content

Commit

Permalink
Add pg17
Browse files Browse the repository at this point in the history
  • Loading branch information
sichapman authored Oct 7, 2024
1 parent 2b9b526 commit 151f5a6
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 4 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ This file specifies which commodities the dev-env should create and launch for t
The list of allowable commodity values is:

1. postgres-13
2. db2_community
2. postgres-17
3. db2_community
4. elasticsearch5
5. nginx
6. rabbitmq
Expand Down Expand Up @@ -166,7 +167,7 @@ If you want to spatially enable your database see the following example:

[Example - Spatial](snippets/spatial_postgres-init-fragment.sql)

The default Postgres port 5432 will be available for connections from other containers. Port 5434 is exposed for external connections from the host.
The default Postgres port 5432 will be available for connections from other containers, hostname `postgres-13` or `postgres-17`. Port `5434` (for PG13) or `5435` (for PG17) is exposed for external connections from the host.

**`/manage.py`**

Expand Down
2 changes: 2 additions & 0 deletions scripts/add-aliases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ alias ex="$DC_CMD exec"
alias status="$DC_CMD ps"
alias run="$DC_CMD run --rm"
alias psql13="$DC_CMD exec postgres-13 psql -h postgres-13 -U root -d"
alias psql17="$DC_CMD exec postgres-17 psql -h postgres-17 -U root -d"
alias db2co="$DC_CMD exec --user db2inst1 db2_community bash -c '~/sqllib/bin/db2'"
alias gitlist="bash $DEV_ENV_ROOT_DIR/scripts/git_list.sh"
alias gitpull="bash $DEV_ENV_ROOT_DIR/scripts/git_pull.sh"
Expand Down Expand Up @@ -212,6 +213,7 @@ function devenv-help(){
if you add -f it will automatically fix issues where possible
(flags can be combined)
psql13 <name of database> - run psql in the postgres-13 container
psql17 <name of database> - run psql in the postgres-17 container
db2co - run db2 command line in the db2_community container
manage <name of container> <command> - run manage.py commands in a container
alembic <name of container> <command> - run an alembic db command in a container, with the appropriate environment variables preset
Expand Down
2 changes: 1 addition & 1 deletion scripts/commodities.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def provision_commodities(root_loc, new_containers)
# If you later modify .commodities to allow this to run again (e.g. if you've added new apps to your group),
# you'll need to delete the postgres container and it's volume else you'll get errors.
# Do a fullreset, or docker-compose rm -v -f postgres-13
['13'].each do |postgres_version|
['13', '17'].each do |postgres_version|
provision_postgres(root_loc, new_containers, postgres_version)
# Alembic, too
provision_alembic(root_loc, postgres_version)
Expand Down
17 changes: 17 additions & 0 deletions scripts/docker/postgres-17/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM docker.io/postgres:17

# Install the PostGIS extension
RUN apt-get update && \
apt-get install -y postgresql-17-postgis-3 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# This user will be created as the superuser
# PG* are for dev use - while in the container psql will just work (useful for the provisioning)
ENV POSTGRES_USER=root \
POSTGRES_PASSWORD=superroot \
PGUSER=root \
PGPASSWORD=superroot

HEALTHCHECK --interval=10s --retries=20 \
CMD pg_isready -h localhost || exit 1
6 changes: 6 additions & 0 deletions scripts/docker/postgres-17/compose-fragment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
services:
postgres-17:
container_name: postgres-17
build: ../scripts/docker/postgres-17/
ports:
- "5435:5432"
7 changes: 7 additions & 0 deletions scripts/docker/postgres-17/docker-compose-fragment.3.7.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: '3.7'
services:
postgres-17:
container_name: postgres-17
build: ../scripts/docker/postgres-17/
ports:
- "5435:5432"
7 changes: 7 additions & 0 deletions scripts/docker/postgres-17/docker-compose-fragment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: '2'
services:
postgres-17:
container_name: postgres-17
build: ../scripts/docker/postgres-17/
ports:
- "5435:5432"
2 changes: 2 additions & 0 deletions scripts/provision_postgres.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ def postgres_container(postgres_version)
case postgres_version
when '13'
'postgres-13'
when '17'
'postgres-17'
else
puts colorize_red("Unknown PostgreSQL version (#{postgres_version}) specified.")
''
Expand Down
1 change: 1 addition & 0 deletions scripts/remove-aliases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ unalias ex
unalias status
unalias run
unalias psql13
unalias psql17
unalias db2co
unalias cadence-cli

Expand Down
2 changes: 1 addition & 1 deletion snippets/app_configuration.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
commodities: ["postgres-13", "elasticsearch5", "rabbitmq", "db2_community"]
commodities: ["postgres-17", "elasticsearch5", "rabbitmq", "db2_community"]
# Optional
expensive_startup:
- compose_service: name-of-service-from-compose-fragment
Expand Down

0 comments on commit 151f5a6

Please sign in to comment.