Replies: 31 comments 236 replies
-
hi , |
Beta Was this translation helpful? Give feedback.
This comment has been hidden.
This comment has been hidden.
-
This is amazing @flll , I am trying to achieve the same since a month. But I am not using docker. Can you KINDLY make a script like the one for nextcloud with nginx as server, caddy as reverse proxy, tailscale and cloudflare as DNS. regards |
Beta Was this translation helpful? Give feedback.
This comment has been hidden.
This comment has been hidden.
-
Thank you for your work @flll . But no matter how many times I try the procedure, the hostname I give in the compose environment doesn't get created in the tailscale and rather a random ephemeral hostname is created after manually authenticating using the url in the log.
My Internet and Network connection is fine. But I cannot log into the nextcloud instance even with the the randomly generated hostname in my tailnet. |
Beta Was this translation helpful? Give feedback.
-
Did anyone get this error? docker compose up tailscale-1 | boot: 2024/10/24 22:18:21 Running 'tailscale up' |
Beta Was this translation helpful? Give feedback.
-
Nice guide! Thanks so much.
or
Note: same goes for the |
Beta Was this translation helpful? Give feedback.
-
Okay, one question: Should I "sudo dnf install tailscale" on my host, then follow all this docker compose things? because how would I declare ACL dst 'nextcloud.your-tailnet.ts.net'? Or do I add my device manually in tailscale admin? I might be very less informed about ACL and tags, but I am trying to learn and doing all this to use nextcloud-aio is tiring, but I am trying my best. Thanks! PS: I was using this
|
Beta Was this translation helpful? Give feedback.
-
Thanks for the guide, it's great but I cannot make it work for myself. My compose.yaml:
My ACL:
Caddy seems to recognize the domain name correctly, i.e. it resolves $NC_DOMAIN correctly. Tailscale logs:
Tried opening 443 (TCP and UDP), 80, 8080 (out of desperation) in firewall and even disabling the firewall completely, none of it helped Seems that no matter what I do, in the nextcloud container I see:
Pinging the domain name within tailscale works without problems |
Beta Was this translation helpful? Give feedback.
-
Finally access the domain. |
Beta Was this translation helpful? Give feedback.
-
Hey, So I have tried a lot of things, now my experience is like this:
Apache logs:
Nextcloud logs:
Redis:
Database:
Notify Push:
Nextcloud Mastercontainer Logs:
My ACL of Tailscale:
|
Beta Was this translation helpful? Give feedback.
-
Has anyone tried to deploy using the portainer stack? Caddy log:
I have double-checked my NC_DOMAIN variable. compose.yml: services:
nextcloud-aio-mastercontainer:
image: nextcloud/all-in-one:latest
init: true
restart: always
container_name: nextcloud-aio-mastercontainer # This line cannot be changed.
volumes:
- nextcloud_aio_mastercontainer:/mnt/docker-aio-config
- /var/run/docker.sock:/var/run/docker.sock:ro
networks:
- nextcloud-aio
ports:
- 0.0.0.0:8080:8080
environment:
APACHE_PORT: 11000
APACHE_IP_BINDING: 127.0.0.1
SKIP_DOMAIN_VALIDATION: true
caddy:
image: caddy:alpine
restart: unless-stopped
container_name: caddy
environment:
NC_DOMAIN: nextcloud.[redacted].ts.net # Change this to your domain ending with .ts.net in the format {$TS_HOSTNAME}.{tailnetdomain}
volumes:
- type: bind
source: /home/surya/Caddyfile
target: /etc/caddy/Caddyfile
- type: volume
source: caddy_certs
target: /certs
- type: volume
source: caddy_data
target: /data
- type: volume
source: caddy_config
target: /config
- type: volume
source: tailscale_sock
target: /var/run/tailscale/ # Mount the volume for /var/run/tailscale/tailscale.sock
read_only: true
network_mode: service:tailscale
tailscale:
image: tailscale/tailscale:latest
container_name: tailscale
environment:
TS_HOSTNAME: nextcloud # Enter the hostname for your tailnet
TS_AUTH_KEY: tskey-client-kYthXvJbHD21CNTRL-[redacted] # OAuth client key recommended
TS_EXTRA_ARGS: --advertise-tags=tag:nextcloud # Tags are required when using OAuth client
init: true
restart: unless-stopped
volumes:
- /dev/net/tun:/dev/net/tun
- type: volume
source: tailscale
target: /var/lib/tailscale
- type: volume
source: tailscale_sock
target: /tmp # Mounting the entire /tmp folder to access tailscale.sock
cap_add:
- NET_ADMIN
- NET_RAW
networks:
- nextcloud-aio
volumes:
nextcloud_aio_mastercontainer:
name: nextcloud_aio_mastercontainer # This line cannot be changed.
caddy_certs:
name: caddy_certs
caddy_data:
name: caddy_data
caddy_config:
name: caddy_config
tailscale:
name: tailscale
tailscale_sock:
name: tailscale_sock
networks:
nextcloud-aio:
name: nextcloud-aio
driver: bridge
enable_ipv6: false
driver_opts:
com.docker.network.driver.mtu: "9001" # Jumbo Frame
com.docker.network.bridge.host_binding_ipv4: "127.0.0.1" # Harden aio Tailscale ACL: "groups": {
"group:admin": ["js-surya@github"],
"group:users": ["[email protected]", "[email protected]"],
},
"tagOwners": {
"tag:nextcloud": ["group:admin"],
},
"acls": [
// Allow general unrestricted access (you can comment this out if needed).
{"action": "accept", "src": ["*"], "dst": ["*:*"]},
// Allow users in "group:users" to access any devices tagged with "nextcloud".
{"action": "accept", "src": ["group:users"], "dst": ["tag:nextcloud:*"]}, I'm not an IT expert, and I'm relatively new to this. My IP is behind CGNAT, and I want to access my Nextcloud server outside my local network using Tailscale. I'm eager to learn, so any suggestions or help would be appreciated. |
Beta Was this translation helpful? Give feedback.
-
Apache is always unhealthy docker exec -it nextcloud-aio-apache bash -x /healthcheck.sh
|
Beta Was this translation helpful? Give feedback.
-
@flll Wanted to mention that I was able to get this working without needing caddy at all. I think it simplifies things a bit. Tailscale can natively proxy Note this employs tailscale serve (as opposed to tailscale funnel) so will only expose the service to your tailnet, not publicly. You could set a funnel flag to true in the json config below to expose it publicly, though some security and performance caveats would apply if you did.
|
Beta Was this translation helpful? Give feedback.
-
@patrick-theprogrammer there is no port assigned to nextcloud-aio, how you assess to containers? and assign domain etc? |
Beta Was this translation helpful? Give feedback.
-
If Others are interested I can write up how I was able to do this without caddy using tailscale serve. I was having issues with the caddy container so decided to use serve to route traffic to the apache port when you vist nextcloud.tailnet.ts.net. So far has been working well. |
Beta Was this translation helpful? Give feedback.
-
The environment Variable in the Caddyfile seems not to work for me in that way. Everything else worked now, I'm thinking if there is maybe a possibility to have variables in the compose file itself... So that I don't need the Hostname 2x |
Beta Was this translation helpful? Give feedback.
-
Heyo, first of all, thank you for this guide. 2 Questions are rising: For testing purpose i connected into the docker containers, e.g. into the nextcloud-aio-nextcloud with bash, and tried to ping my tailscale network. But i can acccess my nextcloud whatsover, everything is working. Any suggestions? |
Beta Was this translation helpful? Give feedback.
-
I have a slight issue and I'm guessing it's a rookie error. I put the $NC_DOMAIN as my Unraid server's full domain (the one on the tailscale network) and when I open nextcloud in the nextcloud UI, it sends me to my Unraid server's GUI. Where have I gone wrong here? |
Beta Was this translation helpful? Give feedback.
-
@patrick-theprogrammer your script compose.yml and serve.json is absolutely fine. The trick is in the tailscale, which also need to be installed on host machine as well. Apache container is Healthy and only three security and setup warnings which can be managed manually. |
Beta Was this translation helpful? Give feedback.
-
@patrick-theprogrammer how to run 'occ maintenance:repair --include-expensive' |
Beta Was this translation helpful? Give feedback.
-
@flll great work with this how-to, and the comments really helped me. A few comments that may be useful to others (which could be added to your original post)
Also just a note, it might take some time to get the files all the setup ready on Tailscale's side when starting up the Docker environment. It took 10 minutes for me, having the error in the Nextcloud AIO interface "Failed to connect to server", just be patient (I tried debugging for no reason facepalm). |
Beta Was this translation helpful? Give feedback.
-
Hi y’all! First of all, thank you So Much for writing this guide; I was trying to set up the AIO container with Tailscale a few months ago, and I couldn’t get the networking to work for the life of me. That said, I’m having a problem following this guide. I’ve only gotten as far as the initial I’m sure this is a noob error—I’m still pretty new to both networking and containers—but could you clarify what I might be doing wrong, please? |
Beta Was this translation helpful? Give feedback.
-
Hello everyone! First I would like to say that this is an excellent guide, @flll! Thank you! Now, I'm interested in running It's worth mentioning that I already have managed to run |
Beta Was this translation helpful? Give feedback.
-
@patrick-theprogrammer After new Tailscale update, the setup you have describe earlier is not working. Tailscale cannot connect to endpoint. Tailscale container restarting frequently |
Beta Was this translation helpful? Give feedback.
-
there is something new in market. TSDPROXY. Anyone tried it? |
Beta Was this translation helpful? Give feedback.
-
Thanks @flll @A4alli . Excellent guide. Finally, I was able to run Nextcloud server locally. Silly me, I didn't enable HTTPS in tailscale admin due to which I was unable to access. Learnt a lot!! |
Beta Was this translation helpful? Give feedback.
-
Hi there! Error seems to be EDIT : I just fixed the UDP Buffer size, and that error doesn't show anymore, but it won't let me in due to the abovementioned error. |
Beta Was this translation helpful? Give feedback.
-
@chamabreu did you get theme error in logs? Further more did you get rid of those mime-type and email + phone warnings in Security Warning and setup tab inside nextcloud instance settings? |
Beta Was this translation helpful? Give feedback.
-
Disclaimer: It might be possible that the config below is not working 100% correctly, yet. Improvements to it are very welcome!
This setup integrates Nextcloud All-in-One (AIO) with Tailscale, using Caddy as a reverse proxy.
Since Tailscale currently only allows communication with localhost(127.0.0.1), we use a sidecar with Caddy to communicate with AIO.
serve.json
configuration (This document does not provide an example ofserve.json
)1. Set Environment Variables
Set the following environment variables:
Note
We will not create a .env file, but instead write directly into the compose.yml file later.
If you do create a .env file, compose will automatically read it. In this case, set the key-value format in service[].environment[] of the compose.yml to keys only, allowing compose to pass variables to the service.
Ensure NC_DOMAIN is in the correct format.
When using OAuth client key, set tags in TS_EXTRA_ARGS and define them in ACL.
For more detailed information, please refer to:
https://tailscale.com/blog/docker-tailscale-guide
2. Configure Docker Compose File
Create a compose.yml file with the following content. Replace environment variables as appropriate.
compose.yml
Important
Make sure to replace
NC_DOMAIN
,TS_HOSTNAME
,TS_AUTH_KEY
, andTS_EXTRA_ARGS
with your actual values before running the docker compose file.3. Create Caddyfile
Create a Caddyfile in the current directory with the following content:
Caddyfile
Note
Do not manually replace the
{$NC_DOMAIN}
variable. It will be automatically populated with the value set in your environment variables.4. Set Up Nextcloud AIO
docker compose up -d
https://$NC_DOMAIN/
(e.g., https://nextcloud.your-tailnet.ts.net/)Beta Was this translation helpful? Give feedback.
All reactions