New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Getting Start With Rails guide to account for Dev Containers #51637
Conversation
123fd7a
to
02f3c90
Compare
Thank you for making these changes @andrewn617 - I was also discussing this recently when going over the new upcoming tutorial. @Ridhwana will take a look at this on Wednesday (not possible to add you as a reviewer, so commenting instead). Marking this with rails-foundation tag to group current open To-Do's amongst the team. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @andrewn617 this looks really good and it's great to see installation instructions using Dev Container! I left some suggestions and feedback, let me know if anything is unclear.
guides/source/getting_started.md
Outdated
If it says something like "Rails 7.2.0", you are ready to continue. | ||
`rails-new` is a tool which can generate a new Rails application without needing | ||
Ruby or Rails installed on your machine. To install rails-new, follow the installation | ||
instructions [in the readme](https://github.com/rails/rails-new?tab=readme-ov-file#installation). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andrewn617 I was trying to install this locally to test out the instructions but I don't see any installation instructions in the readme for rails-new
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was chatting with Rafael about this today and it's next on my todo list. I'll have a PR open for it in the next 24 hours.
@Ridhwana Thank you for all your feedback! This is really helpful. I took most of your feedback. One thing I am a bit unsure about: in a few places I had something like "working with your application in a container" and you recommended changing it to "run your application in a container". I avoided using the word "running" here because it makes me think of running the server. But the dev container running and the application running (within the container) are different. I wonder how best to succinctly capture "the container is now running, it's a fully featured development environment from which you can edit code, run tests, boot up the console, or run the application server". Maybe I am overthinking it and for the audience of the guide this distinction isn't important 🤔 but I wanted to get your thoughts on it. I was trying to stick with saying things "working with your application within the container" or "developing within the container" but I admit the results are a bit awkward. |
Ah, thank you for this clarification! I think it's a valid concern especially when folks are new to all of these tools, I'll go back to where I suggested you change it and see if there's a different type of wording. |
02f3c90
to
e9fce40
Compare
@Ridhwana Okay, I have pushed a new version which covers all your comments. Take another look when you have a chance :) |
Thanks so much! I'll take a look tomorrow. Also, will you let me know once the installation instructions for rails-new are ready and then I'll test out the setup as well. |
e9fce40
to
d986266
Compare
d986266
to
4e3d2f7
Compare
@Ridhwana Heads up, based on feedback from the Rails Core team I have inverted my approach to updating the guides. I created a new guide called Getting Started with Dev Containers and linked to it from the original getting started guide. The content has stayed pretty much the exact same. Also I have a PR open with instructions for rails-new rails/rails-new#13 |
@andrewn617 I tried installing it based on your instructions but I may doing something wrong.
Maybe I'm missing something obvious? |
@Ridhwana Ah, sorry. You need to download the executable for your platform (eg rails-new-aarch64-apple-darwin.tar.gz for mac m1), not the source code. I'll update the rails new instructions to be more clear on that. |
Hey Andrew! Thanks for your guidance on this. I anticipate we might need to exchange a few messages as I work through the instructions to ensure everyone can smoothly install it without any hiccups. Here's my experience thus far: I grabbed the executable from this link for version Moving forward, I navigated to a different directory and executed To sidestep this roadblock temporarily and continue testing, I opted to override Gatekeeper using Afterwards, I retried Following that, I ensured my Docker engine was up and running, and then opened the folder in VSCode. However, I hit an issue. Here's a snapshot of the error message regarding .rbenv ruby version: Should this have been sorted out by Docker and Dev Containers, from my understanding of what we trying to achieve I should not have to install the rbenv version locally. |
Does this help? https://www.loom.com/share/5a0fe7ea1796498483592977531096e4?sid=3a2bea0b-2baa-460c-99bd-4c564869bf92 |
Oh! I see the issue. Rails 7.2 is not released yet but these instructions are written for that release 😅 So you need to add the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andrewn617 I managed to create a new application based on your instructions, thanks for help!
My final questions and thoughts on this review after testing are:
- Are we planning on waiting to merge this only after we release Rails 7.2 so that the instructions hold true or are we adding a disclaimer for versions earlier than 7.2?
- Are we also waiting for the latest release to be released https://github.com/rails/rails-new/releases/tag/latest before merging or do we have a different plan in place?
- What can we do about Gatekeeper that doesn't allow us to run the executable without overriding it?
- I dropped a comment about possibly mentioning what happens after opening up the blog application in DEV Container.
You can now continue with the [Getting Started guide](getting_started.md#hello-rails) and | ||
begin building your Blog application. You will be working within VSCode, which serves as | ||
your entry point to your application's Dev Container, where you can run code, run tests and | ||
run your application. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section in the Getting Started guide talks about starting up the web server on your development machine, I'm wondering do we need a mention here about what happens once you get you able to open your blog application within Dev Container? Things like how do you run your server and see your application?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, everything is the exact same. If you bin/rails s
within the container, it will boot the app and be accessible in your browser at http://127.0.0.1:3000
.
It's my first time contributing the guides, so my understanding might not be exactly right. But I believe once this merges, it will be on the "edge" guides, which are the guides for the latest main branch of Rails. Once Rails 7.2 those guides will be promoted to the official guides (which you can see now are for v7.1.3.2).
This will have an official release prior to 7.2
I believe Rafael is working on that. I will chat with him today about it I'll answer your other question in line =) |
Create a new guide called Getting Started with Dev Containers and link to it from the original Getting Started guide.
4e3d2f7
to
2bcdfd2
Compare
Sounds good, thanks @andrewn617! ✨ @AmandaPerino just a heads up that I've reviewed this, and the instructions have been tested too. These are some of the considerations that may want to be noted. |
@@ -0,0 +1,123 @@ | |||
**DO NOT READ THIS FILE ON GITHUB, GUIDES ARE PUBLISHED ON https://guides.rubyonrails.org.** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andrewn617 it just occurred to me that we need to wrap the file to 80 columns if you have not done that already.
Please exclude line 1 from this wrapping. Thanks!
Motivation / Background
In Rails 7.2, new apps will be generated with a Dev Container already set up. We also introduced the rails-new tool which allows an app to be generated a machine that does not have Rails, or even Ruby, installed.
This PR updates the Getting Started with Rails guide to account for rails-new and working with Dev Containers in VS Code.
Detail
I updated the "Installing Rails" section of this guide to instead give instructions for installing Docker, VScode and rails-new. The "Creating the Blog Application" has also been updated to show usage of
rails-new
instead of therails new
command. And, I added a section about opening the app in a dev container within VSCode.I moved the old section about installing rails and ruby locally to it's own guide, Installing Rails. That guide then links back to the getting started guide's "Hello, Rails!" section so someone reading that guide can continue with the getting started guide once they have Rails installed.
The other option was to keep both sets of instructions (rails local install vs. dev container), but I found it a bit awkward since the "Creating the Blog Application" is slightly different, and the instructions for opening the container need to come after that. So it was hard to structure it without introducing a bunch of duplication, or adding links between sections of the guide. So the separate guide for installing Rails seemed better, but I am open to feedback.
Additional information
Checklist
Before submitting the PR make sure the following are checked:
[Fix #issue-number]