Nextcloud, Technology, Tutorial, Ubuntu

EXAMPLE PODMAN-COMPOSE YAML FILE FOR NEXTCLOUD ON UBUNTU SERVER

What is this?

This is basically the ‘nextcloud version’ of this n8n post. It’s the ‘other pod’ that I setup in my multi-pod environment.

Directory Comments

For the directory structure to hold this setup, if you want to copy exactly what I did, you can copy and paste this next block of commands navigate to your HOME directory and run it, it will create the same directory structure to match this compose file, with a bonus directory called ‘backups’ into which you could output your database backups later if you’d like:

mkdir .nextcloud && \
cd .nextcloud && \
mkdir caddy && \
cd caddy && \
mkdir config && \
mkdir data && \
cd .. && \
mkdir mariadb && \
mkdir nextcloud && \
cd nextcloud && \
mkdir config && \
mkdir data && \
cd .. && \
mkdir backups && \
cd ~

Yaml Comments

This setup uses:

  • DuckDNS subdomain so no domain purchase is required (although it’s easier if you do just buy one)
  • Caddy for the reverse proxy (can’t see that in this yaml)
  • Manually created certificates for DuckDNS (more on that here if interested)
  • Uses an internal network called ‘nc_net’ to communicate between nextcloud and mariadb
  • Uses an external (pre-created) network called ‘proxy_net’ that all the pods hang out on as well as the evasive caddy container. See this post to learn more about that part

THE YAML

Enough talking about it, here it is for prime copying/pasting /adjusting as you like:

services:

  maria_db:
    image:  docker.io/library/mariadb:11
    container_name: nc_mariadb
    restart: unless-stopped
    volumes:
      -  $HOME/.nextcloud/mariadb:/var/lib/mysql:z
    environment:
      -  MARIADB_DATABASE=nextcloud
      -  MARIADB_USER=nextcloud
      -  MARIADB_PASSWORD=superSecretPassword
      -  MARIADB_ROOT_PASSWORD=superSecretPassword
    networks:
      -  nc_net

  nextcloud_app:
    depends_on:
      - maria_db
    image: docker.io/library/nextcloud:32-apache
    container_name: nextcloud_app
    environment:
      -  MYSQL_HOST=maria_db
      -  MYSQL_DATABASE=nextcloud
      -  MYSQL_USER=nextcloud
      -  MYSQL_PASSWORD=superSecretPassword
      -  TRUSTED_PROXIES=caddy
      -  OVERWRITEPROTOCOL=https
    networks:
      -  proxy_net
      -  nc_net
    volumes:
      - $HOME/.nextcloud/nextcloud/config:/var/www/html:z
      - $HOME/.nextcloud/nextcloud/data:/var/www/html/data:z
networks:
  proxy_net:
    external: true

  nc_net:
    internal: true

Farewell

Farewell!

Tagged , , , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *