From d97d81388298aec61ffe4cd09433e4edcbafc340 Mon Sep 17 00:00:00 2001 From: Nig3l Date: Sun, 6 Aug 2023 02:07:07 +0200 Subject: [PATCH 1/7] Update Docker Doc --- README.md | 3 ++- docs/{docker.md => Docker.md} | 13 +++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) rename docs/{docker.md => Docker.md} (91%) diff --git a/README.md b/README.md index b88fe3327..41a3807eb 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ [![CircleCI](https://circleci.com/gh/stringer-rss/stringer/tree/main.svg?style=svg)](https://circleci.com/gh/stringer-rss/stringer/tree/main) [![Code Climate](https://api.codeclimate.com/v1/badges/899c5407c870e541af4e/maintainability)](https://codeclimate.com/github/stringer-rss/stringer/maintainability) [![Coverage Status](https://coveralls.io/repos/github/stringer-rss/stringer/badge.svg?branch=main)](https://coveralls.io/github/stringer-rss/stringer?branch=main) +![Docker Pulls](https://img.shields.io/docker/pulls/mockdeep/stringer?label=Docker%20Pulls) [![GitHub Sponsors](https://img.shields.io/github/sponsors/mockdeep?logo=github)](https://github.com/sponsors/mockdeep) ### A self-hosted, anti-social RSS reader. @@ -24,7 +25,7 @@ Stringer is a Ruby app based on Rails, PostgreSQL, Backbone.js and GoodJob. Stringer will run just fine on the Eco/Basic Heroku plans. Instructions are provided for deploying to [Heroku manually](/docs/Heroku.md), to any Ruby -compatible [Linux-based VPS](/docs/VPS.md), to [Docker](docs/docker.md) and to [OpenShift](/docs/OpenShift.md). +compatible [Linux-based VPS](/docs/VPS.md), to [Docker](docs/Docker.md) and to [OpenShift](/docs/OpenShift.md). ## Niceties diff --git a/docs/docker.md b/docs/Docker.md similarity index 91% rename from docs/docker.md rename to docs/Docker.md index 105da3ebf..86ba99812 100644 --- a/docs/docker.md +++ b/docs/Docker.md @@ -2,7 +2,7 @@ ## Production ready setup using docker-compose -Download [docker-compose.yml](../docker-compose.yml) and in the corresponding folder, run `docker-compose up -d`, give it a second and visit `localhost` +Download [docker-compose.yml](../docker-compose.yml) and in the corresponding folder, run `docker-compose up -d`, give it a second and visit `localhost:8080` ## Production ready manual setup @@ -20,11 +20,12 @@ The following steps can be used to setup Stringer on Docker, using a Postgres da docker run --detach \ --name stringer-postgres \ --restart always \ - --volume /srv/stringer/data:/var/lib/postgresql/data \ + --volume ./postgres:/var/lib/postgresql/data \ --net stringer \ - -e POSTGRES_PASSWORD=myPassword \ + -e POSTGRES_PASSWORD= \ + -e POSTGRES_USER=db_user \ -e POSTGRES_DB=stringer \ - postgres:9.5-alpine + postgres:12-alpine ``` 3. Run the Stringer Docker image: @@ -35,7 +36,7 @@ docker run --detach \ --net stringer \ --restart always \ -e PORT=8080 \ - -e DATABASE_URL=postgres://postgres:myPassword@stringer-postgres/stringer \ + -e DATABASE_URL=postgres://db_user:@stringer-postgres/stringer \ -e SECRET_KEY_BASE=$(openssl rand -hex 64) \ -e ENCRYPTION_PRIMARY_KEY=$(openssl rand -hex 64) \ -e ENCRYPTION_DETERMINISTIC_KEY=$(openssl rand -hex 64) \ @@ -43,7 +44,7 @@ docker run --detach \ -e FETCH_FEEDS_CRON="*/5 * * * *" \ # optional -e CLEANUP_CRON="0 0 * * *" \ # optional -p 127.0.0.1:8080:8080 \ - stringer-rss/stringer + mockdeep/stringer:latest ``` That's it! You now have a fully working Stringer instance up and running! From 5f509707e7cff8c70afe0b2327499ef4dc5164db Mon Sep 17 00:00:00 2001 From: Nig3l Date: Sun, 6 Aug 2023 02:07:50 +0200 Subject: [PATCH 2/7] Docker: Update docker-compose --- docker-compose.yml | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index e378d7fc0..912a10983 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,27 +1,40 @@ -version: '2' +version: '3.8' + services: postgres: - image: postgres:9.5-alpine + image: postgres:12-alpine + hostname: stringer-postgres restart: always + networks: + - stringer volumes: - - ~/stringer:/var/lib/postgresql/data + - ./postgres:/var/lib/postgresql/data environment: - - POSTGRES_PASSWORD=super_secret_password + - POSTGRES_PASSWORD= - POSTGRES_USER=db_user - POSTGRES_DB=stringer web: - image: mockdeep/stringer + image: mockdeep/stringer:latest build: . depends_on: - postgres restart: always ports: - - 80:8080 + - '127.0.0.1:8080:8080' + networks: + - stringer-network environment: - - SECRET_KEY_BASE= - - ENCRYPTION_PRIMARY_KEY - - ENCRYPTION_DETERMINISTIC_KEY= - - ENCRYPTION_KEY_DERIVATION_SALT= + - SECRET_KEY_BASE=$(openssl rand -hex 64) + - ENCRYPTION_PRIMARY_KEY=$(openssl rand -hex 64) + - ENCRYPTION_DETERMINISTIC_KEY=$(openssl rand -hex 64) + - ENCRYPTION_KEY_DERIVATION_SALT=$(openssl rand -hex 64) + - FETCH_FEEDS_CRON="*/5 * * * *" # optional + - CLEANUP_CRON="0 0 * * *" # optional - PORT=8080 - - DATABASE_URL=postgres://db_user:super_secret_password@postgres:5432/stringer + - DATABASE_URL=postgres://db_user:@stringer-postgres:5432/stringer + +networks: + stringer: + external: false + name: stringer \ No newline at end of file From 3b6c6916763005482cf9cd0af2fcc8df024d192d Mon Sep 17 00:00:00 2001 From: Nig3l Date: Sat, 12 Aug 2023 18:21:01 +0200 Subject: [PATCH 3/7] Sync docker-compose and doc value --- docker-compose.yml | 4 ++-- docs/Docker.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 912a10983..640d99bf2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,7 +8,7 @@ services: networks: - stringer volumes: - - ./postgres:/var/lib/postgresql/data + - ~/stringer/postgres:/var/lib/postgresql/data environment: - POSTGRES_PASSWORD= - POSTGRES_USER=db_user @@ -21,7 +21,7 @@ services: - postgres restart: always ports: - - '127.0.0.1:8080:8080' + - '8080:8080' networks: - stringer-network environment: diff --git a/docs/Docker.md b/docs/Docker.md index 86ba99812..f948e0feb 100644 --- a/docs/Docker.md +++ b/docs/Docker.md @@ -20,7 +20,7 @@ The following steps can be used to setup Stringer on Docker, using a Postgres da docker run --detach \ --name stringer-postgres \ --restart always \ - --volume ./postgres:/var/lib/postgresql/data \ + --volume ~/stringer:/var/lib/postgresql/data \ --net stringer \ -e POSTGRES_PASSWORD= \ -e POSTGRES_USER=db_user \ @@ -43,7 +43,7 @@ docker run --detach \ -e ENCRYPTION_KEY_DERIVATION_SALT=$(openssl rand -hex 64) \ -e FETCH_FEEDS_CRON="*/5 * * * *" \ # optional -e CLEANUP_CRON="0 0 * * *" \ # optional - -p 127.0.0.1:8080:8080 \ + -p 8080:8080 \ mockdeep/stringer:latest ``` From 6ddd886f47884b73d32a53cba6e6f85731a14f90 Mon Sep 17 00:00:00 2001 From: Nig3l Date: Sat, 12 Aug 2023 18:22:04 +0200 Subject: [PATCH 4/7] Comment Optionna Env Var --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 640d99bf2..fbc607332 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -29,8 +29,8 @@ services: - ENCRYPTION_PRIMARY_KEY=$(openssl rand -hex 64) - ENCRYPTION_DETERMINISTIC_KEY=$(openssl rand -hex 64) - ENCRYPTION_KEY_DERIVATION_SALT=$(openssl rand -hex 64) - - FETCH_FEEDS_CRON="*/5 * * * *" # optional - - CLEANUP_CRON="0 0 * * *" # optional + # - FETCH_FEEDS_CRON="*/5 * * * *" # optional + # - CLEANUP_CRON="0 0 * * *" # optional - PORT=8080 - DATABASE_URL=postgres://db_user:@stringer-postgres:5432/stringer From d60126299d8c994527e75cafd3c60c7a202136d9 Mon Sep 17 00:00:00 2001 From: Nig3l Date: Sat, 12 Aug 2023 18:23:03 +0200 Subject: [PATCH 5/7] Prevent Unknown PG Encryption Key --- docker-compose.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index fbc607332..bb4edf248 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -25,10 +25,10 @@ services: networks: - stringer-network environment: - - SECRET_KEY_BASE=$(openssl rand -hex 64) - - ENCRYPTION_PRIMARY_KEY=$(openssl rand -hex 64) - - ENCRYPTION_DETERMINISTIC_KEY=$(openssl rand -hex 64) - - ENCRYPTION_KEY_DERIVATION_SALT=$(openssl rand -hex 64) + - SECRET_KEY_BASE= + - ENCRYPTION_PRIMARY_KEY + - ENCRYPTION_DETERMINISTIC_KEY= + - ENCRYPTION_KEY_DERIVATION_SALT= # - FETCH_FEEDS_CRON="*/5 * * * *" # optional # - CLEANUP_CRON="0 0 * * *" # optional - PORT=8080 From 1709b02d23ea17b8563c460fb642129928a42c8d Mon Sep 17 00:00:00 2001 From: Nig3l Date: Sat, 12 Aug 2023 18:23:42 +0200 Subject: [PATCH 6/7] Update PG version from 12 to 15 --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index bb4edf248..e78f8559f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ version: '3.8' services: postgres: - image: postgres:12-alpine + image: postgres:15-alpine hostname: stringer-postgres restart: always networks: From dc1aade6eb23fc5d92ac0fe27d98e1f28c1344d9 Mon Sep 17 00:00:00 2001 From: Nig3l Date: Sat, 12 Aug 2023 18:24:01 +0200 Subject: [PATCH 7/7] Reformat MD --- docs/Docker.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/Docker.md b/docs/Docker.md index f948e0feb..5ee94ac9a 100644 --- a/docs/Docker.md +++ b/docs/Docker.md @@ -10,9 +10,9 @@ The following steps can be used to setup Stringer on Docker, using a Postgres da 1. Setup a Docker network so the two containers we're going to create can communicate: - ```Sh - docker network create --driver bridge stringer - ``` +```Sh +docker network create --driver bridge stringer +``` 2. Setup a Postgres Docker container: