Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support adding condition to compose depends_on / warn the user #1871

Open
aitrics-ray opened this issue May 10, 2024 · 2 comments
Open

Support adding condition to compose depends_on / warn the user #1871

aitrics-ray opened this issue May 10, 2024 · 2 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature.

Comments

@aitrics-ray
Copy link

What would you like to be added?

I'm trying to convert docker compose via kompose.

version: "3.8"

networks:
  shared_network:
    driver: bridge

services:
  mysql:
    container_name: mysql
    platform: linux/amd64
    restart: unless-stopped
    image: 997245385850.dkr.ecr.ap-northeast-2.amazonaws.com/prod/mysql:8.0.36-debian-18a00bd
    expose:
      - 3306
    ports:
      - "3306:3306"
    volumes:
      - ${VOLUME_DIR}/volumes/mysql/:/var/lib/mysql/
      - ${VOLUME_DIR}/logs/mysql/:/var/log/mysql/
    healthcheck:
      test: [ "CMD", "./healthcheck.sh" ]
      interval: 3s
      timeout: 3s
      retries: 100
    networks:
      - shared_network

  backend-migration:
    container_name: backend-migration
    platform: linux/amd64
    deploy:
      restart_policy:
        condition: on-failure
        delay: 10s
        max_attempts: 3
    image: 997245385850.dkr.ecr.ap-northeast-2.amazonaws.com/prod/vc-backend:${VC_IMAGE_TAG}
    entrypoint: [ "sh", "-c", "make migrate" ]
    env_file:
      - ../common_env/vc-backend.env
      - envs/db-encrypt.env
    networks:
      - shared_network
    depends_on:
      mysql:
        condition: service_healthy

  backend:
    container_name: backend
    platform: linux/amd64
    restart: unless-stopped
    image: 997245385850.dkr.ecr.ap-northeast-2.amazonaws.com/prod/vc-backend:${VC_IMAGE_TAG}
    command: uvicorn app.application:app --host 0.0.0.0 --port 8080
    ports:
      - "8080:8080"
    environment:
      - OTEL_SERVICE_NAME=backend
      - VITALCARE_ENVIRONMENT=development
    env_file:
      - ../common_env/vc-backend.env
      - envs/vc-backend.env
      - envs/db-encrypt.env
      - envs/otel.env
    hostname: api.vitalcare.io
    volumes:
      - ${VOLUME_DIR}/logs/backend/:/data/vc-backend/logs/
      - ${VOLUME_DIR}/admin/:${VC_BACKEND_MOUNT_PATH}
    networks:
      - shared_network
    depends_on:
      backend-migration:
        condition: service_completed_successfully

When I run kompose convert, I get an error like this.
FATA services.backend-migration.depends_on must be a list
My guess is that it's because it's a condition, not a list. Is there a workaround?

Why is this needed?

There are some things that depend_on is not a List.

@aitrics-ray aitrics-ray added the kind/feature Categorizes issue or PR as related to a new feature. label May 10, 2024
@cdrage
Copy link
Member

cdrage commented May 29, 2024

We don't support condition at the moment, sorry :(

We'll have to implement this in the future.

@cdrage cdrage changed the title FATA services.backend-migration.depends_on must be a list Support adding condition to compose depends_on / warn the user May 29, 2024
@cdrage
Copy link
Member

cdrage commented May 29, 2024

I've gone ahead and updated the title of this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

2 participants