Ocelot-Social/docker-compose.yml
Robert Schäfer 628b57aa29
feat(other): major improvement of deployment (#7925)
* feat(other): major improvement of deployment

Motivation
----------

Kubernetes:
* backend becomes a statefulset (exclusive volume mount)
  See: https://spacelift.io/blog/statefulset-vs-deployment
* implement neo4j backup with job

Docker:
* consistent targets across all dockerfiles
* remove redundant labels
* remove unnecessary build args
* remove obsolete networks
* remove development dependencies for production

Rebranding:
* add image tags for local tagging and pulling
* use Github's docker build workflows
* use Github container registry
* ONBUILD to simplify caller Dockerfiles
* docker compose for branding

Tooling:
* same node --version as in dockerfile

Docs:
* missing step in README.md

* refactor: remove submodules

It's better to keep them all in a separate repository

* improve kubernetes chart

* better image tag defaults
* split neo4j into its own chart (for re-use)
* use application defaults where possible

* optional resources for all pods

* remove obsolete key/value pair from secrets

* remove obsolete build argsand

and add labels for neo4j enterprise

* env vars for webapp

* allow to define redirect domains

Define a list of Domains that redirect to the domain of the project. The
idea is to provide the ability to redirect eg. www.domain.tld to
domain.tld

* remove maintenance part regarding database

* move backup job outside template folder

* name the ingress

* updated ingress

* handle empty case of middlewares

* try to default the ingress

* use quote

* restore todo-next-update

* fix docu check

* fix naming

* try using prod:migrate

* try using override config

* copy src folder

* try using base as image instead of build

* fix test build

* force build

* comment for the problem

* fix webapp tests (potentially)

---------

Co-authored-by: Ulf Gebhardt <ulf.gebhardt@webcraft-media.de>
2025-02-28 18:22:23 +01:00

111 lines
3.4 KiB
YAML

# This file defines the production settings. It is overwritten by docker-compose.override.yml,
# which defines the development settings. The override.yml is loaded by default. Therefore it
# is required to explicitly define if you want an production build:
# > docker-compose -f docker-compose.yml up
services:
webapp:
image: ghcr.io/ocelot-social-community/ocelot-social/webapp:${OCELOT_VERSION:-latest}
build:
context: ./webapp
target: production
depends_on:
- backend
ports:
- 3000:3000
# Storybook: Todo externalize, its not working anyways
# - 3002:3002
environment:
# Envs used in Dockerfile
# - DOCKER_WORKDIR="/app"
# - PORT="3000"
- NODE_ENV="production"
# Application only envs
- HOST=0.0.0.0 # This is nuxt specific, alternative value is HOST=webapp
- GRAPHQL_URI=http://backend:4000
env_file:
- ./webapp/.env
frontend:
image: ghcr.io/ocelot-social-community/ocelot-social/frontend:${OCELOT_VERSION:-latest}
build:
context: ./frontend
target: production
depends_on:
- backend
ports:
- 3002:3002
environment:
# Envs used in Dockerfile
# - DOCKER_WORKDIR="/app"
# - PORT="3002"
- NODE_ENV="production"
# Application only envs
#- HOST=0.0.0.0 # This is nuxt specific, alternative value is HOST=webapp
#- GRAPHQL_URI=http://backend:4000
env_file:
- ./frontend/.env
backend:
image: ghcr.io/ocelot-social-community/ocelot-social/backend:${OCELOT_VERSION:-latest}
build:
context: ./backend
target: production
depends_on:
- neo4j
ports:
- 4000:4000
volumes:
- backend_uploads:/app/public/uploads
environment:
# Envs used in Dockerfile
# - DOCKER_WORKDIR="/app"
# - PORT="4000"
- NODE_ENV="production"
# Application only envs
- DEBUG=false
- NEO4J_URI=bolt://neo4j:7687
- GRAPHQL_URI=http://backend:4000
- CLIENT_URI=http://webapp:3000
env_file:
- ./backend/.env
maintenance:
image: ghcr.io/ocelot-social-community/ocelot-social/maintenance:${OCELOT_VERSION:-latest}
build:
context: ./webapp
dockerfile: Dockerfile.maintenance
ports:
- 3001:80
neo4j:
image: ghcr.io/ocelot-social-community/ocelot-social/neo4j
build:
context: ./neo4j
# community edition 👆🏼, because we have no enterprise licence 👇🏼 at the moment
target: community
ports:
- 7687:7687
volumes:
- neo4j_data:/data
environment:
# settings reference: https://neo4j.com/docs/operations-manual/4.4/docker/ref-settings/
# TODO: This sounds scary for a production environment
- NEO4J_AUTH=none
- NEO4J_dbms_security_procedures_unrestricted=algo.*,apoc.*
- NEO4J_dbms_allow__format__migration=true
- NEO4J_dbms_allow__upgrade=true
# uncomment following line for Neo4j Enterprise version instead of Community version
# TODO: clarify if that is the only thing needed to unlock the Enterprise version
# - NEO4J_ACCEPT_LICENSE_AGREEMENT=yes
# set the name of the database to be used
# - NEO4J_dbms_default__database=graph.db
# - NEO4J_dbms_default__database=neo4j
# TODO: Remove the playground from production
# bring the database in offline mode to export or load dumps
# command: ["tail", "-f", "/dev/null"]
volumes:
backend_uploads:
neo4j_data: