Replaced hardcoded container name through variable

This commit is contained in:
Kevin Veen-Birkenbach 2022-04-08 14:17:18 +02:00
parent 0974c1d6f2
commit 72556e6194

View File

@ -1,10 +1,18 @@
# role docker-nextcloud # role docker-nextcloud
## precondition
Before executing cli commands the following variable needs to be set:
```bash
NEXTCLOUD_APPLICATION_DOCKER_CONTAINER=nextcloud-application-1
```
## update ## update
To update the nextcloud container execute the following commands on the server: To update the nextcloud container execute the following commands on the server:
```bash ```bash
docker exec -it -u www-data nextcloud_application_1 /var/www/html/occ maintenance:mode --on docker exec -it -u www-data $NEXTCLOUD_APPLICATION_DOCKER_CONTAINER /var/www/html/occ maintenance:mode --on
sudo python /usr/local/bin/docker-volume-backup/docker-volume-backup.py sudo python /usr/local/bin/docker-volume-backup/docker-volume-backup.py
export COMPOSE_HTTP_TIMEOUT=600 export COMPOSE_HTTP_TIMEOUT=600
export DOCKER_CLIENT_TIMEOUT=600 export DOCKER_CLIENT_TIMEOUT=600
@ -20,27 +28,27 @@ Wait for the update to finish.
You can verify that the update is finished by checking the following logs: You can verify that the update is finished by checking the following logs:
```bash ```bash
docker logs nextcloud_application_1 docker logs $NEXTCLOUD_APPLICATION_DOCKER_CONTAINER
``` ```
and and
```bash ```bash
docker exec -it nextcloud_application_1 top docker exec -it $NEXTCLOUD_APPLICATION_DOCKER_CONTAINER top
``` ```
If nextcloud stays in the maintenance mode after the update try the following: If nextcloud stays in the maintenance mode after the update try the following:
```bash ```bash
docker exec -it -u www-data nextcloud_application_1 /var/www/html/occ maintenance:mode --on docker exec -it -u www-data $NEXTCLOUD_APPLICATION_DOCKER_CONTAINER /var/www/html/occ maintenance:mode --on
docker exec -it -u www-data nextcloud_application_1 /var/www/html/occ upgrade docker exec -it -u www-data $NEXTCLOUD_APPLICATION_DOCKER_CONTAINER /var/www/html/occ upgrade
docker exec -it -u www-data nextcloud_application_1 /var/www/html/occ maintenance:mode --off docker exec -it -u www-data $NEXTCLOUD_APPLICATION_DOCKER_CONTAINER /var/www/html/occ maintenance:mode --off
``` ```
If the update process fails execute If the update process fails execute
```bash ```bash
docker exec -it -u www-data nextcloud_application_1 /var/www/html/occ maintenance:repair docker exec -it -u www-data $NEXTCLOUD_APPLICATION_DOCKER_CONTAINER /var/www/html/occ maintenance:repair
``` ```
and disable the not functioning apps. and disable the not functioning apps.
@ -77,7 +85,7 @@ show processlist;
To use occ run: To use occ run:
```bash ```bash
docker exec -it -u www-data nextcloud_application_1 /var/www/html/occ docker exec -it -u www-data $NEXTCLOUD_APPLICATION_DOCKER_CONTAINER /var/www/html/occ
``` ```
## app relevant tables ## app relevant tables
@ -87,14 +95,14 @@ To use occ run:
### initialize duplicates ### initialize duplicates
```bash ```bash
sudo docker exec -it -u www-data nextcloud_application_1 /var/www/html/occ duplicates:find-all --output sudo docker exec -it -u www-data $NEXTCLOUD_APPLICATION_DOCKER_CONTAINER /var/www/html/occ duplicates:find-all --output
``` ```
### unlock files ### unlock files
```bash ```bash
docker exec -it -u www-data nextcloud_application_1 /var/www/html/occ maintenance:mode --on docker exec -it -u www-data $NEXTCLOUD_APPLICATION_DOCKER_CONTAINER /var/www/html/occ maintenance:mode --on
docker exec -it nextcloud_database_1 mysql -u nextcloud -pPASSWORD1234132 -D nextcloud -e "delete from oc_file_locks where 1" docker exec -it nextcloud_database_1 mysql -u nextcloud -pPASSWORD1234132 -D nextcloud -e "delete from oc_file_locks where 1"
docker exec -it -u www-data nextcloud_application_1 /var/www/html/occ maintenance:mode --off docker exec -it -u www-data $NEXTCLOUD_APPLICATION_DOCKER_CONTAINER /var/www/html/occ maintenance:mode --off
``` ```
## architecture ## architecture