|
| 1 | +configs: |
| 2 | + ts-serve: |
| 3 | + content: | |
| 4 | + {"TCP":{"443":{"HTTPS":true}}, |
| 5 | + "Web":{"$${TS_CERT_DOMAIN}:443": |
| 6 | + {"Handlers":{"/": |
| 7 | + {"Proxy":"http://127.0.0.1:3000"}}}}, |
| 8 | + "AllowFunnel":{"$${TS_CERT_DOMAIN}:443":false}} |
| 9 | +
|
| 10 | +services: |
| 11 | +# Make sure you have updated/checked the .env file with the correct variables. |
| 12 | +# All the ${ xx } need to be defined there. |
| 13 | + # Tailscale Sidecar Configuration |
| 14 | + tailscale: |
| 15 | + image: tailscale/tailscale:latest # Image to be used |
| 16 | + container_name: tailscale-${SERVICE} # Name for local container management |
| 17 | + hostname: ${SERVICE} # Name used within your Tailscale environment |
| 18 | + environment: |
| 19 | + - TS_AUTHKEY=${TS_AUTHKEY} |
| 20 | + - TS_STATE_DIR=/var/lib/tailscale |
| 21 | + - TS_SERVE_CONFIG=/config/serve.json # Tailscale Serve configuration to expose the web interface on your local Tailnet - remove this line if not required |
| 22 | + - TS_USERSPACE=false |
| 23 | + - TS_ENABLE_HEALTH_CHECK=true # Enable healthcheck endpoint: "/healthz" |
| 24 | + - TS_LOCAL_ADDR_PORT=127.0.0.1:41234 # The <addr>:<port> for the healthz endpoint |
| 25 | + #- TS_ACCEPT_DNS=true # Uncomment when using MagicDNS |
| 26 | + - TS_AUTH_ONCE=true |
| 27 | + configs: |
| 28 | + - source: ts-serve |
| 29 | + target: /config/serve.json |
| 30 | + volumes: |
| 31 | + - ./config:/config # Config folder used to store Tailscale files - you may need to change the path |
| 32 | + - ./ts/state:/var/lib/tailscale # Tailscale requirement - you may need to change the path |
| 33 | + devices: |
| 34 | + - /dev/net/tun:/dev/net/tun # Network configuration for Tailscale to work |
| 35 | + cap_add: |
| 36 | + - net_admin # Tailscale requirement |
| 37 | + #ports: |
| 38 | + # - 0.0.0.0:${SERVICEPORT}:${SERVICEPORT} # Binding port ${SERVICE}PORT to the local network - may be removed if only exposure to your Tailnet is required |
| 39 | + # If any DNS issues arise, use your preferred DNS provider by uncommenting the config below |
| 40 | + #dns: |
| 41 | + # - ${DNS_SERVER} |
| 42 | + healthcheck: |
| 43 | + test: ["CMD", "wget", "--spider", "-q", "http://127.0.0.1:41234/healthz"] # Check Tailscale has a Tailnet IP and is operational |
| 44 | + interval: 1m # How often to perform the check |
| 45 | + timeout: 10s # Time to wait for the check to succeed |
| 46 | + retries: 3 # Number of retries before marking as unhealthy |
| 47 | + start_period: 10s # Time to wait before starting health checks |
| 48 | + restart: always |
| 49 | + |
| 50 | + # ${SERVICE} |
| 51 | + application: |
| 52 | + image: ${IMAGE_URL} # Image to be used |
| 53 | + network_mode: service:tailscale # Sidecar configuration to route ${SERVICE} through Tailscale |
| 54 | + container_name: app-${SERVICE} # Name for local container management |
| 55 | + environment: |
| 56 | + - TRACKTOR_DEMO_MODE=false |
| 57 | + - FORCE_DATA_SEED=false |
| 58 | + - CORS_ORIGINS="https://${SERVICE}.${TS_TAILNET}.ts.net" # Adjust as needed for your setup |
| 59 | + volumes: |
| 60 | + - ./${SERVICE}-data:/data |
| 61 | + depends_on: |
| 62 | + tailscale: |
| 63 | + condition: service_healthy |
| 64 | + healthcheck: |
| 65 | + test: ["CMD", "pgrep", "-f", "node build"] # Check if ${SERVICE} process is running |
| 66 | + interval: 1m # How often to perform the check |
| 67 | + timeout: 10s # Time to wait for the check to succeed |
| 68 | + retries: 3 # Number of retries before marking as unhealthy |
| 69 | + start_period: 30s # Time to wait before starting health checks |
| 70 | + restart: always |
0 commit comments