From eb8e1f394b8e3cd88df19c98b36d6a7a8cc452c8 Mon Sep 17 00:00:00 2001 From: TheFrenchGhosty Date: Thu, 4 Nov 2021 16:05:31 +0100 Subject: [PATCH 1/4] Add a production-ready compose and enhance the development one --- README.md | 43 ++++++++++++++++++++++++++++++++++++++++++- docker-compose.yml | 38 +++++++++++++++++++++++++------------- 2 files changed, 67 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index cd47dec..5c30e43 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,48 @@ See ```CHANGELOG.md``` ## Installation -### Docker-compose method +### Docker-compose method (production) + +```console +version: "3.8" + +services: + + teddit: + container_name: teddit + image: teddit/teddit:latest + environment: + - DOMAIN=teddit.net + - USE_HELMET=true + - USE_HELMET_HSTS=true + - TRUST_PROXY=true + - REDIS_HOST=teddit-redis + ports: + - "127.0.0.1:8080:8080" + networks: + - teddit_net + healthcheck: + test: ["CMD", "wget" ,"--no-verbose", "--tries=1", "--spider", "http://localhost:8080/about"] + interval: 1m + timeout: 3s + depends_on: + - teddit-redis + + teddit-redis: + container_name: teddit-redis + image: redis:6.2.5-alpine + command: redis-server + environment: + - REDIS_REPLICATION_MODE=master + networks: + - teddit_net + +networks: + teddit_net: +``` + + +### Docker-compose method (development) ```console git clone https://codeberg.org/teddit/teddit diff --git a/docker-compose.yml b/docker-compose.yml index e16f226..60b6238 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,21 +1,23 @@ version: "3.8" services: - redis: - image: redis:6.2.5-alpine - command: redis-server - environment: - - REDIS_REPLICATION_MODE=master - ports: - - "6379:6379" - networks: - - teddit_net - web: + + teddit: + container_name: teddit build: . environment: - - REDIS_HOST=redis + - DOMAIN=teddit.pussthecat.org + - THEME=dark + - USE_HELMET=true + - USE_HELMET_HSTS=true + - TRUST_PROXY=true + - NSFW_ENABLED=false + - POST_COMMENTS_SORT=top + - CACHE_CONTROL=true + - CACHE_MAX_SIZE=10000 + - REDIS_HOST=teddit-redis ports: - - 8080:8080 + - "8080:8080" networks: - teddit_net healthcheck: @@ -23,6 +25,16 @@ services: interval: 1m timeout: 3s depends_on: - - redis + - teddit-redis + + teddit-redis: + container_name: teddit-redis + image: redis:6.2.5-alpine + command: redis-server + environment: + - REDIS_REPLICATION_MODE=master + networks: + - teddit_net + networks: teddit_net: From 43f846c1e58ff525819da0df1def7c7647f6906c Mon Sep 17 00:00:00 2001 From: TheFrenchGhosty Date: Thu, 4 Nov 2021 16:12:10 +0100 Subject: [PATCH 2/4] Remove the useless environment variables added by mistake to the development compose --- docker-compose.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 60b6238..71d78ea 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,15 +6,6 @@ services: container_name: teddit build: . environment: - - DOMAIN=teddit.pussthecat.org - - THEME=dark - - USE_HELMET=true - - USE_HELMET_HSTS=true - - TRUST_PROXY=true - - NSFW_ENABLED=false - - POST_COMMENTS_SORT=top - - CACHE_CONTROL=true - - CACHE_MAX_SIZE=10000 - REDIS_HOST=teddit-redis ports: - "8080:8080" From db63adcb7d16c2dda509c2c23fc245945ec14541 Mon Sep 17 00:00:00 2001 From: TheFrenchGhosty Date: Thu, 4 Nov 2021 16:13:57 +0100 Subject: [PATCH 3/4] Add a comment to the development compose --- docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 71d78ea..93abedf 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,3 +1,5 @@ +# This docker-compose file is made for development purpose and build from source, if you want to use teddit in production, the README contains a production-ready docker-compose setup. + version: "3.8" services: From adf82586709104396613162f38a2cb925643639b Mon Sep 17 00:00:00 2001 From: TheFrenchGhosty Date: Thu, 4 Nov 2021 16:17:54 +0100 Subject: [PATCH 4/4] Add a note for a production-ready teddit not behind a reverse proxy --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 5c30e43..85c9faf 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,11 @@ networks: teddit_net: ``` +Note: This compose is made for a true "production" setup, and is made to be used to have teddit behind a reverse proxy, if you don't want that and prefer to directly access teddit via its port: + +- Change `ports: - "127.0.0.1:8080:8080"` to `ports: - "8080:8080"` +- Remove `DOMAIN=teddit.net`, `USE_HELMET=true`, `USE_HELMET_HSTS=true`, `TRUST_PROXY=true` + ### Docker-compose method (development)