Another guide, this time to host gluetun
in a dokku
container,
so you can easily route individual dokku containers through a VPN!
Due to no clear documentation for this being available on the web,
I've decided to write out some of my own after finally succeeding with my own setup.
Following prerequisites fall out of the scope of this installation guide:
- Git
- Docker
- Dokku
- Linked domain name (e.g. my-dokku-server.com)
- SSL Certification (e.g. LetsEncrypt, Cloudflare, ...)
- Ledokku (Optional)
-
1.1. Create a
gluetun
dokku app:
(If usingledokku
, then use GUI instead, to create thegluetun
app!)dokku apps:create gluetun
-
1.2. Setup
volumes
to assure settings & storage will stick upon container re-creation:sudo mkdir -p /var/lib/dokku/data/storage/gluetun sudo chown dokku:dokku /var/lib/dokku/data/storage/gluetun/ dokku storage:mount gluetun /var/lib/dokku/data/storage/gluetun/:/gluetun
-
1.3. Configure the required environment variables, change as needed:
This is an example using Perfect Privacy as the VPN provider.
Check the required environment variables for your VPN provider at theSetup/Providers
section of the Gluetun Wiki!dokku config:set --no-restart gluetun \ VPN_SERVICE_PROVIDER="perfect privacy" \ OPENVPN_USER="username-here" \ OPENVPN_PASSWORD="password-here" \ SERVER_CITIES="Amsterdam,Basel,Belgrade,Berlin,Bucharest,Calais,Chicago,Copenhagen,Dallas,Erfurt,Frankfurt,Hamburg,Hongkong,Istanbul,Jerusalem,London,LosAngeles,Madrid,Malmoe,Manchester,Miami,Milan,Montreal,Moscow,NewYork,Nuremberg,Oslo,Paris,Prague,Reykjavik,Riga,Rotterdam,Singapore,Stockholm,Sydney,Tokyo,Vienna,Warsaw,Zurich" \ TZ="UTC"
-
1.4. Setup additional
deploy
andrun
docker-options
:# Allow modification of network interfaces on the host system: dokku docker-options:add gluetun deploy,run '--cap-add NET_ADMIN'
-
1.5. Disable the
web
and enable aworker
process:dokku ps:scale gluetun worker=1 web=0
-
1.6. Deploy the latest
gluetun
docker tag:dokku git:from-image gluetun qmcgaw/gluetun:latest
-
2.1. Create a
transmission
dokku app:
(If usingledokku
, then use GUI instead, to create thetransmission
app!)dokku apps:create transmission
-
2.2. Configure the required environment variables, change as needed or leave default:
dokku config:set --no-restart transmission \ USER="admin" \ PASS="password"
-
2.3. Glue
transmission
to thegluetun
network!dokku docker-options:add transmission deploy,run '--network=container:gluetun.worker.1'
-
2.4. Deploy the latest
transmission
docker tag:dokku git:from-image transmission lscr.io/linuxserver/transmission:latest
-
2.5. Validate if
transmission
is being routed through thegluetun
VPN connection:# Print out in which city the dokku host resides: curl -s ipinfo.io/json | grep city # Print out "in which city" the transmission container resides: dokku run transmission curl -s ipinfo.io/json | grep city
dokku ps:stop gluetun; sleep 2; docker pull qmcgaw/gluetun:latest; dokku ps:rebuild gluetun
If you're using fish
as your shell,
then you can add these fish-functions
to your ~/.config/fish/functions/
directory.
This will make following commands available under fish
,
to ease up the usage of gluetun
with dokku
:
# Enable VPN for dokku app
dokku-app-vpn-enable <app-name>
# Disable VPN for dokku app
dokku-app-vpn-disable <app-name>
# Check current city of dokku app, requires curl + grep in container!
dokku-app-vpn-status <app-name>
# Updates Gluetun dokku app
dokku-update-gluetun