[Tutorial] Pigallery2 From Zero To Hero #1098
bpatrik
started this conversation in
Show and tell
Replies: 1 comment
-
|
Thank you for posting that...I know it was a lot of work! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
How I deploy pigallery2
After my 2021 post #292 and my 2023 follow-up #738 on how I use the app, I decided to finally write down how I actually deploy pigallery2.
This is not meant to be the only way to run pigallery2, but rather the setup I personally trust and use in production.
In this post I’ll show how to deploy
pigallery2using:Prerequisites
Before starting, make sure you have:
A domain name you control
Example:
https://mypigallery2.comA server you can SSH into
I assume a Debian-based Linux machine (Ubuntu, Debian, etc.)
Docker installed
👉 https://docs.docker.com/install/
That’s it. Everything else will run inside containers.
Preparation
I like to keep all configuration files in one place so they’re easy to back up with a simple
cporrsync.Create a config directory in your home folder:
We’ll place all service configs under this directory.
Portainer
Official docs:
https://docs.portainer.io/start/install-ce/server/docker/linux#docker-compose
Portainer is a web-based Docker manager. It lets you:
If you don’t pay for Portainer, you need to start it manually. The easiest way is still Docker Compose.
Create the Portainer config
mkdir portainer cd portainerCreate a
docker-compose.yml:Start it, then open:
You should see the Portainer UI.
Nginx Proxy Manager (NPM)
Official guide:
https://nginxproxymanager.com/guide/
Why NPM?
In 2025, you should not expose any app to the internet without SSL.
And you should not trust any self-hosted app — including mine.
I trust nginx to:
Nginx Proxy Manager makes nginx usable without turning your life into a YAML nightmare.
(An alternative would be Traefik, but NPM is easier to reason about.)
Deploy NPM via Portainer
In Portainer, create a new stack and paste this compose file:
Replace
<user>with your Linux username.The
frontendDocker network is crucial.Every service you want to expose publicly must be on the same Docker network.
In my setup, this network is called
frontend. Use the same name everywhere.Deploy the stack.
Make sure ports
80,81, and443are free on the host.Pigallery2
Create the container
Go back to Portainer and create another stack with the following compose file:
Key points:
Deploy the stack.
Add pigallery2 to Nginx Proxy Manager
In NPM, add a new Proxy Host.
Advanced configuration
Paste the following into the Advanced tab:
Save the host.
NPM will automatically request SSL certificates.
Once finished, you should be able to access:
Authentik (optional, but recommended)
Official docs:
https://docs.goauthentik.io/install-config/install/docker-compose/
If you run multiple self-hosted services, you’ll eventually want single sign-on.
Authentik (or Authelia) solves this. Authentik is heavier, but it supports Google login and richer flows.
Since #1096, pigallery2 supports OpenID Connect, so Authentik integrates cleanly.
Deploy Authentik in Portainer
I strongly recommend grabbing the latest compose file from their docs, but for reference, here’s mine:
Don’t forget to define environment variables:
Configure Authentik
Create a new Application:
pigallery2Select provider:
Set callback URL:
Other settings:
Add Authentik to pigallery2
Finally, configure OIDC inside pigallery2:
At this point, pigallery2 will delegate authentication to Authentik.
Closing thoughts
This setup might look heavy at first, but it gives me:
If something breaks, I can tear everything down and rebuild it — which fits perfectly with pigallery2’s philosophy of DB as cache and disk as source of truth.
Hope this helps others running pigallery2 in the wild.
Beta Was this translation helpful? Give feedback.
All reactions