Skip to content

Commit

Permalink
Test docker secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
abelfodil committed Jan 21, 2021
1 parent 36b8864 commit 84ef4fa
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
- "sqlite"
- "mariadb"
- "postgresql"
- "postgresql-secret"

steps:
- name: "Checkout"
Expand Down
1 change: 1 addition & 0 deletions tests/credentials/db_password
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
wallapass
1 change: 1 addition & 0 deletions tests/credentials/env_secret
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
F00B4R
1 change: 1 addition & 0 deletions tests/credentials/postgres_password
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
my-secret-pw
31 changes: 31 additions & 0 deletions tests/docker-compose.postgresql-secret.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version: '2'
services:
wallabag:
build:
context: ../
image: wallabag:postgresql
container_name: wallabag
environment:
- POSTGRES_PASSWORD__FILE=/run/secrets/postgres_password
- POSTGRES_USER=my-super-user
- SYMFONY__ENV__SECRET__FILE=/run/secrets/env_secret
- SYMFONY__ENV__DATABASE_DRIVER=pdo_pgsql
- SYMFONY__ENV__DATABASE_HOST=db
- SYMFONY__ENV__DATABASE_PORT=5432
- SYMFONY__ENV__DATABASE_NAME=wallabag
- SYMFONY__ENV__DATABASE_USER=wallabag
- SYMFONY__ENV__DATABASE_PASSWORD__FILE=/run/secrets/db_password
ports:
- "127.0.0.1:80:80"
# Docker Secrets require Swarm Mode, so we use volumes instead to spoof the behaviour
volumes:
- ./tests/credentials/db_password:/run/secrets/db_password
- ./tests/credentials/postgres_password:/run/secrets/postgres_password
- ./tests/credentials/env_secret:/run/secrets/env_secret
db:
image: postgres:10.3
environment:
- POSTGRES_PASSWORD_FILE=/run/secrets/postgres_password
- POSTGRES_USER=my-super-user
volumes:
- ./tests/credentials/postgres_password:/run/secrets/postgres_password

0 comments on commit 84ef4fa

Please sign in to comment.