Use Docker secrets (#340)

This commit is contained in:
Thomas Miceli 2024-09-28 01:31:18 +02:00 committed by GitHub
parent 56b4fd45fd
commit 41dc2e451b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 30 additions and 10 deletions

View file

@ -47,8 +47,6 @@ It can be used in a `docker-compose.yml` file :
3. Opengist is now running on port 6157, you can browse http://localhost:6157 3. Opengist is now running on port 6157, you can browse http://localhost:6157
```yml ```yml
version: "3"
services: services:
opengist: opengist:
image: ghcr.io/thomiceli/opengist:1.7 image: ghcr.io/thomiceli/opengist:1.7

View file

@ -9,4 +9,10 @@ usermod -o -u "$UID" $USER
chown -R "$USER:$USER" /opengist chown -R "$USER:$USER" /opengist
chown -R "$USER:$USER" /config.yml chown -R "$USER:$USER" /config.yml
if [ -f "/run/secrets/opengist_secrets" ]; then
set -a
. /run/secrets/opengist_secrets
set +a
fi
exec su $USER -c "OG_OPENGIST_HOME=/opengist /app/opengist/opengist --config /config.yml" exec su $USER -c "OG_OPENGIST_HOME=/opengist /app/opengist/opengist --config /config.yml"

View file

@ -46,3 +46,27 @@ Usage via command line :
```shell ```shell
OG_LOG_LEVEL=info ./opengist OG_LOG_LEVEL=info ./opengist
``` ```
### Using Docker Compose secrets
You can use Docker Compose secrets to not expose sensitive information in your compose file, using a `.env` file.
```dotenv
# file secrets.env
OG_GITLAB_CLIENT_KEY=your_gitlab_client_key
OG_GITLAB_SECRET=your_gitlab_secret_key
```
And then use it in your compose file :
```yml
services:
opengist:
# ...
secrets:
- opengist_secrets
secrets:
opengist_secrets:
file: ./secrets.env
```

View file

@ -18,8 +18,6 @@ OG_DB_URI=mysql://root:passwd@localhost:3306/opengist_db
### Docker Compose ### Docker Compose
```yml ```yml
version: "3"
services: services:
opengist: opengist:
image: ghcr.io/thomiceli/opengist:1 image: ghcr.io/thomiceli/opengist:1

View file

@ -18,8 +18,6 @@ OG_DB_URI=postgres://postgres:passwd@localhost:5432/opengist_db
### Docker Compose ### Docker Compose
```yml ```yml
version: "3"
services: services:
opengist: opengist:
image: ghcr.io/thomiceli/opengist:1 image: ghcr.io/thomiceli/opengist:1

View file

@ -21,8 +21,6 @@ OG_SQLITE_JOURNAL_MODE=WAL
### Docker Compose ### Docker Compose
```yml ```yml
version: "3"
services: services:
opengist: opengist:
image: ghcr.io/thomiceli/opengist:1 image: ghcr.io/thomiceli/opengist:1

View file

@ -13,8 +13,6 @@ It can be used in a `docker-compose.yml` file :
3. Opengist is now running on port 6157, you can browse http://localhost:6157 3. Opengist is now running on port 6157, you can browse http://localhost:6157
```yml ```yml
version: "3"
services: services:
opengist: opengist:
image: ghcr.io/thomiceli/opengist:1 image: ghcr.io/thomiceli/opengist:1