Run It on Your Own Servers

Your GitHub repository, your Hetzner account, your domain. The jobs run in your repository and you pay us nothing for hosting.

On this page

You can run your app on a repository you own and servers you rent. You pay GitHub and Hetzner what they charge, and nothing to us for hosting. CodeMySpec stays the control plane: the Servers page still shows each environment, and you still provision, deploy and back up from it.

What you need#

  • A GitHub repository you own.
  • A Hetzner account and an API key from it.
  • A domain. The environments live at dev.yourdomain.com, uat.yourdomain.com and yourdomain.com. This path does not use a codemyspec.com address.

1. Install the GitHub App on your repository#

Install the CodeMySpec GitHub App and choose the repository. Nothing in CodeMySpec starts the install for you. If the App is missing when you provision, the run fails and the message gives you this link.

2. Set the repository and the domain#

On the project form, fill in “Code repo” and “Domain”. The domain is the bare one, like yourdomain.com. Without it the Servers page will not add a server of your own.

The first time you provision a server, the App commits our workflow files into your repository:

WorkflowWhat it does
provisionSets up a new server
deployShips a commit to an environment
backupBacks up an environment’s database
restoreRestores a backup
ciRuns mix test on every change

The jobs run in your repository, on GitHub’s runners. The files are yours to read and change.

3. Save your Hetzner key#

Open Integrations in your settings and find the Hetzner section. Paste the key into “Hetzner API key” and choose “Save Hetzner key”. We use it for two things: to create a server and to list the servers in your account.

4. Add a server#

On the Servers page, each environment has an “Add server” menu. Choose “New server in your Hetzner account”, or pick an existing one under “Your Hetzner servers”.

Do this once for each environment you want: dev, UAT and production.

5. Deploy keys#

Each environment gets its own deploy key. The private half is stored only as a secret in your repository. A server we create for a project on your own repository gets that key and no other.

If you made the server yourself, the Servers page shows the deploy key. Add it to root’s ~/.ssh/authorized_keys on that server.

6. Remove the Hetzner key#

Once your servers are linked, you can remove the key. On Integrations, choose “Remove Hetzner key”. You need it again only to create another server.

What stays with us#

The control plane. You see which environment serves which commit, start a deploy, ship UAT’s commit to production and take a backup from the same pages as a hosted project. The work itself runs in your repository’s jobs.

Stuck, or is this page wrong? Write to contact@codemyspec.com and a person answers.