Yacht icon indicating copy to clipboard operation
Yacht copied to clipboard

[Bug Report] Project page is empty when using depends_on long syntax

Open gus-costa opened this issue 1 year ago • 4 comments

Describe the bug Project page breaks for a project, depends_on long syntax is used in the compose file which I believe is the cause for the issue. I see on the console: TypeError: t.project.services[e].depends_on.join is not a function

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Projects'
  2. Create a new project with following compose file
name: frappe_docker
services:
  backend:
    depends_on:
      configurator:
        condition: service_completed_successfully
    image: frappe/erpnext-worker:v13.35.2
    networks:
      default: null
    volumes:
    - type: volume
      source: sites
      target: /home/frappe/frappe-bench/sites
      volume: {}
    - type: volume
      source: assets
      target: /home/frappe/frappe-bench/sites/assets
      read_only: true
      volume: {}
  configurator:
    command:
    - configure.py
    depends_on:
      db:
        condition: service_healthy
      redis:
        condition: service_started
    environment:
      DB_HOST: db
      DB_PORT: "3306"
      REDIS_CACHE: redis:6379/0
      REDIS_QUEUE: redis:6379/1
      REDIS_SOCKETIO: redis:6379/2
      SOCKETIO_PORT: "9000"
    image: frappe/erpnext-worker:v13.35.2
    networks:
      default: null
    volumes:
    - type: volume
      source: sites
      target: /home/frappe/frappe-bench/sites
      volume: {}
  db:
    command:
    - --character-set-server=utf8mb4
    - --collation-server=utf8mb4_unicode_ci
    - --skip-character-set-client-handshake
    - --skip-innodb-read-only-compressed
    environment:
      MYSQL_ROOT_PASSWORD: "123"
    healthcheck:
      test:
      - CMD-SHELL
      - mysqladmin ping -h localhost --password=123
      interval: 1s
      retries: 15
    image: mariadb:10.6
    networks:
      default: null
    volumes:
    - type: volume
      source: db-data
      target: /var/lib/mysql
      volume: {}
  frontend:
    depends_on:
      backend:
        condition: service_started
      websocket:
        condition: service_started
    environment:
      BACKEND: backend:8000
      FRAPPE_SITE_NAME_HEADER: localhost
      SOCKETIO: websocket:9000
      UPSTREAM_REAL_IP_ADDRESS: 127.0.0.1
      UPSTREAM_REAL_IP_HEADER: X-Forwarded-For
      UPSTREAM_REAL_IP_RECURSIVE: "off"
    image: frappe/erpnext-nginx:v13.35.2
    networks:
      default: null
    ports:
    - mode: ingress
      target: 8080
      published: "8082"
      protocol: tcp
    volumes:
    - type: volume
      source: assets
      target: /usr/share/nginx/html/assets
      volume: {}
    - type: volume
      source: sites
      target: /usr/share/nginx/html/sites
      volume: {}
  queue-default:
    command:
    - bench
    - worker
    - --queue
    - default
    depends_on:
      configurator:
        condition: service_completed_successfully
    image: frappe/erpnext-worker:v13.35.2
    networks:
      default: null
    volumes:
    - type: volume
      source: sites
      target: /home/frappe/frappe-bench/sites
      volume: {}
  queue-long:
    command:
    - bench
    - worker
    - --queue
    - long
    depends_on:
      configurator:
        condition: service_completed_successfully
    image: frappe/erpnext-worker:v13.35.2
    networks:
      default: null
    volumes:
    - type: volume
      source: sites
      target: /home/frappe/frappe-bench/sites
      volume: {}
  queue-short:
    command:
    - bench
    - worker
    - --queue
    - short
    depends_on:
      configurator:
        condition: service_completed_successfully
    image: frappe/erpnext-worker:v13.35.2
    networks:
      default: null
    volumes:
    - type: volume
      source: sites
      target: /home/frappe/frappe-bench/sites
      volume: {}
  redis:
    image: redis:6.2-alpine
    networks:
      default: null
    volumes:
    - type: volume
      source: redis-data
      target: /data
      volume: {}
  scheduler:
    command:
    - bench
    - schedule
    depends_on:
      configurator:
        condition: service_completed_successfully
    image: frappe/erpnext-worker:v13.35.2
    networks:
      default: null
    volumes:
    - type: volume
      source: sites
      target: /home/frappe/frappe-bench/sites
      volume: {}
  websocket:
    depends_on:
      configurator:
        condition: service_completed_successfully
    image: frappe/frappe-socketio:v13.35.2
    networks:
      default: null
    volumes:
    - type: volume
      source: sites
      target: /home/frappe/frappe-bench/sites
      volume: {}
