Create a Hetzner server
How to create and configure a Hetzner Cloud server for /dev/push.
This guide walks through creating a Hetzner Cloud server ready for /dev/push installation.
Prerequisites
- A Hetzner Cloud account
- An API token (create one in the Hetzner Cloud Console under Security → API Tokens)
Using the provisioning script
The devpush-hetzner helper automates server creation with security hardening.
Requirements
- Python 3.10+
- SSH key (auto-detected or specify with
--pubkey)
Quick start
git clone https://github.com/hunvreus/devpush-hetzner.git
cd devpush-hetzner
python provision.py
You'll be prompted for your Hetzner API token if not set via HCLOUD_TOKEN.
Options
| Option | Description | Default |
|---|---|---|
--name |
Server name | devpush |
--type |
Server type | cpx31 |
--location |
Datacenter location | hil |
--image |
OS image | ubuntu-24.04 |
--user |
Remote username | Your local login |
--pubkey |
Path to SSH public key | Auto-detected |
--ssh-key-name |
Hetzner SSH key name/ID | |
--firewall |
Firewall ID to attach | |
--no-harden |
Skip security hardening | Hardened by default |
--token |
Hetzner API token | HCLOUD_TOKEN env |
--dry-run |
Preview without creating |
What it does
- Creates a server with your specified configuration
- Sets up a non-root sudo user
- Disables root and password SSH login
- Injects your SSH key
- Runs security hardening (UFW, fail2ban, unattended upgrades)
Manual setup
1. Create the server
- Log in to Hetzner Cloud Console
- Click Add Server
- Configure:
- Location: Choose based on your users (e.g.,
hilfor US,fsn1for EU) - Image: Ubuntu 24.04
- Type: CPX31 (4 vCPU, 8GB RAM) recommended
- SSH Key: Add your public key
- Name:
devpushor your preference
- Location: Choose based on your users (e.g.,
- Click Create & Buy Now
2. Connect and update
ssh root@YOUR_SERVER_IP
apt update && apt upgrade -y
3. Create a non-root user
adduser admin
usermod -aG sudo admin
Copy your SSH key to the new user:
mkdir -p /home/admin/.ssh
cp ~/.ssh/authorized_keys /home/admin/.ssh/
chown -R admin:admin /home/admin/.ssh
chmod 700 /home/admin/.ssh
chmod 600 /home/admin/.ssh/authorized_keys
4. Disable root login
Edit /etc/ssh/sshd_config:
PermitRootLogin no
PasswordAuthentication no
Restart SSH:
systemctl restart sshd
5. Set up firewall
ufw allow OpenSSH
ufw allow 80/tcp
ufw allow 443/tcp
ufw enable
6. Install fail2ban
apt install -y fail2ban
systemctl enable fail2ban
systemctl start fail2ban
7. Enable automatic updates
apt install -y unattended-upgrades
dpkg-reconfigure -plow unattended-upgrades
Next steps
Once your server is ready:
- Point your domain's DNS to the server IP
- Run the /dev/push installer:
curl -fsSL https://install.devpu.sh | sudo bash