Portainer Stacks Migration
Into
When I first started self-hosting, I did everything the “hard way”. With how many years ago that was I don’t even want to think about what that meant at the time.
At some point, in the last couple of years, I started to invest in some REAL, server hardware. After investing in that, I’ve been slowly ATTEMPTING to do things in a cleaner way.
For example, instead of installing every piece of software manually; using docker. Well honestly, I’m using Portainer but close enough.
The PROBLEM
I wouldn’t say it’s so much a problem, but I already host a Gitea instance on
Digital Ocean Linode (I haven’t used Digital Ocean in YEARS, no
idea why I started typing that or left it that way and just did a
strike-through)
Portainer supports running stacks from a git instance. So, in the spirit of trying to do things the “right” way. I’ve been moving my stacks to my Gitea instance.
The Repo is public and can be found HERE
At some point, I do plan on mirroring all my public repos (as of this writing the Portainer one is the only one) on GitHub.
7 Stacks or Less
I Started with 7 different stacks
- AAR
- Gluetun
- Homepage
- Jellyfin
- nginx-Proxy
- Qbit-Testing
- Watchtower
Before writing this I’d already moved Jellyfin to using git, and it seemed pretty easy.
I’d also uploaded the AAR_Stack to Gitea. Granted I KNEW I wanted to change that stack, so I haven’t switched deployment to it yet. As I’m writing this, I’m considering moving Jellyfin and MAYBE Plex into that stack as well though currently, Plex is just installed as a standard program on the same server.
2nd Utilized Stack
Moving Homepage seemed like the best step for the second stack going into git. It’s got a very short “compose” as seen below.
version: "3.3"
services:
homepage:
image: ghcr.io/gethomepage/homepage:latest
container_name: homepage
ports:
- 3000:3000
volumes:
- /home/nick/docker/homepage:/app/config # Make sure your local config directory exists
- /var/run/docker.sock:/var/run/docker.sock # (optional) For docker integrations
- /mnt:/mnt # Testing something
Having not utilized “repository” much in Portainer, I took the following screenshot so when I get around to adding the rest I know what the settings need to look like.
The rest
Moving the rest of my stacks to Gitea wasn’t difficult, add a new file to the repo, stop & delete the old stack, and redeploy using very similar settings to the above screenshot just subbing the file location.
The only caveat I ran into was “Secrets” i.e: password/API keys/etc.
I did notice a couple of different solutions, but have yet to settle on one. So even though I didn’t 100% accomplish what I’d hoped to I’m 1 step closer.