frappe / frappe_docker

Docker images for production and development setups of the Frappe framework and ERPNext
MIT License
1.48k stars 1.38k forks source link

Can't deploy using docker swarm. ERROR: The Compose file './compose.yaml' is invalid because: #709

Closed RashiqAzhan closed 2 years ago

RashiqAzhan commented 2 years ago

Description of the issue

Can't deploy using docker-swarm using the guide.

Context information (for bug reports)

OS: Almalinux 8 (CentOS 8 alternative) Docker version 20.10.13, build a224086 docker-compose version 1.27.4, build 40524192 yq (https://github.com/mikefarah/yq/) version 4.22.1

Steps to reproduce the issue

  1. Clone project and cd to the directory.
    git clone https://github.com/frappe/frappe_docker
    cd frappe_docker
  2. Copy example.env to .env.
    cp example.env .env
  3. Follow the swarm guide.
    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

Observed result

The Docker swarm doesn't start.

Expected result

The swarm should just start.

Stacktrace / full error message if available

no such file or directory: /home/user/gitops/compose.yaml
ERROR: The Compose file './compose.yaml' is invalid because:
services.backend.depends_on.configurator.condition contains "service_completed_successfully", which is an invalid type, it should be a service_started, or a service_healthy
services.queue-default.depends_on.configurator.condition contains "service_completed_successfully", which is an invalid type, it should be a service_started, or a service_healthy
services.queue-long.depends_on.configurator.condition contains "service_completed_successfully", which is an invalid type, it should be a service_started, or a service_healthy
services.queue-short.depends_on.configurator.condition contains "service_completed_successfully", which is an invalid type, it should be a service_started, or a service_healthy
services.scheduler.depends_on.configurator.condition contains "service_completed_successfully", which is an invalid type, it should be a service_started, or a service_healthy
services.websocket.depends_on.configurator.condition contains "service_completed_successfully", which is an invalid type, it should be a service_started, or a service_healthy
revant commented 2 years ago

which yq are you using?

I'm using the one written in golang https://github.com/mikefarah/yq

RashiqAzhan commented 2 years ago

which yq are you using?

I'm using the one written in golang https://github.com/mikefarah/yq

That's the one I'm using.

revant commented 2 years ago

can you share the output generated? the gitops/compose.yaml

RashiqAzhan commented 2 years ago

I would but there isn't any, if it exists, I can't find it. There isn't any gitops folder in my home folder or inside the cloned project.

revant commented 2 years ago

you need to generate the config and then use it to run the project.

RashiqAzhan commented 2 years ago

I ran the command again but I manually created the gitops folder in my home folder and this is what is inside the compose.yaml.

{services: {proxy: {command: --providers.docker.swarmmode}}}
revant commented 2 years ago

clearly the compose is invalid. it needs to have more than 7 services.

try docker compose V2?

RashiqAzhan commented 2 years ago

The output file came through. I had to use docker compose instead of docker-compose. But cd-ing into the gitops folder and running docker stack deploy -c compose.yaml erpnext by inserting version: 3 the compose.yaml file produces

services.websocket.volumes.0 must be a string

Without the version: 3 it says

unsupported Compose file version: 1.0

Is the docker swarm docs incomplete somehow or am I missing something?

revant commented 2 years ago

I'll try to setup and improve docs. I've not run through swarm docs in live environment anywhere.

RashiqAzhan commented 2 years ago

I'll try to setup and improve docs. I've not run through swarm docs in live environment anywhere.

Would really appreciate the update. ERPNext works fine on local machines but getting it deployed on a VPS has been quite a challenge.

revant commented 2 years ago

move discussion to #717