R
Railway17mo ago
gerk

How does storage work inside railway?

I know it's ephemeral and it gets deleted after the next build. Every time I fetch a log file created from laravel it spits out a file not found error. is there a special path that I need to navigate to get the logs?
Solution:
Update: this seems to fix the issue with cron logs not getting picked up by laravel while at the same time sharing this instace It seems like railway doesn't create the logs sub directory, it's getting saved inside the root of the storage path...
Jump to solution
16 Replies
Percy
Percy17mo ago
Project ID: N/A
gerk
gerkOP17mo ago
N/A
Adam
Adam17mo ago
The log files will be created wherever you specify that they should be. Storage in Railway is ephemeral, but Railway recently released volumes which are not.
gerk
gerkOP17mo ago
Laravel storage_path() saves the log files inside /var/app/www/ (can't remember the full path, but you get the idea) but when fetching it, it returns a file not found error, by any chance is it because of permissions? Or are storages separated by instances? I have 2 instances running, 1 for CRON and the other for fetching the log file exclusively
Adam
Adam17mo ago
Services have separate storage
Brody
Brody17mo ago
for logs you will want to direct all logging to stdout and stderr
gerk
gerkOP17mo ago
someone stated at the laracast forum that inorder to use the scheduler, this should be ran php artisan schedule:run >> /dev/null 2>&1 But this doesn't seem to output anything, my env is set to stdout for logging Is it possible to add a project ID for this thread?
Brody
Brody17mo ago
little insider knowledge, us community members can't do anything with the project id, project Ids are only needed when there's an issue with the platform, so in your case no project id required
Solution
gerk
gerk17mo ago
Update: this seems to fix the issue with cron logs not getting picked up by laravel while at the same time sharing this instace It seems like railway doesn't create the logs sub directory, it's getting saved inside the root of the storage path
gerk
gerkOP17mo ago
How do I mark this thread as resolved?
Brody
Brody17mo ago
why are you returning logs through a php file? you should be sending logs to stdout and stderr so that you can view the logs in the railway ui
gerk
gerkOP17mo ago
Running php artisan schedule:run >> /dev/null 2>&1 only outputs what's running inside the log viewer but it doesn't include the command's outputs, I still have no clue how to output cron logs to stdout. running them using their respective command logs them to stdout and stderr though, problem with running them without the scheduler is that they overlap Running php artisan schedule:run >> /dev/null 2>&1 only outputs what's running inside the log viewer By this, I mean, it only outputs Schedule X has ran... bla bla bla to the log viewer
Brody
Brody17mo ago
aren't you directing the output to /dev/null ??
gerk
gerkOP17mo ago
tried running without /dev/null locally, still outputs the same thing, the command itself is outputting it to laravel.log or output.log in this case
Brody
Brody17mo ago
you'll need to find a way to redirect all logging to stdout
gerk
gerkOP17mo ago
I'll figure something out, right now I'm happy with the current result
Want results from more Discord servers?
Add your server