TrueNAS Docker Compose: Deploy Nextcloud on SCALE as a Docker or IX App

I’ve been running TN Core with Nextcloud using @dan wonderful script. It seems that Core will not be supported completely in the future making me switch to Scale. With Docker being built into Electric Eel, what would be the best way to run Nextcloud in Scale? Docker compose in Dockge or the native IX system app?

It depends, do you want to be able to customize things, fix your own issues, etc… then docker-compose, which can be used easily via dockge

Or do you require a question and answer gui which may or may not work, and may or may not do what you need?

1 Like

That sounds a little biased.[1]

But really, my answer would be “neither,” unless you’re able to customize the Compose-based install by adding other PHP modules and the like. I’d instead vote for installing the relevant packages yourself, either in a sandbox or a Linux VM.


  1. not that I actually disagree with it, but it goes back to why I think the iX app catalog will be dead in a year or two, notwithstanding Kris’ and Morgan’s protestations to the contrary ↩︎

Maybe, but it is accurate :wink:

But really, my answer would be “neither,” unless you’re able to customize the Compose-based install by adding other PHP modules and the like. I’d instead vote for installing the relevant packages yourself, either in a sandbox or a Linux VM.

Not having a lot of experience with Nextcloud, I’m not able to definitively say, but normally if you can bind mount the modules into place, or even a config file override, it can be done using a container and compose.

1 Like

I’m not sure what how to add php modules to the docker compose, or which ones I would want. I found a Nextcloud AIO that seem to have everything I would want. Will try to get it working with docker compose.

I’d recommend dockge over the current app system (based on Kubernetes). But on Electric Eel, since it will use docker, the following should also be applicable. And apps should auto upgrade once Electric Eel is out.

To intall extra php modules and other stuff (like nano), you specify a dockerbuild file in your docker compose.yaml, which pulls the nextcloud image and then modifies it e.g. adds the desired php modules, prior to deployment.

My jailmkr dockge-hosted nextcloud compose is as follows:

services:
  db:
    image: mariadb:10.6
    command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW
    restart: always
    volumes:
      - ./db:/var/lib/mysql:Z
    environment:
      - MYSQL_ROOT_PASSWORD=changeme
      - MARIADB_AUTO_UPGRADE=1
      - MARIADB_DISABLE_UPGRADE_BACKUP=1
    env_file:
      - db.env
  redis:
    image: redis:alpine
    restart: always
  app:
    build: 
      dockerfile: ../dockerfile
    restart: always
    ports:
      - 192.168.1.1:8089:80
    volumes:
      - ./nextcloud:/var/www/html:z
      - ./config.php:/nextcloud/config/config.php
    environment:
      - MYSQL_HOST=db
      - REDIS_HOST=redis
      - PHP_MEMORY_LIMIT=1024M
      - PHP_UPLOAD_LIMIT=1024M
    env_file:
      - db.env
    depends_on:
      - db
      - redis
  cron:
    image: nextcloud:apache
    restart: always
    volumes:
      - ./nextcloud:/var/www/html:z
    entrypoint: /cron.sh
    depends_on:
      - db
      - redis
volumes:
  db: null
  nextcloud: null
networks: {}

The dockerbuild file referred to above is:

FROM nextcloud:29.0.6
RUN apt update && apt install -y smbclient libsmbclient-dev nano sudo && rm -rf /var/lib/apt/lists/*
RUN pecl install smbclient
RUN docker-php-ext-enable smbclient

The dockerbuild file is where you can install additional php modules using RUN pecl and then RUN docker-php-ext-enable as I’ve used above to install smbclient support.

db.env:

MYSQL_PASSWORD=changeme
MYSQL_DATABASE=nextcloud
MYSQL_USER=nextcloud

It’s all so embarrassingly simple to deploy, maintain and upgrade compared to previous VM installations I’ve had and the Truecharts app. Its actually no fun, since there’s not much to troubleshoot!

I found the nextcloud AIO image unnecessarily complex - it creates about 6 containers and seems very opaque. Good luck trying to add any customisations to it.

(Note: you’ll need to specify your own password and desired ip address in the above examples. You’ll also need a working .htaccess file and config.php file).

1 Like

[quote=“sos_nz, post:6, topic:13012”]
(Note: you’ll need to specify your own password and desired ip address in the above examples. You’ll also need a working .htaccess file and config.php file).

Thanks for sharing your docker compose file.
I’m not familiar with the .htaccess file so I copies the .htacess file and config.php from my working nextcloud on Core. I changed the DB password to match the on specified in the db.env file and commented out the lines
‘overwrite.cli.url’
‘overwritehost’
‘overwriteprotocol’
in the config.php file.
The containers download and start but when I click on the link to the app in dockge I get this site can’t be found

Looks like something’s not being set up right. Perhaps try without a pre-populated config.php file and let the nextcloud install do its own thing (don’t forget to remove reference to it in your docker compose yaml - at least temporarily until you get it working).

I would highly recommend Nextcloud AIO - I just need to get around to testing it out on Electric Eel. I’ve been running it via jailmaker with great success. It’s very snappy and quick.

You can add php modules using either a separate dockerfile or via dockerfile_inline in compose. I don’t feel well right now, but can provide more details if you need them. I add php modules, not to nextcloud but to other containers I have. Slightly tricky.

I always use my own containers, I find the provided ones are too inflexible. I don’t like the aio version as it includes way more than I need.

aio seems limit it’s http port strictly to 80, 443, where those port could be banned by ISP in some region

Yes that’s true, in that particular case you would need to use something like Cloudflare Tunnels, or use an external VPS in front, or you could use Tailscale Funnel which also works if you’re in a double NAT situation (eg. ISP uses CGNAT).

Do you mean Talk, Collabora, Full Text Search and other NC modules? Those can be enabled/disabled in the NC Master Container UI so you don’t have to deploy those features and therefore they won’t consume resources.

You can also add PHP modules as desired via Docker Compose.

Yep, don’t like extra junk, don’t need any of that and don’t need postgres either. Way more flexible to add stuff when you roll your own completely. Nothing wrong with AIO per se, just prefer containers with only what I need.

I’m using caddy as a reverse proxy for nextcloud and everything else. I would never expose to the internet, depends on use case perhaps. I simply am using auto connecting wireguard. I myself am behind cgnat, so wireguard does have to run on vps.