Skip to content

Commit

Permalink
Extract swarm specific options to a swarm compose file
Browse files Browse the repository at this point in the history
  • Loading branch information
youngest committed Nov 16, 2021
1 parent c02eee8 commit 73b1b4e
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 45 deletions.
49 changes: 49 additions & 0 deletions docker-compose.swarm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
version: "3.8"
services:
api:
networks:
- default
- traefik

deploy:
labels:
- "traefik.enable=true"
- "traefik.docker.network=traefik"
- "traefik.http.routers.mlmodelscope-api.rule=Host(`${ENVIRONMENT}api.mlmodelscope.org`)"
- "traefik.http.routers.mlmodelscope-api.entrypoints=websecure"
- "traefik.http.routers.mlmodelscope-api.tls.certresolver=letsencrypt"
- "traefik.http.services.mlmodelscope-api.loadbalancer.server.port=80"
- "traefik.http.middlewares.add-cors.headers.accessControlAllowMethods=GET,OPTIONS,PUT"
- "traefik.http.middlewares.add-cors.headers.accesscontrolalloworiginlist=https://staging.mlmodelscope.org,http://localhost:3000"
- "traefik.http.middlewares.add-cors.headers.accessControlAllowCredentials=true"
- "traefik.http.middlewares.add-cors.headers.accessControlAllowHeaders=origin,x-requested-with,content-type,accept,x-request-id"
- "traefik.http.middlewares.add-cors.headers.accesscontrolmaxage=100"
- "traefik.http.middlewares.add-cors.headers.addvaryheader=true"
- "traefik.http.routers.mlmodelscope-api.middlewares=add-cors"

uploader:
networks:
- default
- traefik

deploy:
labels:
- "traefik.enable=true"
- "traefik.docker.network=traefik"
- "traefik.http.routers.mlmodelscope-uploader.rule=Host(`${ENVIRONMENT}uploader.mlmodelscope.org`)"
- "traefik.http.routers.mlmodelscope-uploader.entrypoints=websecure"
- "traefik.http.routers.mlmodelscope-uploader.tls.certresolver=letsencrypt"
- "traefik.http.services.mlmodelscope-uploader.loadbalancer.server.port=80"
- "traefik.http.middlewares.add-cors-uploader.headers.accessControlAllowMethods=GET,OPTIONS,PUT,PATCH"
- "traefik.http.middlewares.add-cors-uploader.headers.accesscontrolalloworiginlist=https://staging.mlmodelscope.org"
- "traefik.http.middlewares.add-cors-uploader.headers.accessControlAllowCredentials=true"
- "traefik.http.middlewares.add-cors-uploader.headers.accessControlAllowHeaders=origin,x-requested-with,content-type,accept,x-request-id,tus-resumable,upload-length,upload-metadata,upload-offset"
- "traefik.http.middlewares.add-cors-uploader.headers.accesscontrolmaxage=100"
- "traefik.http.middlewares.add-cors-uploader.headers.addvaryheader=true"
- "traefik.http.routers.mlmodelscope-uploader.middlewares=add-cors-uploader"


networks:
traefik:
external:
name: traefik
45 changes: 0 additions & 45 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,6 @@ services:
api:
image: "$DOCKER_REGISTRY/mlmodelscope-api:1.0"

networks:
- default
- traefik

deploy:
labels:
- "traefik.enable=true"
- "traefik.docker.network=traefik"
- "traefik.http.routers.mlmodelscope-api.rule=Host(`staging.api.mlmodelscope.org`)"
- "traefik.http.routers.mlmodelscope-api.entrypoints=websecure"
- "traefik.http.routers.mlmodelscope-api.tls.certresolver=letsencrypt"
- "traefik.http.services.mlmodelscope-api.loadbalancer.server.port=80"
- "traefik.http.middlewares.add-cors.headers.accessControlAllowMethods=GET,OPTIONS,PUT"
- "traefik.http.middlewares.add-cors.headers.accesscontrolalloworiginlist=https://staging.mlmodelscope.org,http://localhost:3000"
- "traefik.http.middlewares.add-cors.headers.accessControlAllowCredentials=true"
- "traefik.http.middlewares.add-cors.headers.accessControlAllowHeaders=origin,x-requested-with,content-type,accept,x-request-id"
- "traefik.http.middlewares.add-cors.headers.accesscontrolmaxage=100"
- "traefik.http.middlewares.add-cors.headers.addvaryheader=true"
- "traefik.http.routers.mlmodelscope-api.middlewares=add-cors"

environment:
- C3SR_REGISTRY_ENDPOINTS=registry:8500
- C3SR_REGISTRY_PROVIDER=consul
Expand Down Expand Up @@ -54,30 +34,5 @@ services:

uploader:
image: "$DOCKER_REGISTRY/mlmodelscope-uploader:1.0"
networks:
- default
- traefik

deploy:
labels:
- "traefik.enable=true"
- "traefik.docker.network=traefik"
- "traefik.http.routers.mlmodelscope-uploader.rule=Host(`staging.uploader.mlmodelscope.org`)"
- "traefik.http.routers.mlmodelscope-uploader.entrypoints=websecure"
- "traefik.http.routers.mlmodelscope-uploader.tls.certresolver=letsencrypt"
- "traefik.http.services.mlmodelscope-uploader.loadbalancer.server.port=80"
- "traefik.http.middlewares.add-cors-uploader.headers.accessControlAllowMethods=GET,OPTIONS,PUT,PATCH"
- "traefik.http.middlewares.add-cors-uploader.headers.accesscontrolalloworiginlist=https://staging.mlmodelscope.org"
- "traefik.http.middlewares.add-cors-uploader.headers.accessControlAllowCredentials=true"
- "traefik.http.middlewares.add-cors-uploader.headers.accessControlAllowHeaders=origin,x-requested-with,content-type,accept,x-request-id,tus-resumable,upload-length,upload-metadata,upload-offset"
- "traefik.http.middlewares.add-cors-uploader.headers.accesscontrolmaxage=100"
- "traefik.http.middlewares.add-cors-uploader.headers.addvaryheader=true"
- "traefik.http.routers.mlmodelscope-uploader.middlewares=add-cors-uploader"

ports:
- "8089:80"

networks:
traefik:
external:
name: traefik

0 comments on commit 73b1b4e

Please sign in to comment.