Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

alexanderturinske
Copy link
Member

- 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
Copy link
Member

@richardxia richardxia left a 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
Copy link
Member

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.

Copy link
Member Author

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")
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

@richardxia richardxia left a 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!

@alexanderturinske alexanderturinske changed the title Allow access to rails tools from terminal Update README to explain how to run rails commands from the terminal Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants