44 lines
1.2 KiB
Bash
44 lines
1.2 KiB
Bash
|
#!/usr/bin/env bash
|
||
|
|
||
|
# In this solution, 0 is used instead of N
|
||
|
|
||
|
# Create directories for volumes
|
||
|
mkdir -p ~/nextcloud0
|
||
|
mkdir -p ~/nextcloud0-db
|
||
|
|
||
|
# Create database container
|
||
|
podman create \
|
||
|
--name nextcloud0-db \
|
||
|
--network traefik \
|
||
|
-v ~/nextcloud0-db:/var/lib/postgresql/data:Z \
|
||
|
-e POSTGRES_DB=nextcloud \
|
||
|
-e POSTGRES_USER=nextcloud \
|
||
|
-e POSTGRES_PASSWORD=test \
|
||
|
--tz local \
|
||
|
--label "io.containers.autoupdate=registry" \
|
||
|
docker.io/library/postgres:alpine
|
||
|
|
||
|
# Create Nextcloud container
|
||
|
podman create \
|
||
|
--name nextcloud0 \
|
||
|
--network traefik \
|
||
|
-v ~/nextcloud0:/var/www/html:Z \
|
||
|
-e POSTGRES_DB=nextcloud \
|
||
|
-e POSTGRES_USER=nextcloud \
|
||
|
-e POSTGRES_PASSWORD=test \
|
||
|
-e POSTGRES_HOST=nextcloud0-db \
|
||
|
--tz local \
|
||
|
--label "io.containers.autoupdate=registry" \
|
||
|
docker.io/library/nextcloud:24-apache
|
||
|
|
||
|
|
||
|
# Change current directory to not have to move the systemd service files afterwards
|
||
|
cd ~/.config/systemd/user
|
||
|
# Generate systemd service files
|
||
|
podman generate systemd --new --files --name nextcloud0-db
|
||
|
podman generate systemd --new --files --name nextcloud0
|
||
|
|
||
|
# Enable and start the containers
|
||
|
systemctl --user enable --now container-nextcloud0-db
|
||
|
systemctl --user enable --now container-nextcloud0
|