diff --git a/compose.yaml b/compose.yaml index a632b34..b164bb8 100644 --- a/compose.yaml +++ b/compose.yaml @@ -183,7 +183,7 @@ services: condition: service_healthy command: [ - "--port", "${POSTGRAPHILE_PORT:-5000}", + "--port", "80", "--schema", "${POSTGRAPHILE_SCHEMA:-public}", "--enhance-graphiql", "--cors", @@ -195,14 +195,14 @@ services: networks: - caddy_net environment: - - PGHOST=${POSTGRAPHILE_HOST:-database} - - PGPORT=${POSTGRAPHILE_DB_PORT:-5432} - - PGUSER=${POSTGRAPHILE_DB_USER:-postgraphile} + - PGHOST=database + - PGPORT=5432 + - PGUSER=${POSTGRAPHILE_USER:-postgraphile_user} - PGPASSWORD=${POSTGRAPHILE_PASSWORD:-9013} - PGDATABASE=${COMPOSE_PROJECT_NAME} labels: caddy: postgraphile.localhost - caddy.reverse_proxy: "{{upstreams 5000}}" + caddy.reverse_proxy: "{{upstreams 80}}" caddy.tls: internal # ---------------------------------------------------------------------- @@ -229,6 +229,7 @@ services: PGRST_JWT_SECRET: ${POSTGREST_JWT_SECRET:-ChangeMeChangeMeChangeMeChangeMe} PGRST_ADMIN_SERVER_PORT: 3055 PGRST_SERVER_PORT: 80 + PGRST_OPENAPI_SERVER_PROXY_URI: https://postgrest.localhost networks: - caddy_net labels: diff --git a/postgis/postgis.sql b/postgis/postgis.sql index 82b215e..7c65f6a 100644 --- a/postgis/postgis.sql +++ b/postgis/postgis.sql @@ -1,4 +1,4 @@ -set SEARCH_PATH to postgis,public; +set SEARCH_PATH to public,postgis; create table point ( id serial primary key, diff --git a/postgresql-entrypoint-initdb.d/1_initdb.sql b/postgresql-entrypoint-initdb.d/01_initdb.sql similarity index 85% rename from postgresql-entrypoint-initdb.d/1_initdb.sql rename to postgresql-entrypoint-initdb.d/01_initdb.sql index da9e5b1..77f9f3d 100644 --- a/postgresql-entrypoint-initdb.d/1_initdb.sql +++ b/postgresql-entrypoint-initdb.d/01_initdb.sql @@ -5,9 +5,12 @@ create schema postgis; create extension if not exists postgis schema postgis; create extension if not exists pgrouting schema postgis; -create extension if not exists ltree; -create extension if not exists pgtap; -create extension if not exists pgcrypto; +create schema ext; +create extension if not exists ltree schema ext; +create extension if not exists pgcrypto schema ext; + +create schema pgtap; +create extension if not exists pgtap schema pgtap; create table adherent ( id int primary key, @@ -22,7 +25,7 @@ create table famille ( code text primary key, famille text, code_parent text, -- references famille(code) - arborescence ltree + arborescence ext.ltree ); create table article ( diff --git a/postgresql-entrypoint-initdb.d/2_seed.sql b/postgresql-entrypoint-initdb.d/02_seed.sql similarity index 100% rename from postgresql-entrypoint-initdb.d/2_seed.sql rename to postgresql-entrypoint-initdb.d/02_seed.sql diff --git a/postgresql-entrypoint-initdb.d/3_views.sql b/postgresql-entrypoint-initdb.d/03_views.sql similarity index 100% rename from postgresql-entrypoint-initdb.d/3_views.sql rename to postgresql-entrypoint-initdb.d/03_views.sql diff --git a/postgresql-entrypoint-initdb.d/5_nestedsets.sql b/postgresql-entrypoint-initdb.d/05_nestedsets.sql similarity index 100% rename from postgresql-entrypoint-initdb.d/5_nestedsets.sql rename to postgresql-entrypoint-initdb.d/05_nestedsets.sql diff --git a/postgresql-entrypoint-initdb.d/7_metabase.sql b/postgresql-entrypoint-initdb.d/07_metabase.sql similarity index 100% rename from postgresql-entrypoint-initdb.d/7_metabase.sql rename to postgresql-entrypoint-initdb.d/07_metabase.sql diff --git a/postgresql-entrypoint-initdb.d/8_superset.sql b/postgresql-entrypoint-initdb.d/08_superset.sql similarity index 100% rename from postgresql-entrypoint-initdb.d/8_superset.sql rename to postgresql-entrypoint-initdb.d/08_superset.sql diff --git a/postgresql-entrypoint-initdb.d/9_json.sql b/postgresql-entrypoint-initdb.d/09_json.sql similarity index 100% rename from postgresql-entrypoint-initdb.d/9_json.sql rename to postgresql-entrypoint-initdb.d/09_json.sql diff --git a/postgresql-entrypoint-initdb.d/11_postgraphile.sql b/postgresql-entrypoint-initdb.d/11_postgraphile.sql index 5331723..b40322c 100644 --- a/postgresql-entrypoint-initdb.d/11_postgraphile.sql +++ b/postgresql-entrypoint-initdb.d/11_postgraphile.sql @@ -1,2 +1,5 @@ -create role postgraphile nosuperuser nocreatedb nocreaterole noinherit noreplication nobypassrls +create role postgraphile_user nosuperuser nocreatedb nocreaterole noinherit noreplication nobypassrls login password '9013'; + +alter default privileges in schema public + grant select on tables to postgraphile_user; diff --git a/postgresql-entrypoint-initdb.d/4_pgtap.sql b/postgresql-entrypoint-initdb.d/12_pgtap.sql similarity index 93% rename from postgresql-entrypoint-initdb.d/4_pgtap.sql rename to postgresql-entrypoint-initdb.d/12_pgtap.sql index f90fe90..73291a5 100644 --- a/postgresql-entrypoint-initdb.d/4_pgtap.sql +++ b/postgresql-entrypoint-initdb.d/12_pgtap.sql @@ -1,3 +1,5 @@ +set SEARCH_PATH to public,pgtap; + SELECT plan(4); SELECT is( @@ -26,3 +28,5 @@ SELECT is( -- Termine le test SELECT * FROM finish(); + +\dx diff --git a/postgresql-entrypoint-initdb.d/6_end.sql b/postgresql-entrypoint-initdb.d/6_end.sql deleted file mode 100644 index 042252b..0000000 --- a/postgresql-entrypoint-initdb.d/6_end.sql +++ /dev/null @@ -1 +0,0 @@ -\dx