From 4d706fcd344b866cc4559dd1eb8e3911a56843f3 Mon Sep 17 00:00:00 2001
From: Hugo Trentesaux <hugo@trentesaux.fr>
Date: Fri, 19 Apr 2024 12:48:43 +0200
Subject: [PATCH] add subdomain gateway

and volume for easier config
---
 docker-compose.prod.yml |  3 +++
 scripts/configure.sh    | 14 ++++++++------
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml
index 5c82ef2..a94881a 100644
--- a/docker-compose.prod.yml
+++ b/docker-compose.prod.yml
@@ -45,8 +45,10 @@ services:
       - 127.0.0.1:5001:5001
     volumes:
       - kubo_data:/data/ipfs
+      - kubo_init:/container-init.d
     environment:
       KUBO_GATEWAY_DOMAIN: "gateway.datapod.coinduf.eu"
+      KUBO_GATEWAY_SUBDOMAIN: "subgateway.datapod.coinduf.eu"
     restart: always
 
   # ------
@@ -69,3 +71,4 @@ services:
 volumes:
   db_data:
   kubo_data:
+  kubo_init:
diff --git a/scripts/configure.sh b/scripts/configure.sh
index 71ca3af..eb287d7 100644
--- a/scripts/configure.sh
+++ b/scripts/configure.sh
@@ -15,11 +15,13 @@ ipfs config API.HTTPHeaders.Access-Control-Allow-Methods --json '["PUT", "POST"]
 
 # --- gateway ---
 # prevent gateway from fetching foreign data
-ipfs config Gateway.NoFetch --json true
-# allow to expose hostname
-ipfs config Gateway.PublicGateways --json "{\"$KUBO_GATEWAY_DOMAIN\":{\"UseSubdomains\": false,\"Paths\":[\"/ipfs\"]}}"
+# ipfs config Gateway.NoFetch --json true
+# ipfs config Gateway.NoFetch --json false
+# public gateway without subdomain (no wildcard)
+# enables /ipfs and /routing (delegated routing)
+# public gateway with subdomain (needs wildcard)
+ipfs config Gateway.PublicGateways --json "{\"$KUBO_GATEWAY_DOMAIN\":{\"UseSubdomains\":false,\"Paths\":[\"/ipfs\",\"/routing\"]},\"$KUBO_GATEWAY_SUBDOMAIN\":{\"UseSubdomains\":true,\"Paths\":[\"/ipfs\",\"/routing\"]}}"
 
 # only reprovide pinned data
-ipfs config Reprovider.Strategy "pinned"
-
-
+# ipfs config Reprovider.Strategy "pinned"
+# ipfs config Reprovider.Strategy --json null
-- 
GitLab