5 months ago
I've been using Brodys suggested nixpack.toml () for my Laravel site over the past year, and I was wondering if there is a new method of doing this particular configuration now that Railpack is the default builder?
edit: and also the recommended nginx.template.conf () contains a section that I presume would need amending with Railpack? It's only referencing an environment variable so it's probably fine, but just mentioning it while I'm here.
$if(NIXPACKS_PHP_ROOT_DIR) (
root ${NIXPACKS_PHP_ROOT_DIR};
) else (
root /app;
)If it helps, those files were used due to the same issue in this thread:
Edit2: To clarify, I am currently having no issues with my project because it was last built with Nixpacks, but with the change to Railpack as the default builder I am just trying to get everything sorted before my next push 😄
Project ID: 76d66ac8-1aac-4c65-b59a-0e3423d45333
6 Replies
aleks
Could you send the nixpacks.toml content?
5 months ago
Ah for some reason the Central Station thread didn't correctly copy across my Discord message which included the link. Or the edits of the OP, I'll include them below.
The nixpack.toml https://gist.github.com/brody192/ed12b50fd39e373a28d75f25b100a87d
From original Discord message:
----
Also the recommended nginx.template.conf (https://gist.github.com/brody192/fcc1136b61c3de20609fa91ee384d47c) contains a section that I presume would need amending with Railpack? It's only referencing an environment variable so it's probably fine, but just mentioning it while I'm here.
```
$if(NIXPACKS_PHP_ROOT_DIR) (
root ${NIXPACKS_PHP_ROOT_DIR};
) else (
root /app;
)
```
If it helps, those files were used due to the same issue in this thread: https://station.railway.com/questions/increase-max-file-upload-with-php-nixpac-8e47f9b1
----
Bump
Just checking in to see if anyone has a Railpack config to handle the previous nixpack.toml config (hopefully the code copies across to the Station thread):
[variables]
UPLOAD_MAX_FILESIZE = '100M'
POST_MAX_SIZE = '100M'
[phases.setup]
cmds = ['UPLOAD_INI_PATH=$(find /nix/store/*-php-*/lib -name php.ini -print0 | head -z -n 1 | rev | cut -c 9- | rev)/upload.ini; echo "upload_max_filesize=${UPLOAD_MAX_FILESIZE};" >> $UPLOAD_INI_PATH; echo "post_max_size=${POST_MAX_SIZE};" >> $UPLOAD_INI_PATH']Looking into it further, I think the Railpack php.ini defaults should be fine (it sets those values to 0), and likely wouldn't need a custom railpack.json to set the deploy variables either I am assuming.
I also have a nginx.template.conf file (default version here: https://github.com/railwayapp/nixpacks/blob/main/src/providers/php/nginx.template.conf ), which I had customised with adding client_max_body_size 100M; to resolve some user upload issues.
This custom nginx.template.conf is copied to the assets directory via the [build-app.sh](build-app.sh) via cp nginx.template.conf /assets/
Followed by the [run-app.sh](run-app.sh) running the following:php artisan migrate --force && node /assets/scripts/prestart.mjs /assets/nginx.template.conf /nginx.conf && (php-fpm -y /assets/php-fpm.conf & nginx -c /nginx.conf)
Obviously a bit of a mess, but that's what was required to get uploads working correctly previously 😅
Does anyone know if any of this is still required with Railpack as the default builder?
p.s. Do any of the steps in the Set Up Database, Migrations, Crons and Workers section of the Laravel guide https://docs.railway.com/guides/laravel#set-up-database-migrations-crons-and-workers need to be adjusted for the new Railpack builder?