Skip to content
This repository was archived by the owner on Oct 7, 2024. It is now read-only.

Conversation

@opichon
Copy link

@opichon opichon commented May 9, 2021

Allow database password to be defined in a file via the DATABASE_PASSWORD_FILE environment variable.
This adds support for Docker secrets in a Docker swarm.

Typical use would be as follows (this assumes the 1database-password` secret has been created outside of the strapi stack):

#docker-compsoe.yml
version: "3"

secrets:
  database-password:
    external: true

services:
  strapi:
    container_name: strapi
    image: strapi/strapi
    environment:
      - NODE_ENV=production
      - DATABASE_CLIENT=postgres
      - DATABASE_HOST=db
      - DATABASE_PORT=5432
      - DATABASE_NAME=strapi
      - DATABASE_USERNAME=strapi
      - DATABASE_PASSWORD_FILE=/run/secrets/database-password
    ports:
      - 1337:1337
    volumes:
      - ./app:/srv/app
    secrets:
      - database-password
    depends_on:
      - db
    command: 'strapi start'

@strapi-cla
Copy link

strapi-cla commented May 9, 2021

CLA assistant check
All committers have signed the CLA.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants