So im trying to deploy a rails site for a college project but i keep getting hit with a error and it sends me to a server 500 page. When i run my app localy on my laptop it works fine. is there anything im missing or any fixes for this ?
Yeah, you need to either create a database or run migrations. This is a good starting place: Running Tasks & Consoles · Fly Docs
Most likely you are using sqlite3 and your migrations are being run during the release step instead of as a prerequisite of the server step. Modify lib/tasks/fly.rake
to move the db:migrate
dependency.
Thank you for this. I ran the db migrate for fly and it is now working
Thanks for the suggestion
Hello, i have the same problem and i don’t know how to solve, can you please explain how to modify the fly.rake file?
Thanks!
Before:
task :release => 'db:migrate'
task :server => :swapfile do
After:
task :release
task :server => [:swapfile, 'db:migrate'] do
Hello thank you very much for your reply, but i think now that my problem is not related.
I need to write temp files with File.write(“tmp/uploads/” + @file_name, @codice)
but i think there are problems with file permission… can you help?
2023-01-03T15:00:34Z app[16b03032] fra [info]I, [2023-01-03T15:00:34.674936 #532] INFO -- : [e80161b5-a131-49ae-b0cf-c7c96270ddcd] Completed 500 Internal Server Error in 1ms (Allocations: 336)
2023-01-03T15:00:34Z app[16b03032] fra [info]F, [2023-01-03T15:00:34.675403 #532] FATAL -- : [e80161b5-a131-49ae-b0cf-c7c96270ddcd]
2023-01-03T15:00:34Z app[16b03032] fra [info][e80161b5-a131-49ae-b0cf-c7c96270ddcd] Errno::ENOENT (No such file or directory @ rb_sysopen - tmp/uploads/f5948535-3820-4998-83b6-f51370559ba8.txt):
2023-01-03T15:00:34Z app[16b03032] fra [info][e80161b5-a131-49ae-b0cf-c7c96270ddcd]
2023-01-03T15:00:34Z app[16b03032] fra [info][e80161b5-a131-49ae-b0cf-c7c96270ddcd] app/controllers/form_controller.rb:16:in `write'
2023-01-03T15:00:34Z app[16b03032] fra [info][e80161b5-a131-49ae-b0cf-c7c96270ddcd] app/controllers/form_controller.rb:16:in `create'
Your .dockerignore
file includes tmp
. Easiest fix is probably to create tmp/uploads
in your Dockerfile:
Change:
RUN mkdir -p tmp/pids
To:
RUN mkdir -p tmp/pids tmp/uploads
Hello again, thank you very much, now it works
From How To to Build debugging