nextcloud-swarm-plugin/docker-compose.yml
Mahyar Iranibazaz 1f43f64615
feature/884-hejbit-api (#95)
* feat(docker): enable multi NC versions setup
- add: auto install plugin
- add: hooks integration folders
- add: fpm installation
- add: redis for session caching
- add: selfsign ssl for local development

* feat(xdebug):
- fix: xdebug setup
- add: two targets for Dockerfile
- add: debug mode in NC
- fix: domain hook in NC config
- update: docker networks

* refactor(docker): compose file extension
- update: yaml to yml

* refactor(docker-compose):
- remove: extra environments from compose
- update: .env file

* feat(redis):
- add: redis server password
- update: .env file
- refactor: remove all passwords from .env

* feat(cli): install and clean dev env setup
- add: add script for linux/mac
- add: bat for windows

* feat(volumes): use specific volumes only
- refactor: rename volumes
- update: bind only nc volumes needed
- fix: redis password
- fix: extra env passed to all db containers

* feat(docker):
- add: caddy as proxy server
- add: rsync for dev env
- add: adminer default db server
- update: nextcloud labels

* feat(exceptions):
- add: SwarmException for Swarm related errors

* feat(Util): add Env
- add: util to access ENV vars

* feat(Util): update Curl
- add: ssl check to curl options
- update: default options calculation
- add: response success check

* feat(swarm): adapt to new API
- update: all Exceptions
- update: endpoints
- add: success checks and proper errors
- update: upload method and response
- update: remove header from download requests

* refactor(storage):
- update: code docs and style
- refactor: some if statements
- add: missing parent calls
- refactor: variable naming convention
- update: upload call with new api
- update: exceptions
- add: some todos for later refactoring
- update: imports

* chore(npm): update lock file

* refactor(docker):
- update: docker networks
- remove: proxy dockerfile

* feat(docker):
- add: db health checks
- update: redis password env var

* feat(docker):
- add: dev profile
- refactor: proxy network name

* feat(api):
- update: swarm connections
- update: swarm storage
- update: Curl requests
- docs: clean code

* chore(docker):
- remove: extra dockerfiles

* chore(docker):
- remove: old hooks
2024-12-18 19:48:59 +08:00

190 lines
4.4 KiB
YAML
Executable file

services:
web:
build: ./docker/web
restart: unless-stopped
volumes_from:
- nextcloud
depends_on:
- nextcloud
labels:
caddy: ${APP_URL:-localhost}, nextcloud.local
caddy.reverse_proxy: '{{upstreams 80}}'
networks:
- frontend
- proxy
nextcloud:
build:
context: ./docker/nextcloud
dockerfile: Dockerfile
args:
NC_VERSION: ${NC_VERSION:-28}
target: ${ENV:-development}
restart: unless-stopped
depends_on:
mariadb:
condition: service_healthy
redis:
condition: service_healthy
env_file:
- .env
environment:
MYSQL_HOST: mariadb:3306
REDIS_HOST: redis
networks:
- frontend
- backend
extra_hosts:
- host.docker.internal:host-gateway
- onlyoffice.local:host-gateway
- hejbit.local:host-gateway
- api.hejbit.local:host-gateway
volumes:
- nc-app:/var/www/html
- ./:/var/www/html/custom_apps/files_external_ethswarm
cron:
image: nextcloud:${NC_VERSION:-28}-fpm-alpine
restart: always
volumes:
- nc-app:/var/www/html:z
entrypoint: /cron.sh
depends_on:
nextcloud:
condition: service_started
mariadb:
condition: service_healthy
redis:
condition: service_healthy
redis:
image: redis:alpine
restart: unless-stopped
environment:
REDIS_HOST_PASSWORD: ${REDIS_HOST_PASSWORD:-secret}
command: redis-server --requirepass ${REDIS_HOST_PASSWORD:-secret}
healthcheck:
test: [ "CMD", "redis-cli", "ping" ]
start_period: 3s
timeout: 5s
interval: 30s
networks:
- backend
mariadb:
image: mariadb:latest
# set transaction isolation: https://docs.nextcloud.com/server/stable/admin_manual/configuration_database/linux_database_configuration.html
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW --innodb-file-per-table=1 --skip-innodb-read-only-compressed
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-rootpassword}
MYSQL_DATABASE: ${MYSQL_DATABASE:-nextcloud}
MYSQL_USER: ${MYSQL_USER:-nextcloud}
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-secret}
volumes:
- nc-db:/var/lib/mysql
healthcheck:
test: [ "CMD", "healthcheck.sh", "--su-mysql", "--connect", "--innodb_initialized" ]
start_period: 3s
timeout: 5s
interval: 30s
networks:
- backend
adminer:
image: adminer:latest
restart: unless-stopped
networks:
- backend
ports:
- '8080:8080'
depends_on:
- mariadb
environment:
ADMINER_DEFAULT_SERVER: mariadb
profiles:
- dev
rsync:
build:
context: ./docker/rsync
dockerfile: Dockerfile
restart: unless-stopped
cpu_shares: 512
mem_limit: 256m
volumes:
- nc-app:/app:ro
- ./dev-environment/nextcloud_source:/source
environment:
- RSYNC_CRONTAB=crontab
depends_on:
- nextcloud
networks:
- backend
profiles:
- dev
onlyoffice:
image: onlyoffice/documentserver
environment:
JWT_ENABLED: true
JWT_SECRET: secret
JWT_HEADER: AuthorizationJwt
JWT_IN_BODY: true
USE_UNAUTHORIZED_STORAGE: true
restart: unless-stopped
volumes:
- onlyoffice_data:/var/www/onlyoffice/Data
- onlyoffice_db:/var/lib/postgresql
- onlyoffice_lib:/var/lib/onlyoffice
- onlyoffice_logs:/var/log/onlyoffice
extra_hosts:
- nextcloud.local:host-gateway
networks:
- backend
- proxy
labels:
caddy: onlyoffice.local
caddy.reverse_proxy: '{{upstreams 80}}'
profiles:
- dev
proxy:
image: lucaslorentz/caddy-docker-proxy:alpine
restart: unless-stopped
ports:
- "80:80"
- "443:443"
- "443:443/udp"
volumes:
- caddy_data:/data
- caddy_config:/config
- /var/run/docker.sock:/var/run/docker.sock
environment:
CADDY_INGRESS_NETWORKS: hejbit-network
networks:
- proxy
healthcheck:
test: [ "CMD", "curl", "--fail", "http://localhost:2019/reverse_proxy/upstreams" ]
timeout: 30s
retries: 3
start_period: 10s
profiles:
- dev
volumes:
nc-app:
nc-db:
caddy_data:
caddy_config:
onlyoffice_data:
onlyoffice_db:
onlyoffice_lib:
onlyoffice_logs:
networks:
frontend:
backend:
proxy:
name: hejbit-network