From de9cae795f93d03e68d965c59af4b21d96df4ec7 Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Mon, 23 Dec 2024 10:39:16 -0500 Subject: initial --- docker/docker-compose.api.yml | 60 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 docker/docker-compose.api.yml (limited to 'docker/docker-compose.api.yml') diff --git a/docker/docker-compose.api.yml b/docker/docker-compose.api.yml new file mode 100644 index 0000000..5c7f6d8 --- /dev/null +++ b/docker/docker-compose.api.yml @@ -0,0 +1,60 @@ +### CRIMSON --- A simple PHP framework. +### Copyright © 2024 Freya Murphy +### +### 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 . + +services: + # `docker-compose-api.yml` + # This compose file creates the `rest` container running postgrest. This is + # the program that crimson uses for the default API functionality. + # + # This service stack is only enabled when API_ENABLED=true. + # + # WARNING: The postgres container must also be enabled `POSTGRES_ENABLED=true` + # otherwise the docker stack will be invalid. + + rest: + # Postgrest uses postgres to store the api schema. To work properly, the + # database must be working (healthy) and all the api schema must be loaded. + # It is db-init's job to load the api schema, thus this container depends + # on both postgres and db-init. + build: ../build/postgrest + restart: unless-stopped + environment: + - API_SECRET + - API_ROLE + - API_SCHEMA + - POSTGRES_DB + - POSTGRES_USER + - POSTGRES_PASSWORD + healthcheck: + test: curl -I "http://localhost:3000/" + interval: 10s + timeout: 3s + retries: 10 + start_period: 3s + depends_on: + postgres: + condition: service_healthy + db-init: + condition: service_completed_successfully + + web: + # Nginx proxies requests to the API making it an added dependency. + depends_on: + rest: + condition: service_healthy + -- cgit v1.2.3-freya