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 () {
|
2020-12-28 19:38:09 -05:00
|
|
|
loginctl enable-linger $USER
|
2020-12-26 23:16:52 -05:00
|
|
|
podman network create pew-net || true
|
|
|
|
|
|
|
|
# Exposed on port 80 in pew-net
|
2020-12-27 13:13:31 -05:00
|
|
|
# Must edit /var/www/html/config/config.php file after initial setup to change settings
|
2020-12-26 23:16:52 -05:00
|
|
|
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
|
|
|
|
|
2020-12-28 19:38:09 -05:00
|
|
|
podman generate systemd nextcloud --restart-policy=always --name > $HOME/.config/systemd/user/nextcloud.service
|
2020-12-26 23:16:52 -05:00
|
|
|
systemctl --user daemon-reload
|
2020-12-27 03:14:45 -05:00
|
|
|
systemctl start --user nextcloud || systemctl restart --user nextcloud
|
2020-12-26 23:16:52 -05:00
|
|
|
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
|
|
|
|
|
2020-12-28 19:38:09 -05:00
|
|
|
podman generate systemd nextcloud-mariadb --restart-policy=always --name > $HOME/.config/systemd/user/nextcloud-mariadb.service
|
2020-12-26 23:16:52 -05:00
|
|
|
systemctl --user daemon-reload
|
2020-12-27 03:14:45 -05:00
|
|
|
systemctl start --user nextcloud-mariadb || systemctl restart --user nextcloud-mariadb
|
2020-12-26 23:16:52 -05:00
|
|
|
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
|
|
|
|
|
2020-12-28 19:38:09 -05:00
|
|
|
podman generate systemd nextcloud-redis --restart-policy=always --name > $HOME/.config/systemd/user/nextcloud-redis.service
|
2020-12-26 23:16:52 -05:00
|
|
|
systemctl --user daemon-reload
|
2020-12-27 03:14:45 -05:00
|
|
|
systemctl start --user nextcloud-redis || systemctl restart --user nextcloud-redis
|
2020-12-26 23:16:52 -05:00
|
|
|
systemctl enable --user nextcloud-redis
|
|
|
|
|
2020-12-28 19:38:09 -05:00
|
|
|
cp nextcloud-cron.service nextcloud-cron.timer $HOME/.config/systemd/user/
|
2020-12-27 03:14:45 -05:00
|
|
|
systemctl start --user nextcloud-cron.timer || systemctl restart --user nextcloud-cron.timer
|
2020-12-26 23:16:52 -05:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
$@
|