Adonis 5 is officially here! Here are some deployment tips

We’re super excited about Adonis 5 being official! :tada:

And now that it is official and now that we’ve been diving deeper into Adonis 5 deployments ourselves, we have uncovered a couple of things to be aware of. (we’ll make this a living post and will add more as we come across them)

Use Node v14 or newer

Adonis v5 will require Node versions 14 or newer.

Beware of type errors

Adonis disables breaking your development environment due to type errors. However, once you build your app during a production release, you may come across a deployment error.

If you come across errors in your local environment but, nothing seems to break, be sure to take another look as Adonis will keep the environment alive on your local for productivity, but it may cause an error during deployment when type errors are enforced.

To check for type errors on your local environment, run the following:

node ace build --production

Deployment web hooks for building assets

Our 'Build App` hook that we currently have for Adonis 5 apps will need to be changed around a bit to be more flexible.

We currently bundle ‘npm ci’ and linking to the .env file in the Build App step. However, with the new ways of doing things in Adonis 5, if you want to build other assets, such as frontend assets for instance, then you’d need to run this as a custom deployment hook prior to the Build App step.

If that is the case, you’d also need to run npm ci prior to your custom deployment hook. You can either incorporate that command into the same deployment hook. Or, even better, create a deployment hook specifically for npm ci.

If your command also requires access to the .env, you’d need to link the .env, run the command, and then remove the link to the .env.

For example:

cd {{ releasePath }}
ln -s {{ projectPath }}/.env
... your command here ...
rm .env

This inconvenience will only be temporary and we’ll improve these particular use cases as soon as we can.

2 Likes