adding the coder stack file

This commit is contained in:
hyung-hwan 2022-10-31 14:41:19 +09:00
parent bc18455259
commit 51fc36eea3
2 changed files with 39 additions and 6 deletions

View File

@ -7,10 +7,40 @@ networks:
external: true external: true
services: services:
## use this unsafe proxy to gain access to the docker socket.
## group_add as suggested by coder oss isn't avaiable in compose 3
## even if it's supported, adding a group repliably over multiple
## nodes isn't possible because the group id for 'docker' may not be
## the same across multiple nodes.
coder-socat-service:
image: docker.io/alpine/socat:latest
hostname: coder-socat-service-host
command: tcp-listen:2375,fork,reuseaddr unix-connect:/var/run/docker.sock
environment:
- DS_NODE_NAME={{.Node.Hostname}}
- DS_SERVICE_NAME={{.Service.Name}}
- DS_TASK_NAME={{.Task.Name}}
volumes:
- type: bind
source: /var/run/docker.sock
target: /var/run/docker.sock
networks:
- coder-network
deploy:
mode: global
placement:
constraints:
- node.role == manager
resources:
limits:
memory: 10MB
coder-service: coder-service:
image: ghcr.io/coder/coder:latest image: ghcr.io/coder/coder:latest
hostname: coder-service-host hostname: coder-service-host
tty: true tty: true
depends_on:
- coder-socat-service
environment: environment:
- DS_NODE_NAME={{.Node.Hostname}} - DS_NODE_NAME={{.Node.Hostname}}
- DS_SERVICE_NAME={{.Service.Name}} - DS_SERVICE_NAME={{.Service.Name}}
@ -22,6 +52,7 @@ services:
- CODER_OIDC_EMAIL_DOMAIN=miflux.com - CODER_OIDC_EMAIL_DOMAIN=miflux.com
- CODER_OIDC_CLIENT_ID=8fc09269-57cd-4a03-a66b-6fb357d8abec - CODER_OIDC_CLIENT_ID=8fc09269-57cd-4a03-a66b-6fb357d8abec
- CODER_OIDC_CLIENT_SECRET=gto_7hfqdkyg3tfc6ho5zuv2k34wl4jmnwxctzp32kvujrrmjf4bb2ta - CODER_OIDC_CLIENT_SECRET=gto_7hfqdkyg3tfc6ho5zuv2k34wl4jmnwxctzp32kvujrrmjf4bb2ta
- DOCKER_HOST=tcp://coder-socat-service-host:2375
networks: networks:
- coder-network - coder-network
- traefik-network - traefik-network
@ -42,9 +73,9 @@ services:
deploy: deploy:
mode: replicated mode: replicated
replicas: 1 replicas: 1
placement: ##placement:
max_replicas_per_node: 1 ## max_replicas_per_node: 1
##constraints: ## constraints:
## - node.labels.location == home ## - node.labels.location == home
## - node.hostname == rose ## - node.hostname == rose
resources: resources:

View File

@ -17,6 +17,7 @@ services:
- DS_SERVICE_NAME={{.Service.Name}} - DS_SERVICE_NAME={{.Service.Name}}
- DS_TASK_NAME={{.Task.Name}} - DS_TASK_NAME={{.Task.Name}}
volumes: volumes:
# direct binding is ok for the constraints 'node.role == manager' below
- type: bind - type: bind
source: /var/run/docker.sock source: /var/run/docker.sock
target: /var/run/docker.sock target: /var/run/docker.sock
@ -44,7 +45,8 @@ services:
deploy: deploy:
mode: global mode: global
placement: placement:
constraints: [node.role == manager] constraints:
- node.role == manager
command: command:
- --log.level=INFO - --log.level=INFO
- --accessLog - --accessLog