mirror of
https://github.com/frappe/frappe_docker.git
synced 2025-01-09 00:21:21 +00:00
2.4 KiB
2.4 KiB
Prerequisites
Generate setup for docker swarm
Generate the swarm compatible YAML,
docker-compose -f compose.yaml \
-f overrides/compose.erpnext.yaml \
-f overrides/compose.swarm.yaml \
-f overrides/compose.https.yaml \
config \
| yq eval 'del(.services.*.depends_on) | del(.services.frontend.labels)' - \
| yq eval '.services.proxy.command += "--providers.docker.swarmmode"' - > \
~/gitops/compose.yaml
In case you need to generate config for multiple benches. Install the proxy separately only once and generate stacks for each bench as follows:
# Setup Bench $BENCH_SUFFIX
export BENCH_SUFFIX=one
docker-compose -f compose.yaml \
-f overrides/compose.erpnext.yaml \
-f overrides/compose.swarm.yaml \
config \
| yq eval 'del(.services.*.depends_on) | del(.services.frontend.labels)' - \
| sed "s|frontend|frontend-${BENCH_SUFFIX}|g" \
| yq eval ".services.frontend-${BENCH_SUFFIX}.\"networks\"=[\"traefik-public\",\"default\"]" - \
| yq eval ".\"networks\"={\"traefik-public\":{\"external\":true}}" - > \
~/gitops/compose-${BENCH_SUFFIX}.yaml
Commands explained:
docker-compose -f ... -f ... config
, this command generates the YAML based on the overridesyq eval 'del(.services.*.depends_on) | del(.services.frontend.labels)'
, this command removes thedepends_on
from all services andlabels
from frontend generated from previous command.yq eval '.services.proxy.command += "--providers.docker.swarmmode"'
, this command enables swarmmode for traefik proxy.sed "s|frontend|frontend-${BENCH_SUFFIX}|g"
, this command replaces the service namefrontend
withfrontend-
andBENCH_SUFFIX
provided.yq eval ".services.frontend-${BENCH_SUFFIX}.\"networks\"=[\"traefik-public\",\"default\"]"
, this command attachestraefik-public
anddefault
network to frontend service.yq eval ".\"networks\"={\"traefik-public\":{\"external\":true}}"
, this commands adds external networktraefik-public
to the stack
Notes:
- Set
BENCH_SUFFIX
to the stack name. the stack will be located at~/gitops/compose-${BENCH_SUFFIX}.yaml
. traefik-public
is assumed to be the network for traefik loadbalancer for swarm.- Once the stack YAML is generated, you can edit it further for advance setup and commit it to your gitops