diff --git a/docker/compose/cvat.yaml b/docker/compose/cvat.yaml new file mode 100644 index 0000000..57c125a --- /dev/null +++ b/docker/compose/cvat.yaml @@ -0,0 +1,452 @@ +version: '3.8' + +services: + cvat_db: + image: postgres:15-alpine + environment: + POSTGRES_USER: root + POSTGRES_DB: cvat + POSTGRES_HOST_AUTH_METHOD: trust + volumes: + #- /mnt/data/cvat/db:/var/lib/postgresql/data + - /mnt/seaweedfs/cvat/db:/var/lib/postgresql/data + networks: + - cvat + deploy: + replicas: 1 + restart_policy: + condition: on-failure + max_attempts: 2 + placement: + constraints: + - node.role == manager + + cvat_redis: + image: redis:7.0-alpine + networks: + - cvat + deploy: + replicas: 1 + restart_policy: + condition: on-failure + max_attempts: 2 + placement: + constraints: + - node.role == worker + + cvat_server: + image: registry.smsoft.kro.kr/cvat:v2.5.0 + depends_on: + - cvat_redis + - cvat_db + - cvat_opa + environment: + DJANGO_MODWSGI_EXTRA_ARGS: '' + ALLOWED_HOSTS: '*' + CVAT_REDIS_HOST: 'cvat_redis' + CVAT_POSTGRES_HOST: 'cvat_db' + ADAPTIVE_AUTO_ANNOTATION: 'false' + IAM_OPA_BUNDLE: '1' + no_proxy: clickhouse,grafana,vector,nuclio,opa + NUMPROCS: 1 + DJANGO_LOG_SERVER_HOST: vector + DJANGO_LOG_SERVER_PORT: 80 + CLICKHOUSE_HOST: clickhouse + CVAT_ANALYTICS: 1 + CVAT_BASE_URL: cvat.smsoft.kro.kr + entrypoint: /home/django/backend_entrypoint.sh + volumes: + - /mnt/seaweedfs/cvat/data:/home/django/data + - cvat-cache:/home/django/data/cache + - /mnt/seaweedfs/cvat/keys:/home/django/keys + - /mnt/seaweedfs/cvat/logs:/home/django/logs + networks: + cvat: + aliases: + - cvat-server + deploy: + replicas: 1 + restart_policy: + condition: on-failure + max_attempts: 2 + placement: + constraints: + - node.role == worker + labels: + - traefik.enable=true + - traefik.docker.network=cvat + - traefik.http.services.cvat.loadbalancer.server.port=8080 + - traefik.http.routers.cvat.rule=Host(`cvat.smsoft.kro.kr`) && + PathPrefix(`/api/`, `/git/`, `/opencv/`, `/static/`, `/admin`, `/documentation/`, `/django-rq`) + - traefik.http.routers.cvat.entrypoints=web + + cvat_utils: + image: registry.smsoft.kro.kr/cvat:v2.5.0 + depends_on: + - cvat_redis + - cvat_db + - cvat_opa + environment: + CVAT_REDIS_HOST: 'cvat_redis' + CVAT_REDIS_PASSWORD: '' + CVAT_POSTGRES_HOST: 'cvat_db' + CLICKHOUSE_HOST: clickhouse + DJANGO_LOG_SERVER_HOST: vector + DJANGO_LOG_SERVER_PORT: 80 + no_proxy: clickhouse,grafana,vector,nuclio,opa + NUMPROCS: 1 + command: -c supervisord/utils.conf + volumes: + - /mnt/seaweedfs/cvat/data:/home/django/data + - /mnt/seaweedfs/cvat/keys:/home/django/keys + - /mnt/seaweedfs/cvat/logs:/home/django/logs + networks: + - cvat + deploy: + replicas: 1 + restart_policy: + condition: on-failure + max_attempts: 2 + placement: + constraints: + - node.role == worker + + cvat_worker_import: + image: registry.smsoft.kro.kr/cvat:v2.5.0 + depends_on: + - cvat_redis + - cvat_db + environment: + CVAT_REDIS_HOST: 'cvat_redis' + CVAT_POSTGRES_HOST: 'cvat_db' + DJANGO_LOG_SERVER_HOST: vector + DJANGO_LOG_SERVER_PORT: 80 + no_proxy: clickhouse,grafana,vector,nuclio,opa + NUMPROCS: 1 + command: -c supervisord/worker.import.conf + volumes: + - /mnt/seaweedfs/cvat/data:/home/django/data + - /mnt/seaweedfs/cvat/keys:/home/django/keys + - /mnt/seaweedfs/cvat/logs:/home/django/logs + networks: + - cvat + deploy: + replicas: 1 + restart_policy: + condition: on-failure + max_attempts: 2 + placement: + constraints: + - node.role == worker + + cvat_worker_export: + image: registry.smsoft.kro.kr/cvat:v2.5.0 + depends_on: + - cvat_redis + - cvat_db + environment: + CVAT_REDIS_HOST: 'cvat_redis' + CVAT_POSTGRES_HOST: 'cvat_db' + CLICKHOUSE_HOST: clickhouse + DJANGO_LOG_SERVER_HOST: vector + DJANGO_LOG_SERVER_PORT: 80 + no_proxy: clickhouse,grafana,vector,nuclio,opa + NUMPROCS: 1 + command: -c supervisord/worker.export.conf + volumes: + - /mnt/seaweedfs/cvat/data:/home/django/data + - /mnt/seaweedfs/cvat/keys:/home/django/keys + - /mnt/seaweedfs/cvat/logs:/home/django/logs + networks: + - cvat + deploy: + replicas: 1 + restart_policy: + condition: on-failure + max_attempts: 2 + placement: + constraints: + - node.role == worker + + cvat_worker_annotation: + image: registry.smsoft.kro.kr/cvat:v2.5.0 + depends_on: + - cvat_redis + - cvat_db + - cvat_opa + environment: + CVAT_REDIS_HOST: 'cvat_redis' + CVAT_POSTGRES_HOST: 'cvat_db' + DJANGO_LOG_SERVER_HOST: vector + DJANGO_LOG_SERVER_PORT: 80 + no_proxy: clickhouse,grafana,vector,nuclio,opa + NUMPROCS: 1 + command: -c supervisord/worker.annotation.conf + volumes: + - /mnt/seaweedfs/cvat/data:/home/django/data + - /mnt/seaweedfs/cvat/keys:/home/django/keys + - /mnt/seaweedfs/cvat/logs:/home/django/logs + networks: + - cvat + deploy: + replicas: 1 + restart_policy: + condition: on-failure + max_attempts: 2 + placement: + constraints: + - node.role == worker + + cvat_worker_webhooks: + image: registry.smsoft.kro.kr/cvat:v2.5.0 + depends_on: + - cvat_redis + - cvat_db + - cvat_opa + environment: + CVAT_REDIS_HOST: 'cvat_redis' + CVAT_POSTGRES_HOST: 'cvat_db' + DJANGO_LOG_SERVER_HOST: vector + DJANGO_LOG_SERVER_PORT: 80 + no_proxy: clickhouse,grafana,vector,nuclio,opa + NUMPROCS: 1 + command: -c supervisord/worker.webhooks.conf + volumes: + - /mnt/seaweedfs/cvat/data:/home/django/data + - /mnt/seaweedfs/cvat/keys:/home/django/keys + - /mnt/seaweedfs/cvat/logs:/home/django/logs + networks: + - cvat + deploy: + replicas: 1 + restart_policy: + condition: on-failure + max_attempts: 2 + placement: + constraints: + - node.role == worker + + cvat_worker_quality_reports: + image: registry.smsoft.kro.kr/cvat:v2.5.0 + depends_on: + - cvat_redis + - cvat_db + environment: + CVAT_REDIS_HOST: 'cvat_redis' + CVAT_POSTGRES_HOST: 'cvat_db' + DJANGO_LOG_SERVER_HOST: vector + DJANGO_LOG_SERVER_PORT: 80 + no_proxy: clickhouse,grafana,vector,nuclio,opa + NUMPROCS: 1 + command: -c supervisord/worker.quality_reports.conf + volumes: + - /mnt/seaweedfs/cvat/data:/home/django/data + - /mnt/seaweedfs/cvat/keys:/home/django/keys + - /mnt/seaweedfs/cvat/logs:/home/django/logs + networks: + - cvat + deploy: + replicas: 1 + restart_policy: + condition: on-failure + max_attempts: 2 + placement: + constraints: + - node.role == worker + + cvat_ui: + image: registry.smsoft.kro.kr/cvat-ui:v2.5.0 + depends_on: + - cvat_server + networks: + - cvat + deploy: + replicas: 1 + restart_policy: + condition: on-failure + max_attempts: 2 + placement: + constraints: + - node.role == worker + labels: + - traefik.enable=true + - traefik.docker.network=cvat + - traefik.http.services.cvat-ui.loadbalancer.server.port=80 + - traefik.http.routers.cvat-ui.rule=Host(`cvat.smsoft.kro.kr`) + - traefik.http.routers.cvat-ui.entrypoints=web + + traefik: + image: traefik:v2.9 + user: root + command: + - '--providers.docker.swarmMode=true' + - '--providers.docker.exposedByDefault=false' + - '--entryPoints.web.address=:8080' + - '--entrypoints.websecure.address=:8081' + - '--entryPoints.dashboard.address=:8090' + - '--providers.file.directory=/etc/traefik/rules' + #- '--entrypoints.web.http.redirections.entryPoint.to=websecure' + #- '--entrypoints.web.http.redirections.entryPoint.scheme=https' + - '--api.dashboard=true' + #- '--accesslog' + #- '--log.level=debug' + ports: + - 10080:8080 + - 10090:8090 + environment: + CVAT_HOST: cvat.smsoft.kro.kr + DJANGO_LOG_VIEWER_HOST: grafana + DJANGO_LOG_VIEWER_PORT: 3000 + volumes: + - /var/run/docker.sock:/var/run/docker.sock:ro + - /mnt/seaweedfs/cvat/components/analytics/grafana_conf.yml:/etc/traefik/rules/grafana_conf.yml:ro + networks: + - cvat + deploy: + replicas: 1 + restart_policy: + condition: on-failure + max_attempts: 2 + placement: + constraints: + - node.role == manager + + cvat_opa: + image: openpolicyagent/opa:0.45.0-rootless + networks: + cvat: + aliases: + - opa + command: + - run + - --server + - --log-level=error + - --set=services.cvat.url=http://cvat.smsoft.kro.kr + - --set=bundles.cvat.service=cvat + - --set=bundles.cvat.resource=/api/auth/rules + - --set=bundles.cvat.polling.min_delay_seconds=5 + - --set=bundles.cvat.polling.max_delay_seconds=15 + deploy: + replicas: 1 + restart_policy: + condition: on-failure + max_attempts: 2 + placement: + constraints: + - node.role == worker + + cvat_clickhouse: + image: clickhouse/clickhouse-server:22.3-alpine + environment: + - CLICKHOUSE_DB=cvat + - CLICKHOUSE_USER=user + - CLICKHOUSE_PASSWORD=user + networks: + cvat: + aliases: + - clickhouse + volumes: + - /mnt/seaweedfs/cvat/components/analytics/clickhouse/init.sh:/docker-entrypoint-initdb.d/init.sh:ro + - /mnt/seaweedfs/cvat/events:/var/lib/clickhouse/ + deploy: + replicas: 1 + restart_policy: + condition: on-failure + max_attempts: 2 + placement: + constraints: + - node.role == worker + + cvat_vector: + image: timberio/vector:0.26.0-alpine + depends_on: + - cvat_clickhouse + environment: + - CLICKHOUSE_DB=cvat + - CLICKHOUSE_USER=user + - CLICKHOUSE_PASSWORD=user + - CLICKHOUSE_HOST=clickhouse + networks: + cvat: + aliases: + - vector + volumes: + - /mnt/seaweedfs/cvat/components/analytics/vector/vector.toml:/etc/vector/vector.toml:ro + deploy: + replicas: 1 + restart_policy: + condition: on-failure + max_attempts: 2 + placement: + constraints: + - node.role == worker + + cvat_grafana: + image: grafana/grafana-oss:9.3.6 + user: root + environment: + - GF_PATHS_PROVISIONING=/etc/grafana/provisioning + - GF_AUTH_BASIC_ENABLED=false + - GF_AUTH_ANONYMOUS_ENABLED=true + - GF_AUTH_ANONYMOUS_ORG_ROLE=Admin + - GF_AUTH_DISABLE_LOGIN_FORM=true + - GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=grafana-clickhouse-datasource + - GF_SERVER_ROOT_URL=http://cvat.smsoft.kro.kr/analytics + - GF_INSTALL_PLUGINS=https://github.com/grafana/clickhouse-datasource/releases/download/v2.0.7/grafana-clickhouse-datasource-2.0.7.linux_amd64.zip;grafana-clickhouse-datasource + - GF_DASHBOARDS_DEFAULT_HOME_DASHBOARD_PATH=/var/lib/grafana/dashboards/all_events.json + volumes: + - /mnt/seaweedfs/cvat/components/analytics/grafana/dashboards/:/var/lib/grafana/dashboards/:ro + entrypoint: + - sh + - -euc + - | + mkdir -p /etc/grafana/provisioning/datasources + cat < /etc/grafana/provisioning/datasources/ds.yaml + apiVersion: 1 + datasources: + - name: 'ClickHouse' + type: 'grafana-clickhouse-datasource' + isDefault: true + jsonData: + defaultDatabase: cvat + port: 9000 + server: clickhouse + username: user + tlsSkipVerify: false + secureJsonData: + password: user + editable: true + EOF + mkdir -p /etc/grafana/provisioning/dashboards + cat < /etc/grafana/provisioning/dashboards/dashboard.yaml + apiVersion: 1 + providers: + - name: cvat-logs + type: file + updateIntervalSeconds: 30 + options: + path: /var/lib/grafana/dashboards + foldersFromFilesStructure: true + EOF + exec /run.sh + networks: + cvat: + aliases: + - grafana + deploy: + replicas: 1 + restart_policy: + condition: on-failure + max_attempts: 2 + placement: + constraints: + - node.role == worker + +networks: + cvat: + driver: overlay + name: cvat + +volumes: + cvat-cache: + driver: local \ No newline at end of file