Services
Create a web service, static site, worker or cron job from a Git repository, follow its deploys, roll back, set variables and add your own domain.
A service is one app built from a Git repository. HF Deploy builds it in a container and puts it live without downtime: the new version starts next to the old one, and traffic moves only once it answers its health check.
Where: HF Deploy (https://dep.yourdomain.com) › Services
Kinds of service
| Kind | What it is | Address |
|---|---|---|
| Web service | Node.js, Python, PHP, Go, or your own Dockerfile, answering on $PORT (8080). |
<name>.<apps domain> |
| Static site | Plain HTML, or a React / Vue build. | <name>.<apps domain> |
| Worker | A program that keeps running: queues, bots. | none |
| Cron job | A program run on a schedule. | none |
| Database | See Databases. | internal only |
Create a service
- Click the tile of what you want to make (Web service, Static site, Worker or cron job).
- Repository: a name (it becomes your address), the repository's
https://address and branch. For a private repository add an access token; it is kept encrypted. - Build and start: click Detect. HF Deploy fetches the branch and fills in the language and the build and
start commands; change them if you need to. A web service also has a Health check path (
/by default). A cron job has a Schedule of five fields, for example0 2 * * *for every night at 02:00 (server time). - Environment: paste your
.envfile, and link a database if you have one. - Size: pick a size. Free sleeps when no one has visited for a while and wakes on the next request (the first visitor waits a few seconds). Paid sizes show their monthly price and are added to your card subscription.
- Click Create and deploy. The service opens and you can watch the build log live.
Tip: to deploy on every push, add the webhook from the service's Settings tab to your repository (content type
application/json, push and pull request events).
Deploys and roll back
The Deploys tab lists every build, newest first, with the commit, who pushed it and when. The one being built shows its log as it happens. A failed build or a version that does not pass its health check never goes live: the old version keeps serving and the reason is shown under the deploy.
To go back, click Roll back to this on an earlier deploy: its image is started again, nothing is rebuilt. Only the last few deploys keep their image (your host sets how many).
Deploy latest commit builds the head of the branch now; Restart starts the live version again.
The rows work with the keyboard: arrow keys move, Enter shows a deploy's log, the right-click menu (or Shift+F10) has the actions. In the services list Enter opens a service and Delete removes one.
Logs and runs
- Logs shows the last 200 lines your running app wrote, and follows them while Follow is on.
- A cron job has Runs instead: each run's exit code and output, and Run now to start one outside the schedule. A run is stopped after one hour.
Environment variables
Environment lists the names of your variables; values are kept encrypted and never shown again. Use Add for
one variable or Paste a .env file for many. PORT and HF_DEPLOY_URL (the service's address) are always set.
Changes take effect with the next deploy.
Your own domain
- Open the Domains tab and click Add domain.
- At your DNS provider add a
CNAMErecord to the service's address, or anArecord to the server's IP address (both are shown on the tab). - Once the domain points here it shows Active and gets its own HTTPS certificate. Until then it shows Waiting for DNS and is checked again every 10 minutes; Check again checks at once.
Settings and delete
Settings changes the repository, branch, commands, size, Auto deploy on push and Preview deploys for pull requests (each pull request gets its own address until it is closed). Changes take effect with the next deploy.
Delete service removes its containers, images, addresses and variables. Type the service's name to confirm.