Skip to content

Include the server config in the compose file? #12

Open
@plattrap

Description

@plattrap

One magic I had to work out is to double the "$" in the config content so that Docker does not try and expand the TS_CERT_DOMAIN string.

Also commented out the funnel line, because if it is in (even set to false), then the container shows as funnel enabled in the
control panel.

---
services:
  ts-nginx-test:
    image: tailscale/tailscale:latest
    container_name: ts-nginx-test
    hostname: nginx-test
    environment:
      - TS_AUTHKEY=${TS_AUTHKEY}
      - TS_EXTRA_ARGS=--advertise-tags=tag:container
      - TS_SERVE_CONFIG=/ts-nginx-test-config
      - TS_STATE_DIR=/var/lib/tailscale
    volumes:
      - ts-nginx-test-data:/var/lib/tailscale
      - /dev/net/tun:/dev/net/tun
    configs:
      - ts-nginx-test-config
    cap_add:
      - net_admin
      - sys_module
    restart: unless-stopped

  nginx-pid-test:
    image: nginx
    container_name: nginx-pid-test1
    network_mode: service:ts-nginx-test
    depends_on:
      - ts-nginx-test

volumes:
  ts-nginx-test-data:
    driver: local
    
configs:
  ts-nginx-test-config:
    content: |
      {
        "TCP": { "443": { "HTTPS": true } },
        "Web": {
          "$${TS_CERT_DOMAIN}:443": {
            "Handlers": {
              "/": {
                "Proxy": "http://127.0.0.1:80"
              }
            }
          }
        },
        "#AllowFunnel": { "$${TS_CERT_DOMAIN}:443": false }
      }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions