79 lines
2.1 KiB
Bash
Executable File
79 lines
2.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
# to scan new files: k exec --stdin --tty nextcloud-POD -npew -- /bin/bash -c "/var/www/html/occ files:scan --path='/USER/files'"
|
|
|
|
up () {
|
|
loginctl enable-linger $USER
|
|
docker network create pew-net || true
|
|
|
|
# Exposed on port 80 in pew-net
|
|
# Must edit /var/www/html/config/config.php file after initial setup to change settings
|
|
docker run \
|
|
--detach \
|
|
--name nextcloud \
|
|
--restart unless-stopped \
|
|
--env OVERWRITEHOST=nc.seaturtle.pw \
|
|
--env OVERWRITEPROTOCOL=https \
|
|
--env MYSQL_DATABASE=nextcloud \
|
|
--env MYSQL_USER=nextcloud \
|
|
--env MYSQL_PASSWORD=nextcloud \
|
|
--env MYSQL_HOST=nextcloud-mariadb \
|
|
--env REDIS_HOST=nextcloud-redis \
|
|
--env REDIS_HOST_PASSWORD=nextcloud \
|
|
--volume /bigdata/k8s-config/nextcloud/data:/var/www/html:rw \
|
|
--network pew-net \
|
|
docker.io/nextcloud:20.0.1-apache
|
|
|
|
# Exposed on port 3306 in pew-net
|
|
docker run \
|
|
--detach \
|
|
--name nextcloud-mariadb \
|
|
--restart unless-stopped \
|
|
--env MYSQL_RANDOM_ROOT_PASSWORD=notnullvalue \
|
|
--env MYSQL_PASSWORD=nextcloud \
|
|
--env MYSQL_DATABASE=nextcloud \
|
|
--env MYSQL_USER=nextcloud \
|
|
--volume /bigdata/k8s-config/nextcloud/mariadb:/var/lib/mysql:rw \
|
|
--network pew-net \
|
|
docker.io/mariadb:10.5.6
|
|
|
|
# Exposed on port 6379 in pew-net
|
|
docker run \
|
|
--detach \
|
|
--name nextcloud-redis \
|
|
--restart unless-stopped \
|
|
--network pew-net \
|
|
docker.io/redis:6.0.9 --requirepass nextcloud
|
|
|
|
# Setup nextcloud cron and continuous scanning for new files
|
|
cp nextcloud-cron.service nextcloud-cron.timer $HOME/.config/systemd/user/
|
|
systemctl start --user nextcloud-cron.timer || systemctl restart --user nextcloud-cron.timer
|
|
systemctl enable --user nextcloud-cron.timer
|
|
|
|
}
|
|
|
|
down () {
|
|
docker stop nextcloud || true
|
|
docker rm nextcloud || true
|
|
docker stop nextcloud-mariadb || true
|
|
docker rm nextcloud-mariadb || true
|
|
docker stop nextcloud-redis || true
|
|
docker rm nextcloud-redis || true
|
|
}
|
|
|
|
logs () {
|
|
docker logs -f nextcloud
|
|
}
|
|
|
|
logsm () {
|
|
docker logs -f nextcloud-mariadb
|
|
}
|
|
|
|
logsr () {
|
|
docker logs -f nextcloud-redis
|
|
}
|
|
|
|
$@
|