From 6961caa2af5599d08e4611ae1071375739c8570c Mon Sep 17 00:00:00 2001 From: medina5 Date: Tue, 14 Oct 2025 23:27:54 +0200 Subject: [PATCH] couchdb --- compose.yaml | 4 ++++ couchdb.http | 17 ++++++++++++++++- data/index.html | 14 ++++++++++---- .../08_superset.sql | 3 ++- .../10_postgrest.sql | 19 ++++++++++++++++--- .../11_postgraphile.sql | 19 +++++++++++++++++-- 6 files changed, 65 insertions(+), 11 deletions(-) diff --git a/compose.yaml b/compose.yaml index b164bb8..9b245a8 100644 --- a/compose.yaml +++ b/compose.yaml @@ -110,6 +110,10 @@ services: environment: COUCHDB_USER: ${COUCHDB_USER} COUCHDB_PASSWORD: ${COUCHDB_PASSWORD} + ports: + - 5984:5984 + networks: + - caddy_net labels: caddy: couchdb.localhost caddy.reverse_proxy: "{{upstreams 5984}}" diff --git a/couchdb.http b/couchdb.http index ff2ce40..bea3b02 100644 --- a/couchdb.http +++ b/couchdb.http @@ -1,5 +1,20 @@ @couchDB = http://{{$dotenv COUCHDB_USER}}:{{$dotenv COUCHDB_PASSWORD}}@couchdb.localhost +### + +POST {{couchDB}}/_cluster_setup +Content-Type: application/json + +{ + "action": "enable_single_node", + "username": "{{$dotenv COUCHDB_USER}}", + "password": "{{$dotenv COUCHDB_PASSWORD}}", + "bind_address": "0.0.0.0", + "port": 5984 +} + +### + GET {{couchDB}}/_all_dbs ### Creates a new database. @@ -20,7 +35,7 @@ Content-Type: application/json GET {{couchDB}}/db/_all_docs ### -GET {{couchDB}}/db/74913d6d85b8af1d174baf3fe5000507 +GET {{couchDB}}/db/df9679762e2630b609a69ecf9c000d67 ### POST {{couchDB}}/db/_find diff --git a/data/index.html b/data/index.html index 361050e..379cb01 100644 --- a/data/index.html +++ b/data/index.html @@ -12,10 +12,16 @@

Base de données

diff --git a/postgresql-entrypoint-initdb.d/08_superset.sql b/postgresql-entrypoint-initdb.d/08_superset.sql index 83bcb4c..313df49 100644 --- a/postgresql-entrypoint-initdb.d/08_superset.sql +++ b/postgresql-entrypoint-initdb.d/08_superset.sql @@ -31,7 +31,8 @@ grant select in schema public to superset_user; --- Privilège par défaut pour que chaque nouvelle table créée dans public donnera automatiquement le droit SELECT à superset_user. +-- Privilège par défaut pour que chaque nouvelle table créée dans public +-- donnera automatiquement le droit SELECT à superset_user. alter default privileges in schema public grant select diff --git a/postgresql-entrypoint-initdb.d/10_postgrest.sql b/postgresql-entrypoint-initdb.d/10_postgrest.sql index 70cf6cf..864417c 100644 --- a/postgresql-entrypoint-initdb.d/10_postgrest.sql +++ b/postgresql-entrypoint-initdb.d/10_postgrest.sql @@ -17,7 +17,20 @@ create role adherent nologin; grant anonyme to postgrest; grant adherent to postgrest; -grant usage on schema public to anonyme; +grant usage + on schema public + to anonyme; -alter default privileges in schema public - grant select on tables to anonyme; +-- Pour toutes les tables du schéma public +grant select + on all tables + in schema public + to anonyme; + +-- Privilège par défaut pour que chaque nouvelle table créée dans public +-- donnera automatiquement le droit SELECT à anonyme. +alter default privileges + in schema public + grant select + on tables + to anonyme; diff --git a/postgresql-entrypoint-initdb.d/11_postgraphile.sql b/postgresql-entrypoint-initdb.d/11_postgraphile.sql index b40322c..abfbf34 100644 --- a/postgresql-entrypoint-initdb.d/11_postgraphile.sql +++ b/postgresql-entrypoint-initdb.d/11_postgraphile.sql @@ -1,5 +1,20 @@ 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; +grant usage + on schema public + to postgraphile_user; + +-- Pour toutes les tables du schéma public +grant select + on all tables + in schema public + to postgraphile_user; + +-- Privilège par défaut pour que chaque nouvelle table créée dans public +-- donnera automatiquement le droit SELECT à postgraphile_user. +alter default privileges + in schema public + grant select + on tables + to postgraphile_user;