Upgrade from API Maker v3¶
API Maker v4 takes over a server of v3 in place : the same MongoDB and Redis with their data, the same secrets, the same license key, and your Git repositories pull into v4. Your APIs keep their URLs. Two ways to do it :
| Launchpad : V3 to V4 Migration | The install script | |
|---|---|---|
| Where you run it | The desktop app, over SSH | A terminal on the server |
| Checks the server first | yes, and says what blocks the move | no |
| Rolls back on failure | yes, the data of MongoDB included | no : keep a backup |
| Afterwards | The server is an environment of Launchpad : health, statistics, logs, terminals | A server like any other installed by the script |
Before you start¶
- Take a backup of the MongoDB of API Maker (
mongodump) and of/root/config/.env. The Launchpad page takes one itself ; the install script does not. - Try it on a copy first when the server is in production : a snapshot of the server, restored on a new one, is the simplest copy.
- Read the breaking changes of v4.0.0 : a few queries match differently (
nulland$likeon SQL and MongoDB), and a value starting with__:is no longer SQL. - A server which runs alone. The Launchpad page refuses a secondary server of v3, and a server whose Caddy spreads the requests over other servers, and says so.
With API Maker Launchpad¶
V3 to V4 Migration, in the sidebar of the Cloud mode of API Maker Launchpad, moves a server installed with the v3 install script.
- Check Pick the server, or add it with its SSH sign-in. The page reads it without changing anything : the version of v3 and what runs it (PM2 or systemd),
.env, MongoDB with its databases and size, Redis, Caddy, the license, the free disk space. What prevents the move is said, with what to do. - Destination Choose a project and an environment of Launchpad, new or empty, and the version of API Maker v4.
- Review Every step, the lines of
.envwhich change, the Caddyfile before and after, and the checks at the end. Confirm by typing the name of the server. - Watch it run The migration runs on the server itself : closing the app or losing the connection does not stop it, and the log follows live. Stop rolls back.
What the migration does, in order :
- Downloads API Maker v4 next to v3, checks it against npm and runs it once, while v3 keeps serving.
- Saves what v3 runs with (
.env, the Caddyfile, the services, the list of PM2) in/root/backups/api_maker_v3_to_v4/. - Stops v3, then saves the data of MongoDB with
mongodumpwhile nothing writes to it. - Keeps v3 in
/root/projects/sava_api_maker_v3, puts v4 in/root/projects/sava_api_makerwith thelicense.txtand the uploaded files of v3. - Writes
.envfor v4, runs v4 with systemd, and points Caddy at it : the same addresses and certificates. - Checks v4 the way your apps reach it : an API, the WebSockets and the admin panel, through Caddy.
When a step fails, or you press Stop, everything goes back as it was : Caddy, the services, the folders, .env, and the data of MongoDB when v4 had started. Then v3 starts again. The folder of v3 and the backup stay on the server until you delete them.
With the install script¶
On the server of v3, run the install command of v4 and answer no when it asks to re-install MongoDB and Redis.
- v4 takes the place of the service
api_maker_be, with the same MongoDB, Redis and secrets. The uploaded files and the license file are copied. - The folder of v3,
~/projects/sava_api_maker, is left as it was. - The service
api_maker_fegoes : API Maker serves the admin panel itself.
What changes for your apps¶
- WebSockets move to the port of the APIs : a client which reached
:38245directly connects to:38246. Behind Caddy, the addresses stay what they were. - The admin panel is served by API Maker on port
4626, or through Caddy as before. - Tokens of API users and of your users keep working : v4 reads the same secrets.
What changes for your code¶
- Packages. A sandbox of v4 has only the packages its account lists in Sandbox settings. The packages v3 had built in (
lodash,moment…) are added to the list of an account of v3 by the first start of v4. - Removed features. UI Maker, the API Maker store, third party APIs and notes are gone. A Git pull lists what it skipped ; the utility classes third party APIs brought stay in the account, with their packages.
- Queries.
nullinfindon SQL meansIS NULL,$likeon MongoDB is the pattern of SQL, and__:values are plain values : see the breaking changes. - Languages. Your TypeScript and JavaScript run as before. New code can be written in seven more languages.
After the move¶
- Open the admin panel and run the security report : it reads the hooks and groups of v3 and says where rows are open.
- Run your test cases, or call the APIs your apps use most.
- Go through Before you go live.
- Delete the folder of v3 and the backup once you are sure.