├── logo.png ├── app ├── Dockerfile ├── 97-hostname └── 98-redis ├── balena.yml ├── docker-compose.yml └── README.md /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klutchell/balena-bookstack/HEAD/logo.png -------------------------------------------------------------------------------- /app/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM linuxserver/bookstack:v0.30.4-ls112 2 | 3 | COPY 98-redis 97-hostname /etc/cont-init.d/ 4 | 5 | RUN chmod 0755 /etc/cont-init.d/98-redis /etc/cont-init.d/97-hostname 6 | 7 | ENV DEVICE_HOSTNAME bookstack 8 | -------------------------------------------------------------------------------- /app/97-hostname: -------------------------------------------------------------------------------- 1 | #!/usr/bin/with-contenv bash 2 | 3 | # set a hostname for local discovery 4 | if [ -n "${DEVICE_HOSTNAME}" ] 5 | then 6 | curl -X PATCH --header "Content-Type:application/json" \ 7 | --data "{\"network\": {\"hostname\": \"${DEVICE_HOSTNAME}\"}}" \ 8 | "${BALENA_SUPERVISOR_ADDRESS}/v1/device/host-config?apikey=${BALENA_SUPERVISOR_API_KEY}" || true 9 | fi 10 | -------------------------------------------------------------------------------- /app/98-redis: -------------------------------------------------------------------------------- 1 | #!/usr/bin/with-contenv bash 2 | 3 | if [ -n "${CACHE_DRIVER}" ] 4 | then 5 | sed '/CACHE_DRIVER=/d' -i /config/www/.env 6 | echo "CACHE_DRIVER=${CACHE_DRIVER}" >> /config/www/.env 7 | fi 8 | 9 | if [ -n "${SESSION_DRIVER}" ] 10 | then 11 | sed '/SESSION_DRIVER=/d' -i /config/www/.env 12 | echo "SESSION_DRIVER=${SESSION_DRIVER}" >> /config/www/.env 13 | fi 14 | 15 | if [ -n "${REDIS_SERVERS}" ] 16 | then 17 | sed '/REDIS_SERVERS=/d' -i /config/www/.env 18 | echo "REDIS_SERVERS=${REDIS_SERVERS}" >> /config/www/.env 19 | fi 20 | -------------------------------------------------------------------------------- /balena.yml: -------------------------------------------------------------------------------- 1 | name: "BookStack" 2 | type: "sw.application" 3 | description: "BookStack is a simple and free, self-hosted, easy-to-use wiki platform for organising and storing information." 4 | fleetcta: Make a note 5 | post-provisioning: >- 6 | ## Usage instructions 7 | 8 | Once your device joins the fleet you'll need to allow some time for it to download the application and create the app database. 9 | 10 | When it's done you should be able to access the access the app at http://bookstack.local 11 | 12 | The default username is `admin@admin.com` with the password of `password`. 13 | 14 | Documentation for BookStack can be found at https://www.bookstackapp.com/docs/ 15 | assets: 16 | repository: 17 | type: "blob.asset" 18 | data: 19 | url: "https://github.com/klutchell/balena-bookstack" 20 | logo: 21 | type: "blob.asset" 22 | data: 23 | url: "https://raw.githubusercontent.com/klutchell/balena-bookstack/main/logo.png" 24 | data: 25 | applicationEnvironmentVariables: 26 | - APP_URL: 'http://bookstack.local' 27 | defaultDeviceType: "raspberrypi3" 28 | supportedDeviceTypes: 29 | - "raspberrypi3" 30 | - "raspberrypi3-64" 31 | - "raspberrypi4-64" 32 | - "fincm3" 33 | - "intel-nuc" 34 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "2.1" 2 | 3 | volumes: 4 | bookstack: 5 | mariadb: 6 | 7 | services: 8 | # https://hub.docker.com/r/linuxserver/bookstack/ 9 | bookstack: 10 | build: app 11 | environment: 12 | DB_HOST: mariadb 13 | DB_DATABASE: bookstack 14 | DB_USER: bookstack 15 | DB_PASS: bookstack 16 | CACHE_DRIVER: redis 17 | SESSION_DRIVER: redis 18 | REDIS_SERVERS: redis:6379:0 19 | APP_URL: http://bookstack.local 20 | ports: 21 | - 80:80/tcp 22 | volumes: 23 | - bookstack:/config 24 | depends_on: 25 | - mariadb 26 | - redis 27 | labels: 28 | io.balena.features.supervisor-api: 1 29 | 30 | # https://hub.docker.com/_/redis 31 | redis: 32 | image: redis:6.0.9-alpine 33 | 34 | # https://hub.docker.com/r/yobasystems/alpine-mariadb 35 | mariadb: 36 | image: yobasystems/alpine-mariadb 37 | volumes: 38 | - mariadb:/var/lib/mysql 39 | environment: 40 | MYSQL_DATABASE: bookstack 41 | MYSQL_USER: bookstack 42 | MYSQL_PASSWORD: bookstack 43 | MYSQL_ROOT_PASSWORD: balena 44 | # Repurpose the healthcheck cmd by having it export our database on a schedule. 45 | # Run the backup every 1 hour to a file called hourly-backup.sql. 46 | # How to restore: 47 | healthcheck: 48 | test: mysqldump -uroot -p$MYSQL_ROOT_PASSWORD --all-databases --result-file=/var/lib/mysql/hourly-backup.sql || exit 0 49 | interval: 1h 50 | timeout: 30s 51 | retries: 3 52 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # balena-bookstack 2 | 3 | [BookStack](https://www.bookstackapp.com) is a simple and free, self-hosted, easy-to-use wiki platform for organising and storing information. 4 | 5 | ## Getting Started 6 | 7 | You can one-click-deploy this project to balena using the button below: 8 | 9 | [![deploy with balena](https://balena.io/deploy.svg)](https://dashboard.balena-cloud.com/deploy?repoUrl=https://github.com/klutchell/balena-bookstack) 10 | 11 | ## Manual Deployment 12 | 13 | Alternatively, deployment can be carried out by manually creating a [balenaCloud account](https://dashboard.balena-cloud.com) and application, flashing a device, downloading the project, and pushing it via he [balena CLI](https://github.com/balena-io/balena-cli). 14 | 15 | ### Application Environment Variables 16 | 17 | Application envionment variables apply to all services within the application, and can be applied fleet-wide to apply to multiple devices. 18 | 19 | |Name|Example|Purpose| 20 | |---|---|---| 21 | |`TZ`|`America/Toronto`|(optional) inform services of the [timezone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) in your location| 22 | |`APP_URL`|`https://.balena-devices.com`|for specifying the url your application will be accessed on (required for correct operation of reverse proxy)| 23 | 24 | ## Usage 25 | 26 | Once your device joins the fleet you'll need to allow some time for it to download the application and create the app database. 27 | 28 | When it's done you should be able to access the access the app at . 29 | 30 | The default username is `admin@admin.com` with the password of `password`. 31 | 32 | Additional usage instructions for this image can be found here: . 33 | 34 | ### Extras 35 | 36 | Works well with the [duplicati block](https://github.com/klutchell/balenablocks-duplicati) to make encrypted snapshots offsite! 37 | 38 | Add the following services and volumes to the existing docker-compose file in this project. 39 | 40 | ```yaml 41 | services: 42 | duplicati: 43 | image: linuxserver/duplicati:latest 44 | environment: 45 | PUID: "0" 46 | PGID: "0" 47 | CLI_ARGS: --webservice-interface=any 48 | ports: 49 | - 8200:8200/tcp 50 | volumes: 51 | - duplicati:/config 52 | - bookstack:/source/bookstack 53 | - mariadb:/source/mariadb 54 | 55 | volumes: 56 | duplicati: 57 | ``` 58 | 59 | ## Contributing 60 | 61 | Please open an issue or submit a pull request with any features, fixes, or changes. 62 | --------------------------------------------------------------------------------