diff --git a/Taskfile.yml b/Taskfile.yml index 678a709..bbdf391 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -17,6 +17,9 @@ vars: sh: git describe --tags --exact-match $(git rev-parse HEAD) 2> /dev/null || echo "dev-$(git rev-parse HEAD)" tasks: + ensure-pod: + desc: "Creates the pod if it doesn't already exist." + cmd: . ./pod.sh build: desc: "Builds images for one or more services. Include service names as a space-separated list." cmds: @@ -28,6 +31,7 @@ tasks: prefix: "build: {{ .CLI_ARGS }}" dir: services start: + deps: [ensure-pod] desc: "Starts one or more services. Include service names as a space-separated list." cmds: - for: { var: CLI_ARGS } diff --git a/apt.txt b/apt.txt new file mode 100644 index 0000000..5247d59 --- /dev/null +++ b/apt.txt @@ -0,0 +1 @@ +podman diff --git a/pod.sh b/pod.sh new file mode 100644 index 0000000..d8f0330 --- /dev/null +++ b/pod.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +podman pod exists services || true +test $? -eq 0 || podman pod create -p 8080:8080 -p 6881:6881/udp -p 6881:6881 -p 8112:8112 services diff --git a/provision.sh b/provision.sh new file mode 100644 index 0000000..8e17c5c --- /dev/null +++ b/provision.sh @@ -0,0 +1,7 @@ +#/bin/bash + +# Ensure that dependencies are up to date. +sudo apt update && sudo apt upgrade -y --autoremove + +# Ensure that critical dependencies are installed. +sudo apt install $(cat apt.txt) -y diff --git a/services/bastion/build.sh b/services/bastion/build.sh index 0123c23..c3135e1 100644 --- a/services/bastion/build.sh +++ b/services/bastion/build.sh @@ -2,4 +2,4 @@ source constants.sh -docker build -t $APP_IMAGE_NAME:$IMAGE_VERSION -f Dockerfile-bastion-app . +podman build -t $APP_IMAGE_NAME:$IMAGE_VERSION -f Dockerfile-bastion-app . diff --git a/services/bastion/constants.sh b/services/bastion/constants.sh index 6a11f1c..abae0df 100644 --- a/services/bastion/constants.sh +++ b/services/bastion/constants.sh @@ -3,4 +3,3 @@ export APP_NAME="bastion" export APP_CONTAINER_NAME=$APP_NAME-app export APP_IMAGE_NAME=$CONTAINER_NAME_PREFIX-$APP_CONTAINER_NAME -export NETWORK_NAME=$APP_NAME-local diff --git a/services/bastion/start.sh b/services/bastion/start.sh index 2d8f247..cb034e5 100644 --- a/services/bastion/start.sh +++ b/services/bastion/start.sh @@ -2,11 +2,9 @@ source constants.sh -docker network create $NETWORK_NAME || echo "Network $NETWORK_NAME already exists" - -docker run \ +podman run \ --detach \ - --network $NETWORK_NAME \ + --pod services \ --name $APP_CONTAINER_NAME \ --env-file $ENV_FILE_DIR/bastion.env \ $APP_IMAGE_NAME:$IMAGE_VERSION diff --git a/services/bastion/stop.sh b/services/bastion/stop.sh index 871ff06..78156cb 100644 --- a/services/bastion/stop.sh +++ b/services/bastion/stop.sh @@ -2,4 +2,4 @@ source constants.sh -docker rm -f $APP_CONTAINER_NAME +podman rm -f $APP_CONTAINER_NAME diff --git a/services/bitwarden/build.sh b/services/bitwarden/build.sh index de4d126..d3c3f02 100644 --- a/services/bitwarden/build.sh +++ b/services/bitwarden/build.sh @@ -2,5 +2,5 @@ source constants.sh -docker build -t $DB_IMAGE_NAME:$IMAGE_VERSION -f Dockerfile-bitwarden-db . -docker build -t $APP_IMAGE_NAME:$IMAGE_VERSION -f Dockerfile-bitwarden-app . +podman build -t $DB_IMAGE_NAME:$IMAGE_VERSION -f Dockerfile-bitwarden-db . +podman build -t $APP_IMAGE_NAME:$IMAGE_VERSION -f Dockerfile-bitwarden-app . diff --git a/services/bitwarden/constants.sh b/services/bitwarden/constants.sh index 2df6d9c..ba3d16e 100644 --- a/services/bitwarden/constants.sh +++ b/services/bitwarden/constants.sh @@ -5,4 +5,3 @@ export APP_CONTAINER_NAME=$APP_NAME-app export APP_IMAGE_NAME=$CONTAINER_NAME_PREFIX-$APP_CONTAINER_NAME export DB_CONTAINER_NAME=$APP_NAME-db export DB_IMAGE_NAME=$CONTAINER_NAME_PREFIX-$DB_CONTAINER_NAME -export NETWORK_NAME=$APP_NAME-local diff --git a/services/bitwarden/start.sh b/services/bitwarden/start.sh index a904191..02d5c04 100644 --- a/services/bitwarden/start.sh +++ b/services/bitwarden/start.sh @@ -2,22 +2,19 @@ source constants.sh -docker network create $NETWORK_NAME || echo "Network $NETWORK_NAME already exists" - -docker run \ +podman run \ --detach \ - --network $NETWORK_NAME \ + --pod services \ --name $DB_CONTAINER_NAME \ --env-file $ENV_FILE_DIR/bitwarden-db.env \ --mount type=bind,source=$APP_DATA_DIR/bitwarden/db,target=/var/lib/mysql \ $DB_IMAGE_NAME:$IMAGE_VERSION -docker run \ +podman run \ --detach \ - --network $NETWORK_NAME \ + --pod services \ --name $APP_CONTAINER_NAME \ --env-file $ENV_FILE_DIR/bitwarden-web.env \ - --publish 8080:8080 \ --mount type=bind,source=$APP_DATA_DIR/bitwarden/config,target=/etc/bitwarden \ --mount type=bind,source=$APP_DATA_DIR/bitwarden/logs,target=/var/log/bitwarden \ $APP_IMAGE_NAME:$IMAGE_VERSION diff --git a/services/bitwarden/stop.sh b/services/bitwarden/stop.sh index 62c5c50..ea7d565 100644 --- a/services/bitwarden/stop.sh +++ b/services/bitwarden/stop.sh @@ -2,5 +2,5 @@ source constants.sh -docker rm -f $APP_CONTAINER_NAME -docker rm -f $DB_CONTAINER_NAME +podman rm -f $APP_CONTAINER_NAME +podman rm -f $DB_CONTAINER_NAME diff --git a/services/bookstack/build.sh b/services/bookstack/build.sh index c53c7c9..cdce680 100644 --- a/services/bookstack/build.sh +++ b/services/bookstack/build.sh @@ -2,5 +2,5 @@ source constants.sh -docker build -t $DB_IMAGE_NAME:$IMAGE_VERSION -f Dockerfile-bookstack-db . -docker build -t $APP_IMAGE_NAME:$IMAGE_VERSION -f Dockerfile-bookstack-app . +podman build -t $DB_IMAGE_NAME:$IMAGE_VERSION -f Dockerfile-bookstack-db . +podman build -t $APP_IMAGE_NAME:$IMAGE_VERSION -f Dockerfile-bookstack-app . diff --git a/services/bookstack/constants.sh b/services/bookstack/constants.sh index 8c68636..01376f9 100644 --- a/services/bookstack/constants.sh +++ b/services/bookstack/constants.sh @@ -5,4 +5,3 @@ export APP_CONTAINER_NAME=$APP_NAME-app export APP_IMAGE_NAME=$CONTAINER_NAME_PREFIX-$APP_CONTAINER_NAME export DB_CONTAINER_NAME=$APP_NAME-db export DB_IMAGE_NAME=$CONTAINER_NAME_PREFIX-$DB_CONTAINER_NAME -export NETWORK_NAME=$APP_NAME-local diff --git a/services/bookstack/start.sh b/services/bookstack/start.sh index 86ebdd7..cca42fd 100644 --- a/services/bookstack/start.sh +++ b/services/bookstack/start.sh @@ -2,21 +2,19 @@ source constants.sh -docker network create $NETWORK_NAME || echo "Network $NETWORK_NAME already exists" - -docker run \ +podman run \ --detach \ - --network $NETWORK_NAME \ + --pod services \ --name $DB_CONTAINER_NAME \ --env-file $ENV_FILE_DIR/bookstack-db.env \ --mount type=bind,source=$APP_DATA_DIR/bookstack-db,target=/var/lib/mysql \ - $DB_IMAGE_NAME:$IMAGE_VERSION + mariadb:10.6 \ + --port 3307 -docker run \ +podman run \ --detach \ - --network $NETWORK_NAME \ + --pod services \ --name $APP_CONTAINER_NAME \ --env-file $ENV_FILE_DIR/bookstack-app.env \ - --publish 6875:80 \ --mount type=bind,source=$APP_DATA_DIR/bookstack-app,target=/config \ $APP_IMAGE_NAME:$IMAGE_VERSION diff --git a/services/bookstack/stop.sh b/services/bookstack/stop.sh index 62c5c50..ea7d565 100644 --- a/services/bookstack/stop.sh +++ b/services/bookstack/stop.sh @@ -2,5 +2,5 @@ source constants.sh -docker rm -f $APP_CONTAINER_NAME -docker rm -f $DB_CONTAINER_NAME +podman rm -f $APP_CONTAINER_NAME +podman rm -f $DB_CONTAINER_NAME diff --git a/services/deluge/build.sh b/services/deluge/build.sh index 0560945..d8fa3af 100644 --- a/services/deluge/build.sh +++ b/services/deluge/build.sh @@ -2,4 +2,4 @@ source constants.sh -docker build -t $APP_IMAGE_NAME:$IMAGE_VERSION -f Dockerfile-deluge-app . +podman build -t $APP_IMAGE_NAME:$IMAGE_VERSION -f Dockerfile-deluge-app . diff --git a/services/deluge/constants.sh b/services/deluge/constants.sh index e68981f..834c9b0 100644 --- a/services/deluge/constants.sh +++ b/services/deluge/constants.sh @@ -3,4 +3,3 @@ export APP_NAME="deluge" export APP_CONTAINER_NAME=$APP_NAME-app export APP_IMAGE_NAME=$CONTAINER_NAME_PREFIX-$APP_CONTAINER_NAME -export NETWORK_NAME=$APP_NAME-local diff --git a/services/deluge/start.sh b/services/deluge/start.sh index facfdea..6b834a6 100644 --- a/services/deluge/start.sh +++ b/services/deluge/start.sh @@ -2,16 +2,13 @@ source constants.sh -docker network create $NETWORK_NAME || echo "Network $NETWORK_NAME already exists" - -docker run \ +podman run \ --detach \ - --network $NETWORK_NAME \ + --pod services \ + -e PGUID=1000 \ + -e PGID=1000 \ --name $APP_CONTAINER_NAME \ --env-file $ENV_FILE_DIR/deluge.env \ - --publish 8112:8112 \ - --publish 6881:6881/udp \ - --publish 6881:6881/tcp \ --mount type=bind,source=$APP_DATA_DIR/deluge/config,target=/config \ --mount type=bind,source=$APP_DATA_DIR/deluge/downloads,target=/downloads \ --mount type=bind,source=$STORAGE_DIR,target=/complete \ diff --git a/services/deluge/stop.sh b/services/deluge/stop.sh index 871ff06..78156cb 100644 --- a/services/deluge/stop.sh +++ b/services/deluge/stop.sh @@ -2,4 +2,4 @@ source constants.sh -docker rm -f $APP_CONTAINER_NAME +podman rm -f $APP_CONTAINER_NAME diff --git a/services/plex/build.sh b/services/plex/build.sh index 5e39262..9dd46c7 100644 --- a/services/plex/build.sh +++ b/services/plex/build.sh @@ -2,4 +2,4 @@ source constants.sh -docker build -t $APP_IMAGE_NAME:$IMAGE_VERSION -f Dockerfile-plex-app . +podman build -t $APP_IMAGE_NAME:$IMAGE_VERSION -f Dockerfile-plex-app . diff --git a/services/plex/start.sh b/services/plex/start.sh index a623874..ba8a74f 100644 --- a/services/plex/start.sh +++ b/services/plex/start.sh @@ -2,11 +2,8 @@ source constants.sh -docker network create $NETWORK_NAME || echo "Network $NETWORK_NAME already exists" - -docker run \ +podman run \ --detach \ - --network $NETWORK_NAME \ --name $APP_CONTAINER_NAME \ --env-file $ENV_FILE_DIR/plex.env \ --publish 32401:32400 \ diff --git a/services/plex/stop.sh b/services/plex/stop.sh index 871ff06..78156cb 100644 --- a/services/plex/stop.sh +++ b/services/plex/stop.sh @@ -2,4 +2,4 @@ source constants.sh -docker rm -f $APP_CONTAINER_NAME +podman rm -f $APP_CONTAINER_NAME