2024-12-23 15:39:16 +00:00
|
|
|
### CRIMSON --- A simple PHP framework.
|
|
|
|
### Copyright © 2024 Freya Murphy <contact@freyacat.org>
|
|
|
|
###
|
|
|
|
### This file is part of CRIMSON.
|
|
|
|
###
|
|
|
|
### CRIMSON is free software; you can redistribute it and/or modify it
|
|
|
|
### under the terms of the GNU General Public License as published by
|
|
|
|
### the Free Software Foundation; either version 3 of the License, or (at
|
|
|
|
### your option) any later version.
|
|
|
|
###
|
|
|
|
### CRIMSON is distributed in the hope that it will be useful, but
|
|
|
|
### WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
### GNU General Public License for more details.
|
|
|
|
###
|
|
|
|
### You should have received a copy of the GNU General Public License
|
|
|
|
### along with CRIMSON. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
services:
|
|
|
|
# `docker-compose-db.yml`
|
|
|
|
# This compose file creates the `postgres`, and `db-init` containers.
|
|
|
|
# Crimson uses prostgres for its database and uses db-init to initalize the
|
|
|
|
# baseline required for all crimson components.
|
|
|
|
#
|
|
|
|
# This service stack is only enabled when API_ENABLED=true.
|
|
|
|
|
|
|
|
postgres:
|
2024-12-24 03:14:44 +00:00
|
|
|
build: ${CRIMSON_ROOT}/build/postgres
|
2024-12-23 15:39:16 +00:00
|
|
|
restart: unless-stopped
|
2024-12-24 03:14:44 +00:00
|
|
|
env_file: DOCKER_ENV_FILES
|
2024-12-23 15:39:16 +00:00
|
|
|
environment:
|
|
|
|
- POSTGRES_INITDB_ARGS=--encoding=UTF-8 --lc-collate=C --lc-ctype=C
|
|
|
|
volumes:
|
2024-12-24 03:14:44 +00:00
|
|
|
- ${PROJECT_DATA}/schemas:/var/lib/postgresql/data
|
|
|
|
- ${PROJECT_SOURCE}/db:/db:ro
|
2024-12-23 15:39:16 +00:00
|
|
|
healthcheck:
|
|
|
|
test: pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}
|
|
|
|
interval: 1s
|
|
|
|
timeout: 3s
|
|
|
|
retries: 10
|
|
|
|
start_period: 3s
|
|
|
|
|
|
|
|
db-init:
|
|
|
|
# => Guarantees the required crimson baseline in the database.
|
|
|
|
# i.e. sys schema used for storing migration meta data and other small
|
|
|
|
# things.
|
|
|
|
# => Runs all database migrations for you. All that is needed
|
|
|
|
# is that the migration file convention is followed.
|
|
|
|
# => If the API is enabled, also loads in the api schema for postgrest.
|
|
|
|
#
|
|
|
|
# Once db-init finishes, it will create a `db-ready` file in
|
|
|
|
# /var/run/crimson to tell crimson's php code its to further route requests.
|
|
|
|
#
|
|
|
|
# For information on databse conventions and layouts, see
|
|
|
|
# `build/db-init/README.md`.
|
2024-12-24 03:14:44 +00:00
|
|
|
build: ${CRIMSON_ROOT}/build/db-init
|
2024-12-23 15:39:16 +00:00
|
|
|
restart: no
|
2024-12-24 03:14:44 +00:00
|
|
|
env_file: DOCKER_ENV_FILES
|
2024-12-23 15:39:16 +00:00
|
|
|
volumes:
|
2024-12-24 03:14:44 +00:00
|
|
|
- ${PROJECT_SOURCE}/db:/db:ro
|
|
|
|
- ${PROJECT_DATA}/crimson:/var/run/crimson
|
2024-12-23 15:39:16 +00:00
|
|
|
depends_on:
|
|
|
|
postgres:
|
|
|
|
condition: service_healthy
|
|
|
|
|
|
|
|
php:
|
|
|
|
# Crimson supports calling the postgres database inside php though the
|
|
|
|
# database library. Thus is in added dependency. Crimson does not need to
|
|
|
|
# depend on db-init since db-init has a ready file that crimons uses
|
|
|
|
# instead.
|
|
|
|
depends_on:
|
|
|
|
postgres:
|
|
|
|
condition: service_healthy
|