tailscale / tailscale/caddy-tailscale

How to redirect to Nextcloud Docker container?

Open
#102 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
978
Forks
96
PR merge metrics
No merged PRs in 30d

Description

Bear with me. I'm new to Caddy. New to Tailscale. New to Nextcloud.

I'm trying to access my Nextcloud via Caddy which is accessed via Tailscale. All three are in Docker containers. I tried following the following example but am still struggling: https://github.com/nextcloud/all-in-one/discussions/575#

When I try to access my site via http, port 80, and no path, I get brought to a welcome page for Caddy saying "Caddy works! Congratulations! Your web server is working."

And my Caddy/Tailscale container is able to communicate with my Nextcloud container when I sh into the container and try to ping. But the redirect isn't working when trying to access it via my browser doesn't work. I tried using /web_app, /web_app2, as shown in my Caddy file below, on both http and https and neither gives me results. I'm not able to connect with either of those.

This is my HTTP port 80 display if I don't add a path:

Image

Caddyfile
{
        tailscale {
                auth_key tskey-auth-H54H54H5-GRGH453G45
                hostname nextcloud-aio-mastercontainer:11000

                web_app {
                        auth_key tskey-auth-H54H54H5-GRGH453G45
                        hostname nextcloud-aio-mastercontainer:11000
                }
                web_app2 {
                        auth_key tskey-auth-H54H54H5-GRGH453G45
                        hostname nextcloud-aio-mastercontainer:11000
                }
        }
}
:80 {
        bind tailscale/web_app
}

:443 {
        bind tailscale/web_app2
}
caddy-tailscale container
services:
  caddy:
      environment:
        TS_AUTH_KEY:  tskey-auth-H54H54H5-GRGH453G45
        APACHE_PORT: 11000
      volumes:
        - ./Caddyfile:/etc/caddy/Caddyfile
      build:
          dockerfile_inline: |
            FROM docker.io/caddy:2.9-builder AS builder
            RUN xcaddy build \
              --with github.com/tailscale/caddy-tailscale
            FROM docker.io/caddy:2.9
            COPY --from=builder /usr/bin/caddy /usr/bin/caddy
      ports:
        - 80:80
        - 443:443
      networks:
        - nextcloud-aio

volumes:
  caddy_certs:
  caddy_data:
  caddy_config:
  tailscale:
  tailscale_sock:

networks:
  home_default:
    external: true
  nextcloud-aio:
    name: nextcloud-aio
    external: true
Nextcloud container
services:
  nextcloud-aio-mastercontainer:
    image: ghcr.io/nextcloud-releases/all-in-one:beta
    init: true
    restart: always
    container_name: nextcloud-aio-mastercontainer # This line is not allowed to be changed as otherwise AIO will not work correctly
    volumes:
      - nextcloud_aio_mastercontainer:/mnt/docker-aio-config # This line is not allowed to be changed as otherwise the built-in backup solution will not work
      - /var/run/docker.sock:/var/run/docker.sock:ro # May be changed on macOS, Windows or docker rootless. See the applicable documentation. If adjusting, don't forget to also set 'WATCHTOWER_DOCKER_SOCKET_PATH'!
      - ./abc:/mnt/ncdata2
    #network_mode: bridge # add to the same network as docker run would do
    networks:
      - nextcloud-aio
    ports:
      #- 80:80 # Can be removed when running behind a web server or reverse proxy (like Apache, Nginx, Caddy, Cloudflare Tunnel and else). See https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md
      #- 0.0.0.0:443:443
      #- 0.0.0.0:80:80
      - 0.0.0.0:8080:8080
      # - 8443:8443 # Can be removed when running behind a web server or reverse proxy (like Apache, Nginx, Caddy, Cloudflare Tunnel and else). See https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md
    environment: # Is needed when using any of the options below
      # AIO_DISABLE_BACKUP_SECTION: false # Setting this to true allows to hide the backup section in the AIO interface. See https://github.com/nextcloud/all-in-one#how-to-disable-the-backup-section

       APACHE_PORT: 11000 # Is needed when running behind a web server or reverse proxy (like Apache, Nginx, Caddy, Cloudflare Tunnel and else). See https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md
       #APACHE_IP_BINDING: 127.0.0.1 # Should be set when running behind a web server or reverse proxy (like Apache, Nginx, Caddy, Cloudflare Tunnel and else) that is running on the same host. See https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md
       APACHE_IP_BINDING: 0.0.0.0 # Should be set when running behind a web server or reverse proxy (like Apache, Nginx, Caddy, Cloudflare Tunnel and else) that is running on the same host. See https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md

...
...

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Caddyfile and the caddy-tailscale and Nextcloud Compose configurations shown in the issue. Check how the :80 and :443 listeners, Tailscale binds, Docker network, and Nextcloud Apache port relate, then test access through the browser. Done means the configured routes reach the Nextcloud service instead of the Caddy welcome page.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, docker-compose
Domain
devops, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.