Files
homelab/nextcloud/README.md

2.9 KiB

Nextcloud AIO

Prereq

  1. Have a reverse proxy pointing at your server
  2. Have a valid certificate

Iscsi

We can use iscsi to give nextcloud a large block store.

On Nextcloud:

  1. Create an iscsi initiator in Truenas named iqn.2024-02.com.reeselink:nextcloud-aio.
  2. Create a new authorized access with username iqn.2024-02.com.reeselink:nextcloud-aio and password.
  3. Create a new target called iqn.2024-02.com.reeselink:nextcloud-aio-data
    1. Create an alias called Nextcloud AIO Data
    2. Select the exposed portal
    3. Select the iqn.2024-02.com.reeselink:nextcloud-aio initiator group
    4. Select CHAP Auth method
    5. Select auth group containing iqn.2024-02.com.reeselink:nextcloud-aio
  4. Create a new extent called nextcloud-aio-data, leave all settings alone
  5. Create a new associated target with iqn.2024-02.com.reeselink:nextcloud-aio-data target and nextcloud-aio-data extent

On Nextcloud AIO:

Edit /etc/iscsi/initiatorname.iscsi and set your initiatorname.

Edit /etc/iscsi/iscsid.conf

node.session.auth.username = iqn.2024-02.com.reeselink:nextcloud-aio
node.session.auth.password = <password>
# Discover targets
iscsiadm -m discovery -t st -p driveripper.reeselink.com
# Login to the nextcloud-data target
iscsiadm -m node -T iqn.2023-01.driveripper.reeselink.com:nextcloud-aio-data -l
# Automatically login on startup
iscsiadm -m node -T iqn.2023-01.driveripper.reeselink.com:nextcloud-aio-data -o update -n node.startup -v automatic

Setup

IPV6 (Optional)

Add to /etc/docker/daemon.json

{
  "ipv6": true,
  "fixed-cidr-v6": "fd12:3456:789a:1::/64",
  "experimental": true,
  "ip6tables": true
}
# Enable IPV6
docker network create --subnet="fd12:3456:789a:2::/64" --driver bridge --ipv6 nextcloud-aio

Install

docker run \
--init \
--sig-proxy=false \
--name nextcloud-aio-mastercontainer \
--restart always \
--publish 8080:8080 \
--env APACHE_PORT=11000 \
--env APACHE_IP_BINDING=0.0.0.0 \
--env NEXTCLOUD_DATADIR="/mnt/ncdata" \
--volume nextcloud_aio_mastercontainer:/mnt/docker-aio-config \
--volume /var/run/docker.sock:/var/run/docker.sock:ro \
nextcloud/all-in-one:latest

Trusted Proxy

docker exec --user www-data -it nextcloud-aio-nextcloud php occ config:system:set trusted_proxies 2 --value="10.1.0.0/16"

Uninstall

docker stop $(docker ps -a -q)
docker system prune
docker volume prune -a -f

defaults,_netdev,x-systemd.requires=iscsid.service 0 1

Edit QCOW

sudo modprobe nbd
sudo qemu-nbd -c /dev/nbd0 --read-only /path/to/image.qcow2
udisksctl mount -b /dev/nbd0p1