This commit is contained in:
2025-10-15 23:33:08 +02:00
parent 7f58f12b8d
commit c1e14fa2d6
3 changed files with 14 additions and 11 deletions

View File

@@ -20,11 +20,11 @@ services:
CADDY_INGRESS_NETWORKS: ${COMPOSE_PROJECT_NAME}_caddy_net CADDY_INGRESS_NETWORKS: ${COMPOSE_PROJECT_NAME}_caddy_net
volumes: volumes:
- caddy_config:/config - caddy_config:/config
- caddy_data:/data - ./caddy:/data
- /var/run/docker.sock:/var/run/docker.sock:ro - /var/run/docker.sock:/var/run/docker.sock:ro
- ./data:/srv/www:ro - ./data:/srv/www:ro
labels: labels:
caddy: "static.localhost" caddy: "localhost"
caddy.root: "* /srv/www" caddy.root: "* /srv/www"
caddy.file_server: "" # Active le serveur de fichiers statiques caddy.file_server: "" # Active le serveur de fichiers statiques
caddy.tls: internal # HTTPS auto-signé géré par Caddy caddy.tls: internal # HTTPS auto-signé géré par Caddy

View File

@@ -31,10 +31,9 @@ payload = {
"password": PASSWORD, "password": PASSWORD,
"bind_address": "0.0.0.0" "bind_address": "0.0.0.0"
} }
r1 = requests.post(f'{COUCHDB_URL}/_cluster_setup', json=payload) r1 = requests.post(f'{COUCHDB_URL}/_cluster_setup', auth=(USER, PASSWORD), json=payload)
r2 = requests.post(f'{COUCHDB_URL}/_cluster_setup', json={"action": "finish_cluster"})
if r1.ok and r2.ok: if r1.ok:
print('✅ CouchDB initialisé avec succès.') print('✅ CouchDB initialisé avec succès.')
else: else:
print('❌ Erreur lors de l\'initialisation :', r1.text, r2.text) print('❌ Erreur lors de l\'initialisation :', r1.text)

View File

@@ -1,8 +1,9 @@
@couchDB = http://{{$dotenv COUCHDB_USER}}:{{$dotenv COUCHDB_PASSWORD}}@couchdb.localhost @couchDB = http://couchdb.localhost
### Init ### Init
POST {{couchDB}}/_cluster_setup POST {{couchDB}}/_cluster_setup
Authorization: Basic {{$dotenv COUCHDB_USER}}:{{$dotenv COUCHDB_PASSWORD}}
Content-Type: application/json Content-Type: application/json
{ {
@@ -13,20 +14,20 @@ Content-Type: application/json
"port": 5984 "port": 5984
} }
### Creates a new database.
GET {{couchDB}}/_users
### ###
GET {{couchDB}}/_all_dbs GET {{couchDB}}/_all_dbs
Authorization: Basic {{$dotenv COUCHDB_USER}}:{{$dotenv COUCHDB_PASSWORD}}
### Creates a new database. ### Creates a new database.
PUT {{couchDB}}/db PUT {{couchDB}}/db
Authorization: Basic {{$dotenv COUCHDB_USER}}:{{$dotenv COUCHDB_PASSWORD}}
### Creates a new document in the specified database, using the supplied JSON document structure. ### Creates a new document in the specified database, using the supplied JSON document structure.
POST {{couchDB}}/db POST {{couchDB}}/db
Accept: application/json Accept: application/json
Content-Type: application/json Content-Type: application/json
Authorization: Basic {{$dotenv COUCHDB_USER}}:{{$dotenv COUCHDB_PASSWORD}}
{ {
"servings": 4, "servings": 4,
@@ -36,12 +37,15 @@ Content-Type: application/json
### ###
GET {{couchDB}}/db/_all_docs GET {{couchDB}}/db/_all_docs
Authorization: Basic {{$dotenv COUCHDB_USER}}:{{$dotenv COUCHDB_PASSWORD}}
### ###
GET {{couchDB}}/db/df9679762e2630b609a69ecf9c000d67 GET {{couchDB}}/db/2c2135ff744c3b98407572ed4f000cad
Authorization: Basic {{$dotenv COUCHDB_USER}}:{{$dotenv COUCHDB_PASSWORD}}
### ###
POST {{couchDB}}/db/_find POST {{couchDB}}/db/_find
Authorization: Basic {{$dotenv COUCHDB_USER}}:{{$dotenv COUCHDB_PASSWORD}}
Accept: application/json Accept: application/json
Content-Type: application/json Content-Type: application/json
Content-Length: 168 Content-Length: 168