-
Notifications
You must be signed in to change notification settings - Fork 24
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 README to explain how to run rails commands from the terminal #472
base: master
Are you sure you want to change the base?
Update README to explain how to run rails commands from the terminal #472
Conversation
- previously, one had to ssh into the docker container to track byebug or run the rails console - create a psudoterminal to the api docker container and allow input for it - update readme to explain how to run the rails console and byebug - https://stackoverflow.com/questions/31669226/rails-byebug-did-not-stop-application/32690885#32690885 - https://medium.com/@ddomachine/docker-and-ruby-on-rails-448ab8255f97
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.
Thanks for adding these! But I think we need to clarify a few of the things that were written down. Let me know if I'm not being clear in some of my comments.
```sh | ||
# Start both the DB and API | ||
$ cd PATH/TO/askdarcel-api | ||
$ docker-compose run --rm api rails console |
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.
While I think it's useful to have this here, I'm not sure whether it belongs under a section like this.
The general rule of thumb is for any command that you would normally native run, just prefix it with docker-compose run --rm api
.
Also, I wasn't exactly sure what you meant by "ssh into the containers". We don't literally SSH into the containers with ssh
, but the closest thing to that is executing a command within the container while attaching your terminal's stdin/stdout. But that is exactly what you are doing here with this command, which seems to conflict with the sentence you wrote at the beginning of the section.
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.
Good points. I have updated the wording to be, hopefully, correct and removed the contradictions.
I renamed the section to be Developer Tools
; do you think that is a better section have.
README.md
Outdated
#### Running byebug from the terminal | ||
```sh | ||
# Start both the DB and API | ||
$ docker attach $(docker ps -aqf "name=askdarcel-api_api") |
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.
It might be worth describing this in a lot more detail. For people who aren't familiar with byebug, this doesn't actually teach anyone how to start byebug. What this command really does is attach your TTY and stdin to an already running Docker container which is assumed to be running the Rails web server. The comment above this is actually incorrect; this command will fail if the API server is not already running.
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 have added more information; let me know if you want me to add more.
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.
LGTM! Thanks for making the updates!
track byebug or run the rails console
allow input for it
byebug