Connecting to rails console through Railway - ruby-on-rails

Hi I have a railway project set up which has a ruby on rails app running as one of its services.
When I try to run railway run rails db:seed, it throws an error that the executable is not found, which I assume means I need to connect to the service through the CLI first before running it, but I can't find any documentation on how to do that. Anyone knows how I can achieve this? Thanks!
Tried running railway run rails db:seed but got the error exec: "rails db:seed": executable file not found in $PATH.
Was expecting to connect to the rails instance of the service and be able to run rails commands.

Realised after looking at the logs they were looking for the executable so I just had to run railway run bin/rails db:seed and it worked.

Related

Loggin an Heroku app through heroku run rails console

I want to get more detailed logs of my company app.
To do this I have read I can use "heroku run rails console" command.
When I launch it pointing to my remote app, I get:
/bin/bash: rails: command not found
Do I need to install something on my remote app?
Thank you for the help

Run Ruby on Rails migrations on specific Google App Engine service

I've been working on a Ruby on Rails API and I'm using Google Cloud Platform, specifically Google App Engine, to deploy my app. I followed the instructions here. So far so good. My app was successfully deployed and I could successfully run the migrations. Let's call this environment production.
The thing is I need to deploy a sort of staging environment. For the moment I had to create another project to solve my problem and consider that as my staging environment. Now, I don't think this is necessary, actually seems to be redundant.
I've prepared another database my_app_db_staging. And I created a staging.yaml file stating to run as another instance with the service name staging. The service was successfully deployed. Where is the problem? Well, running the migration. I'm using the appengine gem. So, to run the migrations you're supposed to run:
bundle exec rake appengine:exec -- bundle exec rake db:migrate
But as the documentation states:
The appengine gem provides the Rake task appengine:exec to run a command against the most recent deployed version of your app in the production App Engine environment.
So, no clue on how to run the migrations against my recently created staging service.
I looked deeper into the appengine gem, and it has an option. It lacks more documentation so you don't have to waste time looking for an answer:
rake appengine:exec GAE_CONFIG=staging.yaml -- bundle exec rake db:migrate
The options can work together with GAE_SERVICE, but the yaml file has to have the same name, otherwise you'll get an error.

rails: heroku run console giving error "bash: console: command not found"

Using the cedar-14 stack on Heroku. Just noticed that I can no longer run heroku run console because I get the error:
bash: console: command not found
I can still get to the console by calling:
heroku run bundle exec rails console
But I'm wondering what might have caused this change. I only noticed the issue after several days of commits so I can pinpoint the issue.
You need to use
heroku run rails console
The Basics for Heroku are explained under Heroku Devcenter.
Try
heroku run /app/bin/rails console
I happened to see this problem for a preview apps. For regular apps heroku console works.
I run into the same problem but I have resolved it by removing heroku/metrics build pack.
I have followed the configuration given for Ruby Language Metrics https://devcenter.heroku.com/articles/language-runtime-metrics-ruby and then tried to run the command heroku run console and it was triggering command not found error then I have reverted my changes and it started working.
Hope this will be helpful!

Rails console into Docker on Heroku

I've got a Rails app on a Docker image deployed to Heroku using heroku docker:release. I normally use heroku run rails console to access the console, but I am getting bash: /app/user/bin/rails: Permission denied. How do I access the Rails console via the Heroku-CLI command line?
Try this
docker-compose run web rails c
heroku run bundle exec rails console

Heroku rails error trying to bring up console - sh: rails: not found

Trying to run the Heroku console but I am getting this following:
heroku run console
Running console attached to terminal... up, run.1
sh: console: not found
$ heroku run bash works but I seem to get a (green) bash prompt - "~ $" not a rails console! Can I get into the console from here?
fyi
git push heroku v311
Everything up-to-date
The first error is thrown simply because the console command doesn't exist. I personally have never meet a command called console in my life.
The syntax is heroku run the_command_i_want_to_run. For example: heroku run irb or heroku run bash.
The second error: There's no Rakefile in your project root. Since heroku run rails console say that Rails wasn't found, my guess is that your project wasn't (well) deployed.
Make sure you've done git push heroku.
You may also need to check the logs: heroku logs.
a guess:
heroku run rails console
If you're on the Bamboo stack (older stack than Cedar), try:
heroku run script/rails console
This works for me and is the command recommended in Heroku docs.
I got confused by this too.
It's just
$ heroku run console
Do this
heroku run -a my-app script/rails console
Reference: https://devcenter.heroku.com/articles/console-bamboo

Resources