networks:
  default:
    name: frappe_docker_default
volumes:
  assets:
    name: frappe_docker_assets
  db-data:
    name: frappe_docker_db-data
  redis-data:
    name: frappe_docker_redis-data
  sites:
    name: frappe_docker_sites
x-backend-defaults:
  depends_on:
    configurator:
      condition: service_completed_successfully
  image: frappe/frappe-worker:v13.35.2
  volumes:
  - sites:/home/frappe/frappe-bench/sites
x-depends-on-configurator:
  depends_on:
    configurator:
      condition: service_completed_successfully
x-erpnext-backend-image:
  image: frappe/erpnext-worker:v13.35.2
  1. Reload Projects page and click on the newly created project
  2. Page is blank

Expected behavior Project page should fill the details of the project.

Screenshots Screenshot from 2022-07-19 18-16-03

Desktop (please complete the following information):

  • OS: Debian 11
  • Browser: Firefox 91.11.0esr
  • Yacht Version: v0.0.7-alpha-2022-06-03--21

gus-costa avatar Jul 20 '22 00:07 gus-costa

That's got to be one of the longest docker compose files I have ever seen, will try to duplicate and return results. While we wait try pulling yacht:devel as your image. There has been several things fixed but not pushed to master yet there.

wickedyoda avatar Jul 27 '22 05:07 wickedyoda

Just as a quick "stab-in-the-dark" suggestion....

(my container at least) has a docker-compose --version of 1.28.4

root@eon-yacht:/api# which docker-compose
/usr/bin/docker-compose

root@eon-yacht:/api# docker-compose --version
docker-compose version 1.28.4, build unknown

i mount my (host) docker-compose into /usr/local/bin/docker-compose so that I get a more "modern" version...

root@eon-yacht:/api# which docker-compose
/usr/local/bin/docker-compose

root@eon-yacht:/api# docker-compose --version
Docker Compose version v2.6.1

itsalljustdata avatar Aug 02 '22 15:08 itsalljustdata

The x-* (x-depends-on stuff) isn’t compatible with Yacht as I’m manually parsing the docker-compose file and haven’t run into that before. Try removing that and seeing if it works.

SelfhostedPro avatar Aug 02 '22 15:08 SelfhostedPro

I have recently also run into the same error using the following compose file:

services:
  web:
    image: wger/server:latest
    container_name: wger_server
    depends_on:
      db:
        condition: service_healthy
      cache:
        condition: service_healthy
    env_file:
      - ./config/prod.env
    volumes:
      - static:/home/wger/static
      - media:/home/wger/media
      # For development, mount your local git checkout
      # - type: bind
      #  source: /path/to/wger/sourcecode
      #  target: /home/wger/src/
    ports:
      - "8000"
    healthcheck:
      test: wget --no-verbose --tries=1 --spider http://localhost:8000
      interval: 10s
      timeout: 5s
      retries: 5
    restart: unless-stopped

  nginx:
    image: nginx:stable
    container_name: wger_nginx
    depends_on:
      - web
    volumes:
      - ./config/nginx.conf:/etc/nginx/conf.d/default.conf
      - static:/wger/static:ro
      - media:/wger/media:ro
    ports:
      - "80:80"
    healthcheck:
      test: service nginx status
      interval: 10s
      timeout: 5s
      retries: 5
    restart: unless-stopped

  db:
    image: postgres:12-alpine
    container_name: wger_db
    environment:
      - POSTGRES_USER=wger
      - POSTGRES_PASSWORD=wger
      - POSTGRES_DB=wger
    volumes:
      - postgres-data:/var/lib/postgresql/data/
    expose:
      - 5432
    healthcheck:
      test: pg_isready -U wger
      interval: 10s
      timeout: 5s
      retries: 5
    restart: unless-stopped

  cache:
    image: redis
    container_name: wger_cache
    expose:
      - 6379
    healthcheck:
      test: redis-cli ping
      interval: 10s
      timeout: 5s
      retries: 5
    restart: unless-stopped

volumes:
  postgres-data:
  static:
  media:

networks:
  default:
    name: wger_network

After some testing I found out that the critical part that caused the screen to go blac is this:

    depends_on:
      db:
        condition: service_healthy
      cache:
        condition: service_healthy

Which can be fixed partially by converting it ot the following:

    depends_on:
      - db
      - cache

That means either the condition or service_healthy bits are to blame, right?

DerLeole avatar Jan 28 '23 21:01 DerLeole