Update README.md

This commit is contained in:
2025-02-23 21:00:27 +00:00
parent 3ad577fe01
commit 272e113d9b

View File

@@ -1,6 +1,37 @@
# Creating a test Nextcloud virtual machine
Taking this task one step at a time I started by creating a docker nextcloud server on a virtual machine following [this](https://blog.ssdnodes.com/blog/installing-nextcloud-docker/) tutorial.
## Upgrading
> First of all **SWITCH ROUTER DNS SERVER**
### Linux
1. Remove zfs-linux `yay -Rns zfs-linux-lts`
2. Upgrade all packages `yay`
3. Clone the zfs-linux repository `git clone https://aur.archlinux.org/zfs-linux-lts.git`
4. Update the dependencies to match Linux version inside `PKGBUILD`
5. Install zfs-linux `cd zfs-linux-lts` `makepkg -si`
> You might need to make sure you have the correct `zfs-utils` installed.
### Docker Containers
Nextcloud is the annoying one here. Unless you want to take the risk, you need to upgrade to each major version, incrementally.
You can do this by changing the base image in the `nextcloud/DockerFile` file to `nextcloud:{version}-fpm-alpine`.
> You should upgrade to the latest minor version of the current major version first.
Once you have done that you can upgrade all the images:
```
sudo docker-compose pull # to upgrade the images
sudo docker-compose pull nextcloud:{version}-fpm-alpine # because docker-compose can't tell that it is used by the nextcloud image
sudo docker-compose down # to destroy all the existing containers
sudo docker-compose up --force-recreate --build -d # to rebuild all the containers with the newest images
sudo docker-compose exec -u 1000 -it nextcloud php /var/www/html/occ upgrade -vvv # to run the upgrade script
sudo docker-compose exec -u 1000 -it nextcloud php /var/www/html/occ maintenance:mode --off # to turn the site back on
sudo certbot certonly -d scarif.space,www.scarif.space,tower.scarif.space,labs.scarif.space,comms.scarif.space,office.scarif.space,rec.scarif.space,radio.scarif.space,intel.scarif.space --force-renewal
sudo cp /etc/letsencrypt/live/scarif.space/privkey.pem /opt/ssl/scarif.space.key
sudo cp /etc/letsencrypt/live/scarif.space/fullchain.pem /opt/ssl/scarif.space.crt
sudo docker-compose restart nginx
```
Provided that all went smoothly, you should do it all again if there are more major versions for nextcloud.
## Building the VM
Creating the virtual machine was easy. I decided to use debian as the OS (one of the suggested ones in the tutorial), using the [net iso](https://www.debian.org/distrib/netinst#verysmall).
> Make sure to give the VM ample storage as the nextcloud installation takes up 4GB!
@@ -434,34 +465,6 @@ Type=oneshot
ExecStart=/usr/bin/certbot renew --quiet --agree-tos --deploy-hook "docker exec scarif_nginx_1 nginx -s reload && cp /etc/letsencrypt/live/scarif.space/fullchain.pem /opt/ssl/scarif.space.crt && cp /etc/letsencrypt/live/scarif.space/private.pem /opt/ssl/scarif.space.key"
```
## Upgrading
### Linux
1. Remove zfs-linux `yay -Rns zfs-linux-lts`
2. Upgrade all packages `yay`
3. Clone the zfs-linux repository `git clone https://aur.archlinux.org/zfs-linux-lts.git`
4. Update the dependencies to match Linux version inside `PKGBUILD`
5. Install zfs-linux `cd zfs-linux-lts` `makepkg -si`
> You might need to make sure you have the correct `zfs-utils` installed.
### Docker Containers
Nextcloud is the annoying one here. Unless you want to take the risk, you need to upgrade to each major version, incrementally.
You can do this by changing the base image in the `nextcloud/DockerFile` file to `nextcloud:{version}-fpm-alpine`.
> You should upgrade to the latest minor version of the current major version first.
Once you have done that you can upgrade all the images:
```
sudo docker-compose pull # to upgrade the images
sudo docker-compose pull nextcloud:{version}-fpm-alpine # because docker-compose can't tell that it is used by the nextcloud image
sudo docker-compose down # to destroy all the existing containers
sudo docker-compose up --force-recreate --build -d # to rebuild all the containers with the newest images
sudo docker-compose exec -u 1000 -it nextcloud php /var/www/html/occ upgrade -vvv # to run the upgrade script
sudo docker-compose exec -u 1000 -it nextcloud php /var/www/html/occ maintenance:mode --off # to turn the site back on
certbot certonly -d scarif.space,www.scarif.space,tower.scarif.space,labs.scarif.space,comms.scarif.space,office.scarif.space,rec.scarif.space,radio.scarif.space,intel.scarif.space --force-renewal
cp /etc/letsencrypt/live/scarif.space/privkey.pem /opt/ssl/scarif.space.key
cp /etc/letsencrypt/live/scarif.space/fullchain.pem /opt/ssl/scarif.space.crt
```
Provided that all went smoothly, you should do it all again if there are more major versions for nextcloud.
## Troubleshooting
- Sometimes the `bootstrap.sh` script would fail. This was because the system needed to be restarted after upgrading packages. Instead I separated out the `bootstrap.sh` file.
- Docker compose doesn't work? Make sure docker is running.