Josh Larson
Josh Larson
RRailway
Created by Josh Larson on 2/5/2024 in #✋|help
Sending Laravel logs to Railway's logger
Hey pals, trying to sort out how to actually get Laravel to send logs to Railway's console. I'm using the vanilla Nixpacks PHP/Laravel builder: https://github.com/railwayapp/nixpacks/blob/main/src/providers/php/mod.rs And I've set my logger.php config to use a stdout driver, which is a copy/paste of the stderr driver except with stdout swapped in: [ 'stdout' => [ 'driver' => 'monolog', 'handler' => StreamHandler::class, 'formatter' => env('LOG_STDERR_FORMATTER'), 'with' => [ 'stream' => 'php://stdout', ], 'ignore_exceptions' => false, ], ] I'm not seeing anything come through - only nginx logs. Any thoughts on how I could route these to the right place? Off-the-cuff thoughts: - Does php-fpm swallow these logs? Like, do they go into the ether? - Or is it possible to write to /dev/stdout from multiple processes like I'm trying to do? ☮️ 🙏
10 replies
RRailway
Created by Josh Larson on 10/9/2022 in #✋|help
Can I install `mysql-client` for a Laravel app without using a custom Dockerfile?
Pretty standard Laravel app without a Dockerfile, and I updated the build command to include php artisan db:migrate --force. Here's what I see in the build log:
#15 9.908 Creating migration table ...................................... 54.27ms DONE
#15 9.963
#15 9.971 INFO Loading stored database schemas.
#15 9.971
#15 9.971 database/schema/mysql-schema.dump ............................. 25.98ms FAIL
#15 10.05
#15 10.05 Symfony\Component\Process\Exception\ProcessFailedException
#15 10.05
#15 10.05 The command "mysql --user="${:LARAVEL_LOAD_USER}" --password="${:LARAVEL_LOAD_PASSWORD}" --host="${:LARAVEL_LOAD_HOST}" --port="${:LARAVEL_LOAD_PORT}" --database="${:LARAVEL_LOAD_DATABASE}" < "${:LARAVEL_LOAD_PATH}"" failed.
#15 10.05
#15 10.05 Exit Code: 127(Command not found)
#15 10.05
#15 10.05 Working directory: /app
#15 10.05
#15 10.05 Output:
#15 10.05 ================
#15 10.05
#15 10.05
#15 10.05 Error Output:
#15 10.05 ================
#15 10.05 sh: 1: mysql: not found
#15 9.908 Creating migration table ...................................... 54.27ms DONE
#15 9.963
#15 9.971 INFO Loading stored database schemas.
#15 9.971
#15 9.971 database/schema/mysql-schema.dump ............................. 25.98ms FAIL
#15 10.05
#15 10.05 Symfony\Component\Process\Exception\ProcessFailedException
#15 10.05
#15 10.05 The command "mysql --user="${:LARAVEL_LOAD_USER}" --password="${:LARAVEL_LOAD_PASSWORD}" --host="${:LARAVEL_LOAD_HOST}" --port="${:LARAVEL_LOAD_PORT}" --database="${:LARAVEL_LOAD_DATABASE}" < "${:LARAVEL_LOAD_PATH}"" failed.
#15 10.05
#15 10.05 Exit Code: 127(Command not found)
#15 10.05
#15 10.05 Working directory: /app
#15 10.05
#15 10.05 Output:
#15 10.05 ================
#15 10.05
#15 10.05
#15 10.05 Error Output:
#15 10.05 ================
#15 10.05 sh: 1: mysql: not found
I've also updated my NIXPACKS_PKGS to include libmysqlclient 🤔 Any thoughts?
5 replies