this post was submitted on 04 Oct 2024
67 points (98.6% liked)

Selfhosted

40219 readers
1001 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS
 

I often see people mention the Portainer project and how it's useful, but I never hear any reason to use it other than as a more user friendly front end to service management.

So is there any particular feature or reason to use portainer over docker's CLI? Or is it simply a method of convenience?

This isn't only strictly for self hosting, but I figure people here would know better.

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 1 points 1 month ago (1 children)

What works for me:

Networks first in docker-compose

Gluetun first in Services, uses the network I set for it and the stack

Everything else goes below it, relying on the gluetun CONTAINER (I plan to have another stack running gluetun for other reasons so having it check the service is a no go for me) to be running in a HEALTHY state

All are set to restart: unless-stopped except gluetun, which is never

The expected behaviour is that containers will always wait for gluetun to report that it's healthy before trying again to restart. Should gluetun fail and crash for any reason it won't reboot and potentially fuck itself up harder, and no services will be able to start because it's not reporting healthy.

This works perfectly in portainer and should when running docker-compose up, but for me it took portainer to work. Saw someone somewhere mention it has some sort of priority handling override built into it that docker itself doesn't, meaning it's less likely to fuck that lind of thing up, but idk how true it is

I'll see if I can remember to snag a couple snips of my YAML to make it more clear

[–] [email protected] 1 points 1 month ago (1 children)

Awesome. Thank you so much. Saving this for when I get back into town. Gonna fuck around and find out Monday 💜🙏

[–] [email protected] 3 points 1 month ago* (last edited 1 month ago) (3 children)

Ok, had my wife send me the file from my network

networks:
  main-network:
    name: ${COMPOSE_PROJECT_NAME}
    attachable: true
    ipam:
      driver: default
      config:
        - subnet: configure
          ip_range: this
          gateway: yoself

services:
  # Gluetun - <https://github.com/qdm12/gluetun>
  gluetun:
    image: qmcgaw/gluetun
    container_name: gluetun
    networks:
      - main-network
    cap_add:
      - NET_ADMIN
    environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}
      - VPN_SERVICE_PROVIDER=custom
      - VPN_TYPE=wireguard
      - VPN_PORT_FORWARDING=true
      - VPN_PORT_FORWARDING_PROVIDER=protonvpn
      - WIREGUARD_ADDRESSES=use your own
      - WIREGUARD_ALLOWED_IPS=0.0.0.0/0
      - WIREGUARD_PRIVATE_KEY=nope
      - WIREGUARD_PUBLIC_KEY=69420
      - WIREGUARD_DNS=
      - VPN_ENDPOINT_PORT=
      - VPN_ENDPOINT_IP=
    volumes:
      - ${DOAPPDAT}/gluetun:/gluetun

I left in the wireguard stuff without my details because for me Gluetun refused to work when setting the exact same info to wg0.conf, so I define it in my compose

Then, services that rely on gluetun go below and look like:

# qBittorrent - <https://hub.docker.com/r/linuxserver/qbittorrent>
qbittorrent:
  container_name: qbittorrent
  network_mode: container:gluetun
  image: lscr.io/linuxserver/qbittorrent:latest
  depends_on:
    gluetun:
      condition: service_healthy
  restart: unless-stopped

Works perfectly when I run it through portainer

[–] [email protected] 4 points 1 month ago

Wow. What an awesome wife. I think I just discovered a new relationship goal.

[–] [email protected] 2 points 1 month ago* (last edited 1 month ago)

It worked. Muahaha it worked. Thank you so much. I still have so much to learn. But one click and repulled and redeployed. The only change I needed in my config was to add.

depends_on:
    gluetun:
      condition: service_healthy

Into each container that was controlled by gluetun

[–] [email protected] 1 points 1 month ago (1 children)

Thank you so much. 😊 I see a few things already worth changing in my file. You da best.

[–] [email protected] 2 points 1 month ago (1 children)

It took me too long to get everything working myself because people love to share shit exclusively in CLI format and look down at anyone who asks for YAML it seems, so I'm always glad to pass it on

(I can understand CLI, but the ADHD brain finds YAML much easier for documentation purposes and it surprises me how many people seem to disagree)

[–] [email protected] 1 points 1 month ago

Haha dude. ADHD brain over here agrees. I can use CLI also but prefer not too