Cannot run rails commands

Hi,

I’m new with waypoint.
I followed the tutorial to run, locally, the rails application example on docker. It started successfully.

Now I want to go deeper, and access the rails console :

pierre@PierreVBox:~/Projets/WayPoint/waypoint-examples/docker/ruby$ waypoint exec rails console
Connected to deployment v1

So it looks like nothing happens.
I’m running waypoint 0.1.5

Did I missed something ?

Regards,


Pierre Yager

I also tested

pierre@PierreVBox:~/Projets/WayPoint/waypoint-examples/docker/ruby$ waypoint exec bash
Connected to deployment v1
heroku@dc59568374ab:/$ bundle exec rails console
bash: bundle: command not found
heroku@dc59568374ab:/$ exit

I’m really wondering how to run rails commands inside my container

Hey there @zedalaye! Just to confirm, I think you might be running to a bug. I had an issue locally as well trying to test this out.

If you run the same command, but with some extra levels of verbosity, do you get the same output as me here? I tried the go example and the ruby example, but my output here is just from my attempt with the go example:

brian@localghost:go % waypoint exec -vvv /bin/bash                                                                                                                                                                                    ±[main]
2020-11-19T08:12:52.202-0800 [INFO]  waypoint: waypoint version: full_string="Waypoint v0.1.4-177-g531c3467 (531c3467)" version=v0.1.4-177-g531c3467 prerelease= metadata= revision=531c3467
2020-11-19T08:12:52.202-0800 [TRACE] waypoint: starting interrupt listener for context cancellation
2020-11-19T08:12:52.202-0800 [DEBUG] waypoint: home configuration directory: path=/home/brian/.config/waypoint
2020-11-19T08:12:52.202-0800 [TRACE] waypoint: interrupt listener goroutine started
2020-11-19T08:12:52.203-0800 [TRACE] waypoint: no API client provided, initializing connection if possible
2020-11-19T08:12:52.203-0800 [TRACE] waypoint.server: WithLocal set, server credentials optional
2020-11-19T08:12:52.203-0800 [INFO]  waypoint.server: attempting to source credentials and connect
2020-11-19T08:12:52.221-0800 [DEBUG] waypoint.server: connection established with sourced credentials
2020-11-19T08:12:52.221-0800 [TRACE] waypoint: requesting version info from server
2020-11-19T08:12:52.223-0800 [INFO]  waypoint: server version info: version=v0.1.5 api_min=1 api_current=1 entrypoint_min=1 entrypoint_current=1
2020-11-19T08:12:52.223-0800 [INFO]  waypoint: negotiated api version: version=1
2020-11-19T08:12:52.223-0800 [DEBUG] waypoint: will operate on app: name=example-go
Connected to deployment v1
2020-11-19T08:12:52.248-0800 [ERROR] waypoint: receive error: err=EOF
                                                                     2020-11-19T08:12:52.249-0800 [TRACE] waypoint: stopping signal listeners and cancelling the context

You’ll notice that after waypoint connects, it ends up exiting with an error. I imagine you are likely running into the same issue, but if you could confirm and share your logs, that would be great!

And if you have the same issue, please feel free to open an issue on GitHub so we can investigate. I’m currently looking into this, but tracking it on GitHub will be a good way to make sure we don’t lose it! Thank you.

Hi @zedalaye, did you build your app using the pack plugin?

If that is the case, I think the problem is that the PATH and GEM_PATH environment variables are not set.

I solved the problem, by adding the following to my waypoint.hcl

static_environment = {
  GEM_PATH = "/layers/heroku_ruby/gems/vendor/bundle/ruby/2.6.0"
  PATH = "bin:/layers/heroku_ruby/gems/vendor/bundle/ruby/2.6.0/bin:/usr/local/bin:/usr/bin:/bin"
}

EDIT: it is also worth noting that your app is deployed in /app, so you need to run

cd /app
bundle exec rails console
1 Like

@zedalaye Apologies, I was running waypoint off of the latest commit in main on github, and I believe I’ve run into a bug. This bug isn’t in 0.1.5, so sorry about that! It looks like the fix @tjaartvdwalt should get you what you need.

Thank you. I suspected a PATH/GEM_PATH problem. But this is still a bug, right ? These paths should have the right value ?

I stand to be corrected, but I don’t think this is a Waypoint issue, but rather an issue with the heroku ruby buildpack.