1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2026-05-16 09:21:12 +02:00

Add FAQ and extension documentation.

This commit is contained in:
Patrik J. Braun
2026-01-23 14:34:36 +01:00
parent cfb3d8713a
commit b689e4a4f9
4 changed files with 96 additions and 148 deletions
+2 -15
View File
@@ -1,16 +1,3 @@
# PiGallery2 Docker Contribution guide (draft)
# PiGallery2 Docker Contribution guide
Remember to update all the Dockerfiles.
## Linting
To quality check your dockerfile changes you can use hadolint:
1. Start the docker daemon if it's not already started: `sudo dockerd`
2. Change dir to the docker folder.
3. Run hadolint on the alpine dockerfile: `docker run --rm -i -v ./.config/hadolint.yml:/.config/hadolint.yaml hadolint/hadolint < ./alpine/Dockerfile.build`
4. Run hadolint on the debian-trixie dockerfile: `docker run --rm -i -v ./.config/hadolint.yml:/.config/hadolint.yaml hadolint/hadolint < ./debian-trixie/Dockerfile.build`
7. Run hadolint on the debian-trixie selfcontained dockerfile: `docker run --rm -i -v ./.config/hadolint.yml:/.config/hadolint.yaml hadolint/hadolint < ./debian-trixie/selfcontained/Dockerfile`
8. Fix errors and warnings or add them to ignore list of the [hadolint configuration file](./.config/hadolint.yml) if there is a good reason for that. Read more [here](https://github.com/hadolint/hadolint).
### Building the docker image locally
TBD
For information on how to contribute to the Docker configuration, please see the [documentation](https://bpatrik.github.io/pigallery2/development/docker-contributing/).
+3 -120
View File
@@ -1,123 +1,6 @@
# PiGallery2 docker installation [![Docker build](https://github.com/bpatrik/pigallery2/workflows/docker-buildx/badge.svg)](https://github.com/bpatrik/pigallery2/actions)
# PiGallery2 docker installation
You can use [docker](https://docs.docker.com/install/) to run PiGallery2. See all available docker tags [here](https://hub.docker.com/r/bpatrik/pigallery2/tags/).
available tags:
- `v*` (stable): built from the release with the same version name.
- `latest` (stable): same as the latest `v*`, built with debian buster
- `edge` : built from the current state of `master`. This might break from time to time.
You can use [docker](https://docs.docker.com/install/) to run PiGallery2.
**Note**: Some changes may require database reset or config changes, see [#317](https://github.com/bpatrik/pigallery2/issues/317) (If you want to reduce the frequency of those, use stable builds (`latest`)
We support multiple architectures, including `amd64`, `arm64v8`, `arm32v7` (deprecated [see](https://github.com/bpatrik/pigallery2/issues/1027)),
## 0. Install docker (recommended)
Official installation guide [here](https://docs.docker.com/install/),
but this will most likely do the trick ([source](https://dev.to/rohansawant/installing-docker-and-docker-compose-on-the-raspberry-pi-in-5-simple-steps-3mgl)):
```bash
curl -sSL https://get.docker.com | sh
```
## I. Docker compose
It is recommended to use [docker-compose](https://docs.docker.com/compose/) to run pigallery2.
### I.0 Install docker-compose
Official docker-compose installation guide [here](https://docs.docker.com/compose/install/),
but this will most likely do the trick ([source](https://dev.to/rohansawant/installing-docker-and-docker-compose-on-the-raspberry-pi-in-5-simple-steps-3mgl)):
Install dependencies:
```bash
sudo apt-get install libffi-dev libssl-dev
sudo apt-get install -y python python-pip
sudo apt-get remove python-configparser
```
Install docker-compose:
```bash
sudo pip install docker-compose
```
You can check if it was successful with `docker-compose --version`.
### I.1 get docker-compose.yml file
Download [docker-compose/default/docker-compose.yml](docker-compose/default/docker-compose.yml) and
[docker-compose/default/nginx.conf](docker-compose/default/nginx.conf).
Edit `docker-compose.yml` at the `# CHANGE ME` lines to point the volumes to the right `image` and `tmp` directories.
Edit `nginx.conf` at the `# CHANGE ME` lines by replacing `yourdomain.com` to you domain address.
**Note**: Do not change the `image` and the `tmp` path in the `config.json` or in the UI, only through the `volume` settings of the docker. See [here](https://github.com/bpatrik/pigallery2/issues/114#issuecomment-570006336) and [here](https://github.com/bpatrik/pigallery2/issues/119).
**Note:** We are using nginx as reverse proxy to handle https and do proper HTTP queuing, gzipping, etc. Full nginx-based docker-compose tutorial [here](https://www.domysee.com/blogposts/reverse-proxy-nginx-docker-compose).
**Note 2:** You can skip nginx, by using [docker-compose/pigallery2-only/docker-compose.yml](docker-compose/pigallery2-only/docker-compose.yml).
#### I.1.a get SSL certificate with certbot
Install certbot: https://certbot.eff.org/. (Certbot uses letsencrypt to get free certificate).
Then get your certificate:
```bash
certbot certonly --standalone -d yourdomain.com
```
**Note:** if you get an error like `Problem binding to port 80: Could not bind to IPv4 or IPv6.` THen a service is running on port 80. If it's a fresh raspberry install, it's potentially nginx, you can disable it with `sudo systemctl disable nginx` [details here](https://askubuntu.com/questions/177041/nginx-disable-autostart)
#### I.1.b start docker-compose
In the folder that has `docker-compose.yml`:
```bash
docker-compose up -d
```
`-d` runs it as a daemon. Remove it, so you will see the logs.
After the containers are up and running, you go to `yourdomain.com` and log in with user: `admin` pass: `admin` and set up the page in the settings.
Full list of configuration options are available at the [MANPAGE.md](../MANPAGE.md).
**Note:** `docker-compose.yml` contains `restart:always`, so the containers will be automatically started after reboot ([read more here](https://stackoverflow.com/questions/43671482/how-to-run-docker-compose-up-d-at-system-start-up)).
#### I.2 upgrade to newer version
```bash
docker-compose pull # get new version
docker-compose down # stop running container
docker system prune # from time to time its nice to clean up docker
docker-compose up -d # start containers
```
## II. Without docker-compose
If you want to run the container by yourself, here you go:
```bash
docker run \
-p 80:80 \
-e NODE_ENV=production \
-v <path to your config file folder>:/app/data/config \
-v <path to your db file folder>:/app/data/db \
-v <path to your images folder>:/app/data/images \
-v <path to your temp folder>:/app/data/tmp \
bpatrik/pigallery2:latest
```
After the container is up and running, you go to `http://localhost` and log in with user: `admin` pass: `admin` and set up the page in the settings.
**Note**: even with `memory` db, pigallery2 creates a db file for storing user credentials (if enabled), so mounting (with `-v`) the `/app/data/db` folder is recommended.
**Note2**: Do not change the `image` and the `tmp` path in the `config.json` or in the UI, only through the `volume` settings of the docker. See [here](https://github.com/bpatrik/pigallery2/issues/114#issuecomment-570006336) and [here](https://github.com/bpatrik/pigallery2/issues/119).
### II.a before v1.7.0
There was a breaking change in Docker files after v1.7.0. Use this to run earlier versions:
```bash
docker run \
-p 80:80 \
-e NODE_ENV=production \
-v <path to your config file folder>/config.json:/pigallery2-release/config.json \
-v <path to your db file folder>/sqlite.db:/pigallery2-release/sqlite.db \
-v <path to your images folder>:/pigallery2-release/demo/images \
-v <path to your temp folder>:/pigallery2-release/demo/TEMP \
bpatrik/pigallery2:1.7.0-stretch
```
Make sure that a file at `<path to your config file folder>/config.json` and `sqlite.db` files exists before running it.
You do not need the `<path to your db file folder>/sqlite.db` line if you don't use the sqlite database.
## Build the Docker image on your own
You can clone the repository and build the image, or you can just use the 'self-contained' Dockerfile: [debian-trixie/selfcontained/Dockerfile](debian-trixie/selfcontained/Dockerfile)
Note: 'self-contained' is not well tested, bug fix PRs are welcome.
For docker installation and usage, please see the [documentation](https://bpatrik.github.io/pigallery2/setup/docker/).
+14 -2
View File
@@ -5,12 +5,24 @@ Remember to update all the Dockerfiles.
## Linting
To quality check your Dockerfile changes, you can use hadolint:
1. Start the Docker daemon if it's not already started.
1. Start the Docker daemon if it's not already started: `sudo dockerd`
2. Change directory to the `docker/` folder.
3. Run hadolint on the Dockerfiles:
```bash
docker run --rm -i -v ./.config/hadolint.yml:/.config/hadolint.yaml hadolint/hadolint < ./alpine/Dockerfile.build
docker run --rm -i -v ./.config/hadolint.yml:/.config/hadolint.yaml hadolint/hadolint < ./debian-trixie/Dockerfile.build
docker run --rm -i -v ./.config/hadolint.yml:/.config/hadolint.yaml hadolint/hadolint < ./debian-trixie/selfcontained/Dockerfile
```
Fix errors and warnings or add them to the ignore list of the [hadolint configuration file](https://github.com/bpatrik/pigallery2/blob/master/docker/.config/hadolint.yml) if there is a good reason for that.
Fix errors and warnings or add them to the ignore list of the [hadolint configuration file](https://github.com/bpatrik/pigallery2/blob/master/docker/.config/hadolint.yml) if there is a good reason for that. Read more [here](https://github.com/hadolint/hadolint).
### Building the docker image locally (Docs are as-it-is, no further support provided for this)
Get the latest release from github (the source code is not enough, it needs to be built and packed, you can do that fropm source with `npm run create-release`)
```bash
wget https://github.com/bpatrik/pigallery2/releases/download/3.1.0/pigallery2-release.zip
unzip pigallery2-release.zip -d pigallery2
cd pigallery2
$ sudo docker build --progress=plain -t local-pg .
```
+77 -11
View File
@@ -2,10 +2,20 @@
[Docker](https://www.docker.com/) with [docker-compose](https://docs.docker.com/compose/) is the **official and recommended** way of installing and running PiGallery2.
You can use [docker](https://docs.docker.com/install/) to run PiGallery2. See all available docker tags [here](https://hub.docker.com/r/bpatrik/pigallery2/tags/).
available tags:
- `v*` (stable): built from the release with the same version name.
- `latest` (stable): same as the latest `v*`, built with debian buster.
- `edge` : built from the current state of `master`. This might break from time to time.
**Note**: Some changes may require database reset or config changes, see [#317](https://github.com/bpatrik/pigallery2/issues/317) (If you want to reduce the frequency of those, use stable builds (`latest`)
We support multiple architectures, including `amd64`, `arm64v8`, `arm32v7` (deprecated [see](https://github.com/bpatrik/pigallery2/issues/1027)).
It contains all necessary dependencies, auto-restarts on reboot, supports HTTPS, and is easy to upgrade.
## 0. Install Docker (recommended)
Official installation guide [here](https://docs.docker.com/install/), but this will most likely do the trick on a Raspberry Pi:
Official installation guide [here](https://docs.docker.com/install/), but this will most likely do the trick on a Raspberry Pi ([source](https://dev.to/rohansawant/installing-docker-and-docker-compose-on-the-raspberry-pi-in-5-simple-steps-3mgl)):
```bash
curl -sSL https://get.docker.com | sh
```
@@ -14,10 +24,15 @@ curl -sSL https://get.docker.com | sh
It is recommended to use [docker-compose](https://docs.docker.com/compose/) to run PiGallery2.
### I.0 Install Docker Compose
Official installation guide [here](https://docs.docker.com/compose/install/), or try this:
Official installation guide [here](https://docs.docker.com/compose/install/), or try this ([source](https://dev.to/rohansawant/installing-docker-and-docker-compose-on-the-raspberry-pi-in-5-simple-steps-3mgl)):
Install dependencies:
```bash
sudo apt-get install libffi-dev libssl-dev
sudo apt-get install -y python3 python3-pip
sudo apt-get remove python-configparser
```
Install docker-compose:
```bash
sudo pip3 install docker-compose
```
Check success with `docker-compose --version`.
@@ -26,34 +41,85 @@ Check success with `docker-compose --version`.
Download [docker-compose/default/docker-compose.yml](https://github.com/bpatrik/pigallery2/blob/master/docker/docker-compose/default/docker-compose.yml) and
[docker-compose/default/nginx.conf](https://github.com/bpatrik/pigallery2/blob/master/docker/docker-compose/default/nginx.conf).
Edit `docker-compose.yml` to point the volumes to your images and temp directories.
Edit `nginx.conf` to replace `yourdomain.com` with your domain address.
Edit `docker-compose.yml` at the `# CHANGE ME` lines to point the volumes to the right `image` and `tmp` directories.
Edit `nginx.conf` at the `# CHANGE ME` lines by replacing `yourdomain.com` with your domain address.
**Note**: Do not change the `image` and `tmp` paths in the `config.json` or UI; only use Docker `volume` settings.
**Note**: Do not change the `image` and `tmp` paths in the `config.json` or UI; only use Docker `volume` settings. See [here](https://github.com/bpatrik/pigallery2/issues/114#issuecomment-570006336) and [here](https://github.com/bpatrik/pigallery2/issues/119).
**Note:** We are using nginx as reverse proxy to handle https and do proper HTTP queuing, gzipping, etc. Full nginx-based docker-compose tutorial [here](https://www.domysee.com/blogposts/reverse-proxy-nginx-docker-compose).
**Note 2:** You can skip nginx, by using [docker-compose/pigallery2-only/docker-compose.yml](https://github.com/bpatrik/pigallery2/blob/master/docker/docker-compose/pigallery2-only/docker-compose.yml).
### I.1.a Get SSL Certificate with Certbot
Install Certbot: https://certbot.eff.org/.
Install Certbot: https://certbot.eff.org/. (Certbot uses letsencrypt to get free certificate).
Then get your certificate:
```bash
certbot certonly --standalone -d yourdomain.com
```
**Note:** if you get an error like `Problem binding to port 80: Could not bind to IPv4 or IPv6.` then a service is running on port 80. If it's a fresh raspberry install, it's potentially nginx, you can disable it with `sudo systemctl disable nginx` [details here](https://askubuntu.com/questions/177041/nginx-disable-autostart).
### I.1.b Start Docker Compose
In the folder that has `docker-compose.yml`:
```bash
docker-compose up -d
```
Go to `yourdomain.com` and log in with user: `admin` pass: `admin`.
`-d` runs it as a daemon. Remove it, so you will see the logs.
After the containers are up and running, go to `yourdomain.com` and log in with user: `admin` pass: `admin` and set up the page in the settings.
Full list of configuration options are available at the [MANPAGE.md](https://github.com/bpatrik/pigallery2/blob/master/MANPAGE.md).
**Note:** `docker-compose.yml` contains `restart:always`, so the containers will be automatically started after reboot ([read more here](https://stackoverflow.com/questions/43671482/how-to-run-docker-compose-up-d-at-system-start-up)).
### I.2 Upgrade to newer version
```bash
docker-compose pull # get new version
docker-compose down # stop running container
docker system prune # from time to time its nice to clean up docker
docker-compose up -d # start containers
```
## II. Without Docker Compose
If you want to run the container by yourself, here you go:
```bash
docker run \
-p 80:80 \
-e NODE_ENV=production \
-v <path to config>:/app/data/config \
-v <path to db>:/app/data/db \
-v <path to images>:/app/data/images \
-v <path to temp>:/app/data/tmp \
-v <path to your config file folder>:/app/data/config \
-v <path to your db file folder>:/app/data/db \
-v <path to your images folder>:/app/data/images \
-v <path to your temp folder>:/app/data/tmp \
bpatrik/pigallery2:latest
```
After the container is up and running, go to `http://localhost` and log in with user: `admin` pass: `admin` and set up the page in the settings.
**Note**: even with `memory` db, pigallery2 creates a db file for storing user credentials (if enabled), so mounting (with `-v`) the `/app/data/db` folder is recommended.
**Note 2**: Do not change the `image` and `tmp` paths in the `config.json` or UI; only use Docker `volume` settings. See [here](https://github.com/bpatrik/pigallery2/issues/114#issuecomment-570006336) and [here](https://github.com/bpatrik/pigallery2/issues/119).
### II.a before v1.7.0
There was a breaking change in Docker files after v1.7.0. Use this to run earlier versions:
```bash
docker run \
-p 80:80 \
-e NODE_ENV=production \
-v <path to your config file folder>/config.json:/pigallery2-release/config.json \
-v <path to your db file folder>/sqlite.db:/pigallery2-release/sqlite.db \
-v <path to your images folder>:/pigallery2-release/demo/images \
-v <path to your temp folder>:/pigallery2-release/demo/TEMP \
bpatrik/pigallery2:1.7.0-stretch
```
Make sure that a file at `<path to your config file folder>/config.json` and `sqlite.db` files exists before running it.
You do not need the `<path to your db file folder>/sqlite.db` line if you don't use the sqlite database.
## Build the Docker image on your own
You can clone the repository and build the image, or you can just use the 'self-contained' Dockerfile: [debian-trixie/selfcontained/Dockerfile](https://github.com/bpatrik/pigallery2/blob/master/docker/debian-trixie/selfcontained/Dockerfile)
Note: 'self-contained' is not well tested, bug fix PRs are welcome.
## Contributing to Docker
See the [Docker Contribution Guide](../development/docker-contributing.md).