How does custom hooks work ?

You can customize the deployment process with three hook files "setup.sh", "deploy.sh" and "pre_deploy.sh" located in a directory "artifakt" at the root of your code.

In case you defined in Artifakt a custom root code (e.g. /src/) so your hook file should be located in "/src/artifakt/deploy.sh".

These files are executed during different lifecycles of the application  : 

  • setup.sh : executed at instance startup (or when you start a setup job) - this is very useful to install additional packages on the server (run by root user),
  • pre_deploy.sh : executed just after the code is deployed in the new release (before running any custom deployment script for your application, run by webserver user),
  • deploy.sh : executed at the end of the deployment (after running any custom deployment script for your application, run by webserver user).

In these three files, you can access to any environment variables defined in Artifakt. 

For example, if you have defined a variable called CURRENT_ENV you can access to this variable using this code : $CURRENT_ENV.

Was this article helpful?
0 out of 0 found this helpful