From f38aa1b80c2438c97fdff23cd602e53caee467d6 Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Wed, 10 Apr 2024 23:55:32 -0400 Subject: [PATCH] feat: migrate from monorepo --- Dockerfile-bookstack-app | 1 + Dockerfile-bookstack-db | 1 + README.md | 43 ++++++++++++++++++++++++++++++++++++++++ build.sh | 6 ++++++ constants.sh | 7 +++++++ start.sh | 25 +++++++++++++++++++++++ stop.sh | 3 +++ 7 files changed, 86 insertions(+) create mode 100644 Dockerfile-bookstack-app create mode 100644 Dockerfile-bookstack-db create mode 100644 README.md create mode 100644 build.sh create mode 100644 constants.sh create mode 100755 start.sh create mode 100755 stop.sh diff --git a/Dockerfile-bookstack-app b/Dockerfile-bookstack-app new file mode 100644 index 0000000..f73e6f5 --- /dev/null +++ b/Dockerfile-bookstack-app @@ -0,0 +1 @@ +FROM linuxserver/bookstack:23.10.4 diff --git a/Dockerfile-bookstack-db b/Dockerfile-bookstack-db new file mode 100644 index 0000000..b4abaa0 --- /dev/null +++ b/Dockerfile-bookstack-db @@ -0,0 +1 @@ +FROM mariadb:10.6 diff --git a/README.md b/README.md new file mode 100644 index 0000000..2448c5a --- /dev/null +++ b/README.md @@ -0,0 +1,43 @@ +# Bookstack + +Sets up and manages a [Bookstack](https://www.bookstackapp.com/) instance. + +## Getting started + +- `start.sh` starts the database and application. +- `stop.sh` stops the database and application. +- `build.sh` builds images for the database and application and should be run _before_ starting anything. + +Any commitable constant can be defined in `constants.sh` and will be injected in all of the scripts above. + +__The `task` commands should be used to interact with the service.__ + +## Volumes + +This expects two volumes to exist at `$APP_DATA_DIR`: `bookstack-app` and `bookstack-db`. + +## Note on dotenv files + +dotenv files are expected to exist at `$ENV_FILE_DIR` under `bookstack-db.env` and `bookstack-app.env`. + +See reference: + +``` +# bookstack-db-env + +MARIADB_USER=... +MARIADB_PASSWORD=... +MARIADB_ROOT_PASSWORD=... +MARIADB_DATABASE=... +``` + +``` +# bookstack-app.env + +DB_PORT=... +DB_USER=... +DB_PASS=... +DB_DATABASE=... +DB_HOST=... +APP_URL=... +``` diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..cdce680 --- /dev/null +++ b/build.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +source constants.sh + +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/constants.sh b/constants.sh new file mode 100644 index 0000000..01376f9 --- /dev/null +++ b/constants.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +export APP_NAME="bookstack" +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 diff --git a/start.sh b/start.sh new file mode 100755 index 0000000..a70a7d2 --- /dev/null +++ b/start.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +source constants.sh + +podman pod create \ + -p 3010:80 \ + --replace \ + "bookstack" + +podman run \ + -d \ + --pod "bookstack" \ + --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 \ + mariadb:10.6 \ + --port 3307 + +podman run \ + -d \ + --pod "bookstack" \ + --name "$APP_CONTAINER_NAME" \ + --env-file "$ENV_FILE_DIR"/bookstack-app.env \ + --mount type=bind,source="$APP_DATA_DIR"/bookstack-app,target=/config \ + "$APP_IMAGE_NAME:$IMAGE_VERSION" diff --git a/stop.sh b/stop.sh new file mode 100755 index 0000000..3873df9 --- /dev/null +++ b/stop.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +podman pod stop "bookstack"