SSH Access & Keys
Every Potions server is a real VPS on your own cloud account, and you get full SSH access to it. Potions provisions the server as root, then does its app and deployment work through a dedicated deploy user - and deploy is the same user you connect as. This page covers adding your key, connecting, and what you can do once you're in.
For one-off tasks like installing a PostgreSQL extension, inspecting the server, or running a psql session, SSH is there when you want it.
Add Your SSH Key
Potions installs your public key on every server automatically, but first it needs to know your key.
- Go to Account and find the SSH Keys section.
-
Paste your public key - the contents of a file like
~/.ssh/id_ed25519.pub(or~/.ssh/id_rsa.pub). It starts withssh-ed25519orssh-rsa. Never paste a private key. - Click Add SSH Key.
Potions syncs the key to all of your active servers, and any server you create later includes it. If you remove a key here, it's removed from all your active servers.
Don't have a key yet? Generate one with
ssh-keygen -t ed25519, then paste the contents of the.pubfile it creates.
Find Your Server's Address
Open the server in Potions and go to its Overview tab. There you'll find:
- IP Address - the address you connect to
-
Deploy Password - the password for the
deployuser (click the eye icon to reveal it). You'll need this for anysudocommand that requires a password.
Connect
With your key added and the IP in hand, connect as the deploy user:
ssh deploy@<your-server-ip>
Your apps and their releases live under /opt/potions/<app_name>/.
What You Can Do as deploy
The deploy user is intentionally scoped - it can run your apps and manage the database. In practice you can:
Run PostgreSQL as a superuser (no password needed)
deploy has passwordless sudo access to psql, pg_dump, and pg_restore as the postgres superuser:
# Open a superuser psql session against one of your app databases
# (your app's database name is on the app's Database tab, e.g. potions_myapp)
sudo -u postgres psql -d potions_<yourappname>
This is the path for tasks that need superuser, like enabling a third-party extension. See PostgreSQL Extensions.
Run other admin commands (with the Deploy Password)
deploy is in the sudo group, so commands like installing a system package or restarting a service work - they'll prompt for the Deploy Password from the Overview tab:
sudo apt-get update && sudo apt-get install -y <package>
sudo systemctl restart postgresql
Open an IEx console without SSH
If you just need an interactive session against a running app, you don't even need an SSH client. Each app has a built-in Console tab in Potions that opens a remote IEx session in your browser (it connects as deploy under the hood). Handy for running an Ecto query or calling a function on the live node.
Potions Key
Every server also carries a key that belongs to Potions, generated for that server and installed in two places:
-
/root/.ssh/authorized_keys- for admin tasks after provisioning -
/home/deploy/.ssh/authorized_keys- always the first line, ahead of your own keys
Root login is key-only, and password login is off for everyone. Potions uses root for a few admin tasks: package installs, sudo grant updates, cluster setup, and renames. Everything else, including deploys, runs as deploy.
Keep both copies in place. Without the root copy, deploys keep working but those admin tasks fail. Without the deploy copy, Potions can't manage the server at all.
If Potions Can't Connect
If you modified SSH access and Potions can no longer reach the server, check:
- The server is powered on and its IP matches the Overview tab.
-
Port 22 is open. Provisioning adds
ufw allow 22/tcp; restricting it to your own IP locks Potions out too. -
/etc/ssh/sshd_config.d/potions.confstill hasPermitRootLogin prohibit-passwordandAllowUsers deploy root, with nothing overriding them. -
The Potions key is in both
authorized_keysfiles. Copy it from Potions key on the server's Settings tab, or take the first line of/home/deploy/.ssh/authorized_keys. To put it back on root, connect asdeployand run (it asks for the Deploy Password):
head -n 1 /home/deploy/.ssh/authorized_keys | sudo tee -a /root/.ssh/authorized_keys
If the deploy copy is gone too, log in as root through your provider's web console and add the key from the Settings tab there.
Things to Know
-
PostgreSQL only listens on localhost. For security, the database doesn't accept remote connections - you can't point a GUI at it over the internet. Run
psqlon the server itself (via SSH), or use the database tools built into Potions (backups, import, reset). -
Potions needs root over SSH for a few admin tasks. See Potions Key before hardening SSH or editing
authorized_keyson the server. - Changes you make by hand aren't tracked by Potions. SSH is great for inspection and one-off tasks. For anything that should persist and be repeatable - environment variables, database setup, extensions - prefer the Potions UI or your app's migrations so it survives redeploys and rebuilds.