deploy first rails app
Is there a tutorial for deploying a new rails app? I've looked around and I don't see anything. I'm looking for a simple hello world rails app. The simpler the app the better.
What needs to happen for the db to work? Is there a way to connect to create a DB, and run migrations without too much fuss?
What needs to happen for the db to work? Is there a way to connect to create a DB, and run migrations without too much fuss?
72 Replies
Please provide your project ID or reply with
N/A
. Thread will automatically be closed if no reply is received within 10 minutes. You can copy your project's id by pressing Ctrl/Cmd + K -> Copy Project ID.Is there a tutorial for deploying a new rails app?If rails works with nixpacks it should be as simple as adding the repo as a new project and thats it.
What needs to happen for the db to work?What do you mean by this?
Is there a way to connect to create a DBHave you had a look around on the site and/or or docs yet? You can add a DB just like any other service with the + button within a project.
No project ID was provided. Closing thread.
Wow.. fast close.
There's nothing that I found that indicates how to connect a PG database to the app.
what do you mean?
How To Use PostgreSQL with Your Ruby on Rails Application on Ubuntu...
A PostgreSQL database is a robust and flexible choice for your Ruby on Rails application. In this tutorial, you will set up a Ruby on Rails development envirβ¦
Ah.. sorry.. I meant inside the app docs.
likely because its not any different to any other postgres db.
True.. setting up PG on a heroku deploy was zero steps.
Fly.io... zero steps
git push heroku master is zero steps. I've never had to change a thing.
I mean you click on a button to make the postgres, you copy details, profit?
Yep.. but no
zero tables.
this is sounding like a programming issue not a railway issue. I'd suggest reading up on how postgres works.
I mean all good I'm figuring out what's missing. Just not finding it in docs.
In heroku and fly.io we have to include a procfile. this tells the app to run migrations on deploy.
I don't see anything in the docs on railway.app that indicate how we run migrations..
I think the issue is that railway provides a managed db not a massive abstraction over them unlike the others https://fly.io/docs/postgres/getting-started/what-you-should-know/
https://guides.rubyonrails.org/active_record_postgresql.html This might help?
or https://guides.rubyonrails.org/v3.2/migrations.html
https://blog.railway.app/p/railway-heroku-rails
Right... but there's no mention of this in the "rails getting started" guide..
is that a railway docs or ?
Nope..
https://guides.rubyonrails.org/v3.2/migrations.html I mean it is on their site... πββοΈ
there is no "rails getting started" doc.
Ah.. I don't need to know how to migrate a db locally on heroku or on fly.io.
I'm not migrating from heroku to railsway.app, so why would i read about how to do that. What I am trying to figure out is, how do I "create new rails.... " to "here's my todo app" As I said.. I'll figure it out, but a "getting started" doc is needed. the "copy values" for the DB settings took me a few seconds of googling. It's not that it's hard.. it's that I didn't know I needed to do it.. And right now, I don't know how to run migrations. So I'll google around and eventually come to a "Oh here it is"..
I'm not migrating from heroku to railsway.app, so why would i read about how to do that. What I am trying to figure out is, how do I "create new rails.... " to "here's my todo app" As I said.. I'll figure it out, but a "getting started" doc is needed. the "copy values" for the DB settings took me a few seconds of googling. It's not that it's hard.. it's that I didn't know I needed to do it.. And right now, I don't know how to run migrations. So I'll google around and eventually come to a "Oh here it is"..
I mean the rails guide's second section is talking about migrations..
those are getting started with rails. Yes
But, they're not related to railway.app... There's no guide.
Question.. How do I run migrations in railway.app ?
I'm not new to rails. I'm new to railway.app
Is this chatgpt?
ha ha..
Rails for 10 years.
DevOps for 0 years. Railway.app for 10 minutes.
DevOps for 0 years. Railway.app for 10 minutes.
from what luna said, if rails is supported on nixpacks, just make a github repo with your app and then point railway to there when creating the project
after that it should deploy after you push into your repo
automatically
for the db i have no idea about rails, so i cannot help
It worked a treat.. but there was no mention of running migration.
I did manage to connect the app to the DB, but there are no tables there.
So the queries fall over.
yeah, the db is brand new
you need to create a table
Sure.. how? I mean with migrations. I can write the sql to create the tables, but that seems like a backwards way to use something rails has had for > 10 years.
i really do not get what the issue is, just query the db
The DB has no tables. Rails devs don't typically run raw sql.
but...
what do they run then
again i have no idea about rails
We use rails migrations to do it.
Ah.. coo
when you create atable in rails, you don't write the sql to do..
A tool generates the sql..
when you alter the table a took creates the sql to alter the table.
Over time you have dozens of little files that are call migrations.
a quick gogle search showed this to me
100%
That's it.. perfect.
dude it was the 2nd result on google
https://guides.rubyonrails.org/v3.2/migrations.html
like i said i think you may want to learn how rails migrations work.
or actually research it, googling is not hard at all, and if i, who know nothing about rails, could find the answer in a search, so can you :)
i also have never used rails. hence why i suggested using the guide they provide.
yeah, documentation is key, especially for something so broad
welp, glad its resolved now, thats what matters
Mate.. as i said.. it's not a problem with rails.. I can and do... but railway.app has nothing on how to run migrations. No rails dev would ever run sql directly. It's not safe.
yeah but the problem isn't on railway, a railway db is just like any other one and expects to be treated as such
its like if you hosted your db on a VPS
you need to learn how to use it
right.. so locally I install PG and then install rails.. then I run rails db:migrate. This spins up rails, connects with the db and runs the sql.
huh?
no!
the db is on there already
no need to make one of your own
bud.. go and read the rails guide.. it's the second chapter.
I don't have an issue with doing it on locally.. Ya'll not listening.
How do I get my rails app to run the migrations.
on railway.app.
that is a problem with rails, go look at rails docs
the platform of the db doesnt matter
literally the same way that if you used neon.tech, or ANY other way to host your database
Okay.. how about this.. How can I ssh into my app?
you cannot railway is not a VPS service but a container service. you should not be SSHing into containers.
this, if you want a vps railway is not your choice
you can use railway run to run scripts: https://docs.railway.app/develop/cli
just like every other db you would add the DATABASE_URL to your local project, you would then run the migrations.
or have them run when your app starts.
this is the same for all rails apps.
there.. there..
That's the answer.
man we've told you like 6 times
How do I have something run when my app starts?
if that's the answer its the same thing we've been saying since the start..
Not once, did you explain how to run something when the app starts.
you never asked that
you asked how to run migrations
I asked how to run migrations on railsway.app
yeah... the same way you do on all sites..
ok is there a language barrier here?
were going around in circles now
please read the docs. https://docs.railway.app/deploy/deployments#start-command
On other cites I add procfiles.
Could be language thing.
That's what I've been looking for π
That runs the migrations π
sure
ok, please, before asking people in the server, look at the docs 1st
it saves time for you and us
Tis still not a "rails getting started.". But once I suss it all out, I'll write one π
It's always the little unknowns that I don't know to ask.
Hey o.. Ya'll should have just said there's a rails template that can be imported and run. It's a fast way to get started. :). Templates. Woot