scripts/fogcutter/podman/nextcloud/nextcloud.sh

91 lines
2.9 KiB
Bash
Raw Normal View History

2020-12-26 23:16:52 -05:00
#!/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 paul
podman network create pew-net || true
# Exposed on port 80 in pew-net
# Must edit config.php file after initial setup to change settings
podman create \
--name nextcloud \
--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 \
nextcloud:20.0.1-apache
podman generate systemd nextcloud --restart-policy=always --name > ~/.config/systemd/user/nextcloud.service
systemctl --user daemon-reload
systemctl restart --user nextcloud || systemctl start --user nextcloud
systemctl enable --user nextcloud
# Exposed on port 3306 in pew-net
podman create \
--name nextcloud-mariadb \
--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 \
mariadb:10.5.6
podman generate systemd nextcloud-mariadb --restart-policy=always --name > ~/.config/systemd/user/nextcloud-mariadb.service
systemctl --user daemon-reload
systemctl restart --user nextcloud-mariadb || systemctl start --user nextcloud-mariadb
systemctl enable --user nextcloud-mariadb
# Exposed on port 6379 in pew-net
podman create \
--name nextcloud-redis \
--network pew-net \
redis:6.0.9 --requirepass nextcloud
podman generate systemd nextcloud-redis --restart-policy=always --name > ~/.config/systemd/user/nextcloud-redis.service
systemctl --user daemon-reload
systemctl restart --user nextcloud-redis || systemctl start --user nextcloud-redis
systemctl enable --user nextcloud-redis
cp nextcloud-cron.service nextcloud-cron.timer ~/.config/systemd/user/
systemctl restart --user nextcloud-cron.timer || systemctl start --user nextcloud-cron.timer
systemctl enable --user nextcloud-cron.timer
}
down () {
systemctl stop --user nextcloud || true
systemctl disable --user nextcloud || true
podman rm nextcloud || true
systemctl stop --user nextcloud-mariadb || true
systemctl disable --user nextcloud-mariadb || true
podman rm nextcloud-mariadb || true
systemctl stop --user nextcloud-redis || true
systemctl disable --user nextcloud-redis || true
podman rm nextcloud-redis || true
systemctl stop --user nextcloud-cron.timer || true
systemctl disable --user nextcloud-cron.timer || true
}
logs () {
podman logs -f nextcloud
}
logsm () {
podman logs -f nextcloud-mariadb
}
logsr () {
podman logs -f nextcloud-redis
}
$@