Deploy API Maker¶
- Install another version of API Maker on every server of the cluster from the Deploy API Maker page of the admin panel.
- This page upgrades API Maker itself. To deploy your APIs, use a Git pull. Learn more Git.
Two ways¶
- Deploy from NPM: pick a published version and click Deploy. Every server downloads the package of its own
machine (
@sava-info-systems/api-maker-engine-linux-x64or-linux-arm64) from the npm registry and checks its SHA-512 before anything is installed. A cluster of x64 and arm64 servers is upgraded in one go. - Upload a package: select the
.tgzof a version (the npm package of one machine), or the.tar.gzof a release, up to 512 MB, and click Upload. The page sends it in pieces of 4 MB, a request each, so a slow connection or a package of more than 100 MB is no problem; a piece whose request fails on the way is sent again. The pieces wait in the Redis of the installation for an hour, every server reads the package from there, and each one checks its SHA-256 before using it. A server of another machine refuses it.
What happens on each server¶
- The package is downloaded (its SHA-512 checked) or received (its SHA-256 checked).
- It is unpacked next to the running version, into
~/projects/api_maker/releases/<version>. - Its program is checked : built for this machine, and it starts (
api_maker_be --version). - The
currentlink moves to it, all at once. The 3 newest versions are kept, the older ones removed. -
systemd starts API Maker on the new version. A watchdog outside of API Maker waits for it to answer; when it does not answer within two and a half minutes,
currentgoes back to the version which ran before and that one is started again. The server which took the request from the page restarts last, once every server has answered, so the page gets the result of each server. -
.env,license.txt, the uploads and the logs are outside of the versions : nothing has to be kept aside. - The page shows a card per server and the live progress of each stage, then waits until every server answers on the new version and reloads.
- A server which fails keeps the version it runs, and the page says why : deploy again once the cause is gone.
Good to know¶
- The page works on servers installed by the installer of API Maker v4 and run by systemd. A server laid out otherwise refuses and is upgraded by running the installer again with the version.
- Versions of the Node.js edition (v1 to v3) are not deployed from here : the installer moves a server to v4.
- A deployment waits up to 20 minutes for the servers to finish.
- If the WebSocket connection of the page is down, the deployment keeps running and the page reports the result when it ends.