add sql extensions
This commit is contained in:
parent
9385e45c8e
commit
f0ec5745eb
13
compose.yml
13
compose.yml
|
@ -50,7 +50,7 @@ services:
|
||||||
- LISTEN_HOST=0.0.0.0
|
- LISTEN_HOST=0.0.0.0
|
||||||
- LISTEN_SERVER=uvicorn
|
- LISTEN_SERVER=uvicorn
|
||||||
- SECRET_KEY=foobar
|
- SECRET_KEY=foobar
|
||||||
- DATABASE_HOST=postgres
|
- DATABASE_HOST=db
|
||||||
- DATABASE_PORT=5432
|
- DATABASE_PORT=5432
|
||||||
- DATABASE_NAME=karrot
|
- DATABASE_NAME=karrot
|
||||||
- DATABASE_USER=karrot
|
- DATABASE_USER=karrot
|
||||||
|
@ -124,10 +124,9 @@ services:
|
||||||
timeout: 3s
|
timeout: 3s
|
||||||
retries: 30
|
retries: 30
|
||||||
configs:
|
configs:
|
||||||
- source: postgres_entrypoint
|
- source: postgres_extensions
|
||||||
target: /coopcloud-entrypoint.sh
|
target: /docker-entrypoint-initdb.d/extensions.sql
|
||||||
mode: 0555
|
mode: 0555
|
||||||
entrypoint: /coopcloud-entrypoint.sh
|
|
||||||
volumes:
|
volumes:
|
||||||
- "postgres_data:/var/lib/postgresql/data"
|
- "postgres_data:/var/lib/postgresql/data"
|
||||||
networks:
|
networks:
|
||||||
|
@ -148,9 +147,9 @@ configs:
|
||||||
name: ${STACK_NAME}_nginx_config_${NGINX_CONFIG_VERSION}
|
name: ${STACK_NAME}_nginx_config_${NGINX_CONFIG_VERSION}
|
||||||
file: nginx.conf.tmpl
|
file: nginx.conf.tmpl
|
||||||
template_driver: golang
|
template_driver: golang
|
||||||
postgres_entrypoint:
|
postgres_extensions:
|
||||||
name: ${STACK_NAME}_postgres_entrypoint_${POSTGRES_ENTRYPOINT_VERSION}
|
name: ${STACK_NAME}_postgres_extensions_${POSTGRES_ENTRYPOINT_VERSION}
|
||||||
file: pg_entrypoint.sh
|
file: pg_extensions.sql
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
shiv_data:
|
shiv_data:
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
# This is based on https://github.com/postgis/docker-postgis/blob/4eb614133d6aa87bfc5c952d24b7eb1f499e5c7c/12-3.0/initdb-postgis.sh
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# Perform all actions as $POSTGRES_USER
|
|
||||||
export PGUSER="$POSTGRES_USER"
|
|
||||||
|
|
||||||
for DB in template1 "$POSTGRES_DB"; do
|
|
||||||
echo "Loading extensions into $DB"
|
|
||||||
"${psql[@]}" --dbname="$DB" <<-'EOSQL'
|
|
||||||
CREATE EXTENSION IF NOT EXISTS citext;
|
|
||||||
CREATE EXTENSION IF NOT EXISTS btree_gist;
|
|
||||||
EOSQL
|
|
||||||
done
|
|
||||||
|
|
||||||
/docker-entrypoint.sh "$@"
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
CREATE EXTENSION IF NOT EXISTS citext;
|
||||||
|
CREATE EXTENSION IF NOT EXISTS btree_gist;
|
Loading…
Reference in New Issue