Self-hosted¶
A self-hosted plan runs Midair on your own servers. The Portal builds no machine for it. Each self-hosted instance gets one token. Your installation uses the token to ask the Portal for the newest stable release, to download that release, and to report that it runs.
You pay for a self-hosted plan as for any other plan. When the payment is made, the instance is ready at once, and the Portal sends you a message. There is no address, region or login to choose.
Some self-hosted plans are not on the Products screen. We start them for you: you get a message with a link to the payment page. Pay there, and the plan starts. The link works for 24 hours. If it stops working, ask us for a new one.
The Portal offers only releases that the team marked as stable. A newer release that is not marked yet is not offered.
Find the token¶
The token is made when the payment is made. To see it:
Press Products on the left side of the window.
Press the actions button of the self-hosted instance.
Press Show token. The row shows the token, with Copy, and the command that puts it into your installation.
Each instance has one token. To make a new one, press Replace token. The old token stops working immediately, and the installation cannot download releases or report until you give it the new token. Replace the token when other people can know it.
Put the token into your installation¶
Run this command one time on the server, in the directory of the installation scripts, before you deploy:
./configure.sh --portal-token <token>
The token is kept where only the administrator of the server can read it. Nobody sees it in Midair. Midair then shows when a new stable release is available, with the notes for it, and updates to it when you press Update now. While the update installs, Midair stops for some minutes. It waits until no work runs in it before it stops.
Midair also reports to the Portal, so the instance shows as online on the Products screen.
Use the token¶
Send the token in the x-platform-token header.
To get the newest stable release:
curl -fsS -H 'x-platform-token: <token>' \
https://midair.dev/api/midair/release/latest
The answer gives the name of the release (version), its number, its size
and its SHA-256 checksum.
To download the release:
curl -fsS -H 'x-platform-token: <token>' \
-o midair.tar.xz https://midair.dev/api/midair/release/download
Add ?file=asc to the address to download the signature of the release.
Make sure that the checksum of the file is the same as the checksum in the
answer.
To report that the installation runs:
curl -fsS -H 'x-platform-token: <token>' -X POST \
-d '{"version":"main-557"}' https://midair.dev/api/midair/telemetry
All fields of the report are optional. version is the release that runs.
install_id is a name of the installation that does not change. The answer
says, in next_in, how many seconds to wait before the next report.
The instance shows Online when the installation sent a request in the last 15 minutes. A request for the newest release also counts.
What the answer means¶
200 — the release, its file, or the report is accepted.
400 — the report is not JSON, or it is larger than 4 KiB.
401 — there is no token, or the token is wrong or replaced.
403 — the subscription does not run, or the installation asked too often.
404 — no release is offered now. Try again later.
An installation can ask for the newest release 120 times in one hour, download a release six times in one hour, and report 60 times in one hour.
One installation for each token¶
Midair asks the Portal to confirm its token when it starts, and then one time in each hour. The Portal signs its answer, and Midair checks the signature. Midair works for 48 hours after the last confirmed answer. Thus a short loss of the network does not stop it.
A token is for one installation. The first installation that asks the Portal to confirm the token becomes the installation of the token. The Portal does not confirm the token for a different installation. Midair then shows that the token is for another installation.
To move Midair to a different server, or to install it again:
Press Products on the left side of the window.
Press the actions button of the self-hosted instance.
Press Replace token.
Put the new token into the new installation. See Put the token into your installation.
The old token stops working at once, so the old installation stops at its next check. The new token is for the first installation that asks with it. You can also ask us to release the token from its installation.
When the subscription ends¶
When you cancel the plan, the token works until the end of the paid period. Then the token stops working, and your installation cannot download new releases.