Skip to content

Files

Latest commit

f14dbfe · Sep 15, 2024

History

History
32 lines (20 loc) · 1.51 KB

README.md

File metadata and controls

32 lines (20 loc) · 1.51 KB

Laravel Coolify Example with Horizon

The magic comes from the nixpacks.toml file, which was based on the one provided by @marcfowler at coollabsio/coolify#2156.

Note: If you do not need horizon, then you may be able to further simplify this by using nixpacks.no-horizon.toml (renaming to nixpacks.toml) instead.

I've also added opcache, but to be honest am unsure if it's working (or needed here).

Steps

Step 1

Include the nixpacks.toml (or nixpacks.no-horizon.toml renamed to nixpacks.toml) in your root directory, then one of the following:

Step 2

The nixpacks has a [postbuild] step to handle the cache:clear and the artisan:migrate commands, but to get supervisor to run (so we get horizon), you can either override the default [start]'s cmd with the one provided by Nixpacks and add the command to start supervisor:

[start]
cmd = 'node /assets/scripts/prestart.mjs /assets/nginx.template.conf /nginx.conf && (supervisord -c /etc/supervisord.conf & php-fpm -y /assets/php-fpm.conf & nginx -c /nginx.conf)'

However, if Nixpacks change this command in the future (unsure how likely this is), this will not update.

Instead, we can do the following to run supervisor post-build:

Add the following to the post-deployment commands section of the project on Coolify dashboard:

supervisord -c /etc/supervisord.conf

Screenshot