deploying simple Rails app
arthurmaxwj
FREEOP

a year ago

I'm new to deploying stuff and wanted to deploy a small Rails app from my GitHub repo. Sadly it crashed because: "ArgumentError: Missing secret_key_base for 'production' environment, set this string with bin/rails credentials:edit (ArgumentError)"

I set it as variable in environment in Railway, but it didn't fix the issue. I deployed that same app on Render, and it works right away. Any ideas?

Here it says it should work from environment variable: https://blog.saeloun.com/2023/08/11/rails-7-1-store-secret-key-base-in-rails-config/

Solved

12 Replies

arthurmaxwj
FREEOP

a year ago

b40486fe-920f-4972-92d4-72d7cd0804aa


arthurmaxwj
FREEOP

a year ago

Ok it seems to have been fixed by using RAILSMASTERKEY instead. But as deployment succeeded, I have issue with running the website. It says 502 bad gateway when go to my domain.


arthurmaxwj
FREEOP

a year ago

My deploy command is bin/rails db:setup && bin/rails server -p 8080, and these are logs:


arthurmaxwj
FREEOP

a year ago

1350491810501366000
1350491811386232800


arthurmaxwj
FREEOP

a year ago

I don't see commands run on deploy, is there a way to see them? Maybe error occurred before reaching rails server.


arthurmaxwj
FREEOP

a year ago

Yes rails server alone works and shows error that no database exists.


arthurmaxwj
FREEOP

a year ago

Well I moved some of the commands to build, and I'm very confused, I don't know if my build command is running at all. Deploy cans tart rails s, but I don't see any errors for rails db:setup even tho it seems to crush my app.


arthurmaxwj
FREEOP

a year ago

Ohhh it was using Dockerfile commands only. Wow im new to this hah, im sorry for messy question.


arthurmaxwj
FREEOP

a year ago

Current issue is that it dies after 10 minutes.

1350516847203717000
1350516847480406000


arthurmaxwj
FREEOP

a year ago

The solution was to add this to the end of Gemfile. No idea why, but now process booting works.

CMD rm -f tmp/pids/[server.pid](server.pid) && ./bin/rails server -p 8080


adam
MODERATOR

a year ago

Glad to see you figured this out! Marking as solved


adam
MODERATOR

a year ago

!s


Status changed to Solved adam 11 months ago


Loading...