TLDR: I consistently fail to set up Nextcloud on Docker. Halp pls?

Hi all - please help out a fellow self-hoster, if you have experience with Nextcloud. I have tried several approaches but I fail at various steps. Rather than describe my woes, I hope that I could get a “known good” configuration from the community?

What I have:

  • a homelab server and a NAS, wired to a dedicated switch using priority ports.
  • the server is running Linux, Docker, and NPM proxy which takes care of domains and SSL certs.

What I want:

  • a docker-compose.yml that sets up Nextcloud without SSL. Just that.
  • ideally but optionally, the compose file might include Nextcloud office-components and other neat additions that you have found useful.

Your comments, ideas, and other input will be much appreciated!!

  • redcalcium@lemmy.institute
    link
    fedilink
    English
    arrow-up
    21
    arrow-down
    2
    ·
    edit-2
    1 year ago

    Nextcloud is very easy to setup as a container. You just need a MySQL/MariaDB server and a volume mount. Just make sure the volume is owned by www-data user (uid:gid 33:33). That’s it. Most problems I’ve seen so far are related to files permissions, so double check to make sure the volume is owned by www-data.

  • yourdogsnipples@lemmy.world
    link
    fedilink
    English
    arrow-up
    10
    ·
    1 year ago

    As others have commented, Nextcloud provide an all-in-one docker set up. I managed to follow the instructions and get it working.

    However, in the end, I wanted this to replace my Dropbox subscription, and my files and reliable access to them are important to me. Given that, and my relatively low skill level, I didn’t want to futz with troubleshooting failed updates and server issues, so I just went with a Hetzner storage share, which is their managed nextcloud subscription: https://www.hetzner.com/storage/storage-share

    • Solar Bear@slrpnk.net
      link
      fedilink
      English
      arrow-up
      8
      ·
      1 year ago

      This is a completely valid option and one that more people should consider. You don’t have to selfhosted everything, even if you can. I actually prefer to support existing instances of stuff in a lot of cases.

      I use https://disroot.org for email and cloud, and I’m more than happy to kick them a hundred bucks a year to help support a community. Same with https://fosstodon.org for Mastodon. I’m fully capable of self-hosting these things, but instead I actively choose to support them instead so that their services can be extended to more than just myself. I chose those two because they send excess funds upstream to FOSS projects. I’m proud to rep those domains.

    • vividspecter@lemm.ee
      link
      fedilink
      English
      arrow-up
      1
      ·
      edit-2
      1 year ago

      I found the AIO to be kind of quirky in the way it’s architected, including having a master container that must be named exactly and I couldn’t find a way to make a bind mount for the config/data (that part was a deal breaker). Probably up their with LSIO in simplicity, however, and it doesn’t default to sqlite which is nice.

  • aliens@infosec.pub
    link
    fedilink
    English
    arrow-up
    7
    ·
    1 year ago

    Here’s my docker-compose.yml for nextcloud (with minor privacy changes) that includes onlyoffice and drawio containers. SSL is not included and should be handled by NPM and you’ll need a proxy host for both drawio and onlyoffice. I use NPM in docker so I just add it to the docs network instead of exposing any additional ports. For onlyoffice the secret key gets regenerated each time the container starts so you’ll need to update onlyoffice setting in nextcloud each time (unless someone has a better solution). You can get the secret key by logging into the onlyoffice container and running

    cat /etc/onlyoffice/documentserver-example/local.json

    I’ve been running this solution for a few years without any major issues.

    docker-compose.yml

    version: '3.5'
    
    networks:
     docs:
      name: docs 
      driver: bridge
    
    services:
     nextcloud:
      image: linuxserver/nextcloud
      container_name: nextcloud
      environment:
       - PUID=1000
       - PGID=1000
       - MYSQL_DATABASE=nextcloud
       - MYSQL_USER=nextcloud
       - MYSQL_PASSWORD=P@ssWord321!
       - MYSQL_HOST=nextcloud_db
       - TZ="America/Chicago"
      volumes:
       - /home/user/docker/configs/nextcloud:/config
       - /home/user/docker/configs/nextcloud_data:/data
      restart: unless-stopped
      depends_on:
       - nextcloud_db
      networks:
       - docs 
    
     nextcloud_db:
      image: linuxserver/mariadb:110.4.21mariabionic-ls31
      container_name: nextcloud_db
      restart: always
      environment:
       - PUID=1000
       - PGID=1000
       - MYSQL_ROOT_PASSWORD=P@ssWord123!
       - MYSQL_DATABASE=nextcloud
       - MYSQL_USER=nextcloud
       - MYSQL_PASSWORD=P@ssWord321!
      volumes:
       - /home/user/docker/configs/nextcloud_db/mysql:/config
      restart: unless-stopped
      networks:
       - docs 
    
     onlyoffice:
      image: onlyoffice/documentserver
      container_name: onlyoffice
      restart: always
      depends_on:
       - nextcloud
      networks:
       - docs 
    
     image-export:
      image: jgraph/export-server
      container_name: nextcloud-drawio-export
      networks:
       - docs 
      volumes:
       - ./fonts:/usr/share/fonts/drawio
      restart: unless-stopped
    
     drawio:
      image: jgraph/drawio
      container_name: nextcloud-drawio
      networks:
       - docs 
      depends_on:
       - image-export
      environment:
       - VIRTUAL_HOST=drawio.example.com
       - VIRTUAL_PORT=8080
       - EXPORT_URL=http://image-export:8000/
      restart: unless-stopped
    
    • 30021190@lemmy.cloud.aboutcher.co.uk
      link
      fedilink
      English
      arrow-up
      2
      ·
      1 year ago

      This compose looks like it should work, I’m not at a pc to test but it’s near identical to my own; I would maybe change onlyoffice for collabra otherwise try this.

      Op states they are using a Nas and server, so if NFS is being used you may need :Z on the end of any kind volume (or a non-NFS mount point if using podman/extended ACLS don’t work).

  • robolemmy@lemmy.world
    link
    fedilink
    English
    arrow-up
    4
    ·
    1 year ago

    I’m not sure if your goal is to set up nextcloud or to learn docker compose while setting up nextcloud. If you just want it up and running, you could use DockSTARTer to get it going. Heck, even if your goal is mainly learning, you can always tear apart the compose file that dockstarter generates and compare it to your own.

  • Nowhereman@lemmy.stonansh.org
    link
    fedilink
    English
    arrow-up
    5
    arrow-down
    2
    ·
    1 year ago

    I remember cursing allot with trying nextcloud to work :D and than my serber crashed. I’m currently reinstalling everything but haven’t had the courage to get going on nextcloud.

  • ᓰᕵᕵᓍ@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    1 year ago

    With nginx

    https://github.com/nextcloud/docker#base-version---fpm

    With caddy

    https://caddy.community/t/example-docker-nextcloud-fpm-caddy-v2-webserver/9407

    I oersonaly run fpm with caddy

    Remember to create your admin account on first run and then add your trusted domain

    Admin

    • navigate to localhost:8080
    • create admin acount
    • write down your credestials

    allowed domains

    • docker ps
    • copy container id of nextcloud:fpm
    • docker exec --user www-data container_id php occ config:system:set trusted_domains 2 --value=your_domain_name_here
    • docker stop container_id
    • docker start container_id
  • cwista@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    1 year ago

    I would recommend going with the Docker AIO install, it does a lot of the heavy lifting for you as well as dealing with backups and updates for long term maintenance.

    • Spike@discuss.tchncs.de
      link
      fedilink
      English
      arrow-up
      2
      ·
      1 year ago

      I spun this up just today and had no issues whatsoever. Just a bad aftertase because the AIO package creates and manages other containers on the host, I’d love to have more control over those as well. But for the sake of comfortability I’ll just have to accept that. And it truly works out of the box!

  • rarkgrames@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    arrow-down
    1
    ·
    1 year ago

    I’ve been fighting nextckoud over the last few days. I got it up and running, yay. But the. I could not get Nextcloud office or Onlyoffice to work at all.

    I used the AIO docker install and followed all the instructions for setup behind cloudflare tunnels but I’m guessing it’s something to do with that, but I just don’t have the time or patience to spend hours trying to troubleshoot why I can install onlyoffice but it won’t allow me to create documents.

    I may revisit in the future but the frustration levels are just too high atm.

  • gobbling871@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    1 year ago

    Maybe give cloudflared a try. Works for me even with nextcloud’s ssl (don’t think there’s a way to start NC without the self-signed cert). Couldn’t get it to work with NPM (I admittedly don’t know much about nginx) so I brought in the big gun(s).

  • steel_moose@lemmy.world
    link
    fedilink
    English
    arrow-up
    6
    arrow-down
    5
    ·
    1 year ago

    A bit of a sidenote and definitely an unpopular opinion coming up… The nextcloud snap is perhaps the easiest and among the most stable ways to run NC. And I base this on my own experience, having installed and tested NC on numerous devices in several ways. You loose some tinkerability and the performance is nothing to write home about. And yes I know - snap no good - Canonical evil. That having been said, If stability and easy setup is what you want, it’s worth considering.