Rails/net-ssh - ssh to remote server with private key in Heroku - ruby-on-rails

I'm trying to ssh to a remote server using a private key through Heroku.
I'm using this gem https://github.com/net-ssh/net-ssh to complete the request and have everything working fine locally.
The reason why everything works fine locally is because I have the private key saved with the passphrase entered. When I deploy to Heroku, I'm unable to use the agent like I have it on my PC and so the connection fails.
I have changed the settings on the connection using net-ssh to not use the agent but still can't get it functioning.
Worst case I will have to create a separate API call in php hosted elsewhere to complete this connection but I'm hoping I can make it work through my rails app in Heroku.
This is what I'm currently doing:
options = {}
options[:key_data] = ENV['LANDING_PAGE_SSH_KEY']
options[:keys_only] = true
options[:use_agent] = false
options[:verbose] = :debug
options[:port] = '18765'
options[:passphrase] = ENV['SSH_KEY_PASSPHRASE']
Net::SSH.start(ENV['SERVER_HOSTNAME'], ENV['SERVER_USERNAME'], options) do |ssh|
end
I've entered the private key in a global variable and everything else that I would need. This also works locally without using the agent but fails on Heroku with this message:
[2017-07-21T19:20:35.506794 #4] DEBUG -- socket[383b2bc]: read 52 bytes
2017-07-21T19:20:35.507070+00:00 app[web.1]: D, [2017-07-21T19:20:35.507016 #4] DEBUG -- socket[383b2bc]: received packet nr 3 type 6 len 28
2017-07-21T19:20:35.507262+00:00 app[web.1]: D, [2017-07-21T19:20:35.507210 #4] DEBUG -- net.ssh.authentication.session[3fd3f610f914]: trying none
2017-07-21T19:20:35.507477+00:00 app[web.1]: D, [2017-07-21T19:20:35.507412 #4] DEBUG -- socket[383b2bc]: queueing packet nr 4 type 50 len 44
2017-07-21T19:20:35.507603+00:00 app[web.1]: D, [2017-07-21T19:20:35.507553 #4] DEBUG -- socket[383b2bc]: sent 68 bytes
2017-07-21T19:20:35.536336+00:00 app[web.1]: D, [2017-07-21T19:20:35.536194 #4] DEBUG -- socket[383b2bc]: read 52 bytes
2017-07-21T19:20:35.536472+00:00 app[web.1]: D, [2017-07-21T19:20:35.536422 #4] DEBUG -- socket[383b2bc]: received packet nr 4 type 51 len 28
2017-07-21T19:20:35.536573+00:00 app[web.1]: D, [2017-07-21T19:20:35.536526 #4] DEBUG -- net.ssh.authentication.session[3fd3f610f914]: allowed methods: publickey
2017-07-21T19:20:35.536657+00:00 app[web.1]: D, [2017-07-21T19:20:35.536612 #4] DEBUG -- net.ssh.authentication.methods.none[3fd3f6103e84]: none failed
2017-07-21T19:20:35.536749+00:00 app[web.1]: D, [2017-07-21T19:20:35.536703 #4] DEBUG -- net.ssh.authentication.session[3fd3f610f914]: trying publickey
2017-07-21T19:20:35.537566+00:00 app[web.1]: Enter passphrase for <key in memory>:Completed 500 Internal Server Error in 337ms (ActiveRecord: 1.4ms)
2017-07-21T19:20:35.538404+00:00 app[web.1]:
2017-07-21T19:20:35.538406+00:00 app[web.1]: Errno::ENOTTY (Inappropriate ioctl for device):
Any suggestions?

In my case I needed to add the private key to the server's ssh setup
ssh-add ~/.ssh/path-to-private-key
and it started working.

Related

rails-latex gem: ActionView::Template::Error (rails-latex failed ...) with Heroku

Rails Version: Rails 6.0.2.1
Ruby Version: ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]
When I try to generate a PDF with the gem rails-latex in Heroku, I get the following error: ActionView::Template::Error rails-latex failed (Full error message below).
This error does not arise locally.
What I tried
There is already a stackoverflow-question with the same problem: Debugging rails-latex gem on Heroku | ActionView::Template::Error rails-latex failed
#blackbrokkoli writes:
If you have a similar problem, I recommend deleting all tex
dependencies, get a MWE and then slowly add them back in to identify
the evildoers.
But I don't know what he means with "MWE" and I doubt that I am able to "identify the evildoers" by myself.
There is a thread called "Deploying on Heroku" suggesting that one needs to install a buildpack.
I tried to follow the instructions for the "Multipacks"-option.
The command cat .buildpacks returns
cat: .buildpacks: No such file or directory
The command heroku config:add BUILDPACK_URL=git://github.com/ddollar/heroku-buildpack-multi.git returns:
Setting BUILDPACK_URL and restarting
BUILDPACK_URL: git://github.com/ddollar/heroku-buildpack-multi.git
But after that, I don't know how to proceed further.
I tried to figure out how to add buildpacks with Heroku with the heroku buildpacks:add command. But I couldn't figure out, how I can add a third-party buildpack with this command.
Does anyone have any suggestions on how to fix this error?
Error message in heroku logs
2020-02-07T05:50:55.909360+00:00 app[web.1]: I, [2020-02-07T05:50:55.909264 #4] INFO -- : [1c4e2355-293c-4cb1-b591-b97e4ba4ecf3] Started GET "/articles/2.pdf" for 87.245.109.31 at 2020-
02-07 05:50:55 +0000
2020-02-07T05:50:55.910207+00:00 app[web.1]: I, [2020-02-07T05:50:55.910130 #4] INFO -- : [1c4e2355-293c-4cb1-b591-b97e4ba4ecf3] Processing by ArticlesController#show as PDF
2020-02-07T05:50:55.910257+00:00 app[web.1]: I, [2020-02-07T05:50:55.910202 #4] INFO -- : [1c4e2355-293c-4cb1-b591-b97e4ba4ecf3] Parameters: {"id"=>"2"}
2020-02-07T05:50:55.913042+00:00 app[web.1]: D, [2020-02-07T05:50:55.912964 #4] DEBUG -- : [1c4e2355-293c-4cb1-b591-b97e4ba4ecf3] Article Load (1.1ms) SELECT "articles".* FROM "articl
es" WHERE "articles"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]]
2020-02-07T05:50:55.914866+00:00 app[web.1]: I, [2020-02-07T05:50:55.914789 #4] INFO -- : [1c4e2355-293c-4cb1-b591-b97e4ba4ecf3] Rendering articles/show.pdf.erb within layouts/applica
tion
2020-02-07T05:50:55.915357+00:00 app[web.1]: I, [2020-02-07T05:50:55.915290 #4] INFO -- : [1c4e2355-293c-4cb1-b591-b97e4ba4ecf3] Rendered articles/show.pdf.erb within layouts/applicat
ion (Duration: 0.4ms | Allocations: 101)
2020-02-07T05:50:55.916214+00:00 app[web.1]: I, [2020-02-07T05:50:55.916141 #4] INFO -- : [1c4e2355-293c-4cb1-b591-b97e4ba4ecf3] Running 'pdflatex -halt-on-error -shell-escape -interact
ion=batchmode input' in /app/tmp/rails-latex/4-521112460259582216 1 times...
2020-02-07T05:50:55.923855+00:00 app[web.1]: I, [2020-02-07T05:50:55.923739 #4] INFO -- : [1c4e2355-293c-4cb1-b591-b97e4ba4ecf3] Running 'bibtex input' in /app/tmp/rails-latex/4-5211124
60259582216 1 times...
2020-02-07T05:50:55.929983+00:00 app[web.1]: I, [2020-02-07T05:50:55.929846 #4] INFO -- : [1c4e2355-293c-4cb1-b591-b97e4ba4ecf3] Running 'pdflatex -halt-on-error -shell-escape -interact
ion=batchmode input' in /app/tmp/rails-latex/4-521112460259582216 2 times...
2020-02-07T05:50:55.936216+00:00 app[web.1]: I, [2020-02-07T05:50:55.936104 #4] INFO -- : [1c4e2355-293c-4cb1-b591-b97e4ba4ecf3] Completed 500 Internal Server Error in 26ms (ActiveRecor
d: 1.1ms | Allocations: 1610)
2020-02-07T05:50:55.937843+00:00 app[web.1]: F, [2020-02-07T05:50:55.937756 #4] FATAL -- : [1c4e2355-293c-4cb1-b591-b97e4ba4ecf3]
2020-02-07T05:50:55.937845+00:00 app[web.1]: [1c4e2355-293c-4cb1-b591-b97e4ba4ecf3] ActionView::Template::Error (rails-latex failed: See /app/tmp/rails-latex/4-521112460259582216/input.l
og for details):
2020-02-07T05:50:55.937845+00:00 app[web.1]: [1c4e2355-293c-4cb1-b591-b97e4ba4ecf3] 15:
2020-02-07T05:50:55.937846+00:00 app[web.1]: [1c4e2355-293c-4cb1-b591-b97e4ba4ecf3] 16: \end{document}
2020-02-07T05:50:55.937846+00:00 app[web.1]: [1c4e2355-293c-4cb1-b591-b97e4ba4ecf3]
2020-02-07T05:50:55.937847+00:00 app[web.1]: [1c4e2355-293c-4cb1-b591-b97e4ba4ecf3] app/views/layouts/application.pdf.erbtex:18
#Syed Asim Hashmi suggested to use this command to install a third-party buildpack:
heroku buildpacks:add git://github.com/Thermondo/heroku-buildpack-tex.git#VERSION_NUMBER
This is what I get:
heroku buildpacks:add git://github.com/Thermondo/heroku-buildpack-te
x.git#VERSION_NUMBER
› Error: Could not find the buildpack:
› git://github.com/Thermondo/heroku-buildpack-tex.git#VERSION_NUMB
› ER. To specify a buildpack, please format it like the following:
› namespace/name (e.g. heroku/ruby). Also names can only contain
› letters, numbers, '_', and '-'.
I tried to add the buildpack via the settings on the heroku website:
I restarted heroku with heroku restart
but I receive the same error message.
rails-latex uses third-party buildpack
https://github.com/Thermondo/heroku-buildpack-tex
You can install it by running this command:
heroku buildpacks:add git://github.com/Thermondo/heroku-buildpack-tex.git#VERSION_NUMBER
Alternatively you can also add the above git repository into your buildpacks by going to your dyno settings.
One thing to keep in mind is that The Heroku filesystem is ephemeral -
that means that any changes to the filesystem whilst the dyno is
running only last until that dyno is shut down or restarted
You can find more information regarding third party buildpacks here
More information regarding heroku filesystem here
Hope it helps.

Rails 5 with Redis pubsub - after a while broadcast messages are not transmitted to clients

I'm facing a weird issue. I have created an ActionCable controller to allow simplistic chat rooms.
When everything works, log messages show the transmitting message upon calling broadcast_to.
2017-03-05T10:29:21.624294+00:00 app[web.1]: I, [2017-03-05T10:29:21.624222 #4] INFO -- : [ActionCable] [abfcd3d23b1f4b895ce06cad5df51b8c] Registered connection (abfcd3d23b1f4b895ce06cad5df51b8c)
2017-03-05T10:29:21.811899+00:00 app[web.1]: I, [2017-03-05T10:29:21.811815 #4] INFO -- : [ActionCable] [abfcd3d23b1f4b895ce06cad5df51b8c] ChatChannel is transmitting the subscription confirmation
2017-03-05T10:29:21.812216+00:00 app[web.1]: I, [2017-03-05T10:29:21.812170 #4] INFO -- : [ActionCable] [abfcd3d23b1f4b895ce06cad5df51b8c] ChatChannel is streaming from chat:room_6512bd43d9caa6e02c990b0a82652dca
2017-03-05T10:29:22.204456+00:00 app[web.1]: I, [2017-03-05T10:29:22.204364 #4] INFO -- : [ActionCable] [abfcd3d23b1f4b895ce06cad5df51b8c] ChatChannel#some_event
2017-03-05T10:29:22.204555+00:00 app[web.1]: I, [2017-03-05T10:29:22.204497 #4] INFO -- : [ActionCable] [abfcd3d23b1f4b895ce06cad5df51b8c] [ActionCable] Broadcasting to chat:room_6512bd43d9caa6e02c990b0a82652dca: {:type=>"some_event", :user=>"abfcd3d23b1f4b895ce06cad5df51b8c"}
2017-03-05T10:29:22.207224+00:00 app[web.1]: I, [2017-03-05T10:29:22.207164 #4] INFO -- : [ActionCable] [abfcd3d23b1f4b895ce06cad5df51b8c] ChatChannel transmitting {"type"=>"some_event", "user"=>"abfcd3d23b1f4b895ce06cad5df51b8c"} (via streamed from chat:room_6512bd43d9caa6e02c990b0a82652dca)
However when things stop working, the transmitting log message just stops showing
2017-03-05T09:29:20.534234+00:00 app[web.1]: I, [2017-03-05T09:29:20.534167 #4] INFO -- : [ActionCable] [b41c709c21deb8a2e9ae5f27b38d04b3] Registered connection (b41c709c21deb8a2e9ae5f27b38d04b3)
2017-03-05T09:29:20.747209+00:00 app[web.1]: I, [2017-03-05T09:29:20.747112 #4] INFO -- : [ActionCable] [b41c709c21deb8a2e9ae5f27b38d04b3] ChatChannel is transmitting the subscription confirmation
2017-03-05T09:29:20.747612+00:00 app[web.1]: I, [2017-03-05T09:29:20.747562 #4] INFO -- : [ActionCable] [b41c709c21deb8a2e9ae5f27b38d04b3] ChatChannel is streaming from chat:room_6512bd43d9caa6e02c990b0a82652dca
2017-03-05T09:29:20.934563+00:00 app[web.1]: I, [2017-03-05T09:29:20.934473 #4] INFO -- : [ActionCable] [b41c709c21deb8a2e9ae5f27b38d04b3] ChatChannel#some_event
2017-03-05T09:29:20.934684+00:00 app[web.1]: I, [2017-03-05T09:29:20.934626 #4] INFO -- : [ActionCable] [b41c709c21deb8a2e9ae5f27b38d04b3] [ActionCable] Broadcasting to chat:room_6512bd43d9caa6e02c990b0a82652dca: {:type=>"some_event", :user=>"b41c709c21deb8a2e9ae5f27b38d04b3"}
This is deployed on Heroku with Redis. When things stop working, doing heroku restart will fix everything and make things work again.
small update
When trying to do Redis.new.pubsub("numsub", "chat:room_6512bd43d9caa6e02c990b0a82652dca") when everything is working I get:
=> ["chat:room_6512bd43d9caa6e02c990b0a82652dca", 1]
when things stop working
=> ["chat:room_6512bd43d9caa6e02c990b0a82652dca", 0]
Any ideas?

Migrating from heroku to dokku (digital ocean)

I'm switching everything from heroku off and moving to digital ocean (cheaper and a static ip address!!)
I have searchbox on heroku. And i'll be needing something like this on digital ocean.
Currently i'm hitting an error making a request (still setup for heroku?) That looks like this
I, [2016-06-22T13:18:41.226034 #275] INFO -- : Started GET "/events_autocomplete?query=test" for 212.250.145.155 at 2016-06-22 13:18:41 +0000
I, [2016-06-22T13:18:41.253478 #275] INFO -- : Processing by EventsController#autocomplete as JSON
I, [2016-06-22T13:18:41.253665 #275] INFO -- : Parameters: {"query"=>"test"}
I, [2016-06-22T13:18:41.264460 #275] INFO -- : Completed 500 Internal Server Error in 11ms (Searchkick: 5.7ms | ActiveRecord: 0.0ms)
F, [2016-06-22T13:18:41.266812 #275] FATAL -- :
Faraday::ConnectionFailed (Connection refused - connect(2) for "localhost" port 9200):
app/controllers/events_controller.rb:61:in `autocomplete'
I, [2016-06-22T13:18:41.319310 #275] INFO -- : Started GET "/search_events?utf8=%E2%9C%93&search=test&commit=Search" for 212.250.145.155 at 2016-06-22 13:18:41 +0000
I, [2016-06-22T13:18:41.321272 #275] INFO -- : Processing by EventsController#search as HTML
I, [2016-06-22T13:18:41.321365 #275] INFO -- : Parameters: {"utf8"=>"✓", "search"=>"test", "commit"=>"Search"}
I, [2016-06-22T13:18:41.326730 #275] INFO -- : Completed 500 Internal Server Error in 5ms (ActiveRecord: 0.0ms)
F, [2016-06-22T13:18:41.328614 #275] FATAL -- :
Faraday::ConnectionFailed (Connection refused - connect(2) for "localhost" port 9200):
app/controllers/events_controller.rb:83:in `search'
I'm very new at this so any help would be much appreciated
Thanks
Sam
Edit
def search
#events = Event.where("event_type != 'festival' AND complete = true").page(params[:page]).per(10).search params[:search], suggest: true, misspellings: { distance: 1 }, order: { date: :asc, eventname: :asc }, match: :word_start
if #events.results.any?
render 'events/results'
else
render 'events/noresults'
end
end
You can use the official dokku-elasticsearch plugin to setup an ES instance and link it to your application. Once you do, ELASTICSEARCH_URL will be set for your app and as long as your code respects that, you should be good to go.

Heroku devise/facebook oauth glitch with identical source code

I try to solve problems myself, but this one has got the best of me and I'm on the verge of head-butting my desk.
Here's what I do:
I test the production oAuth, all works perfectly as it has for months
I use heroku git:clone -a myapp to get the source code locally
I make no changes whatsoever, I simply re-commit and push back up to Heroku
I test the production oAuth again, it doesn't work
I keep having to use heroku rollback, so that I can go back to the working version. I thought that since the source code is identical, maybe a gem I'm using has updated and broken something. But I checked the oAuth gems and none of them have changed for a while.
Here's my log when it doesn't work:
2015-10-25T15:20:47.802222+00:00 app[web.1]: Started GET "/humans/auth/facebook?ip=123&loc=8&mac=123&var=11" for 162.158.38.218 at 2015-10-25 15:20:47 +0000
2015-10-25T15:20:47.804207+00:00 app[web.1]: I, [2015-10-25T15:20:47.804128 #3] INFO -- omniauth: (facebook) Request phase initiated.
2015-10-25T15:20:47.871762+00:00 heroku[router]: at=info method=GET path="/humans/auth/facebook?ip=123&loc=8&mac=123&var=11" host=yourhotspot.net request_id=9804b0a9-a190-4881-a64f-ff222aa216e3 fwd="82.34.163.154,162.158.38.218" dyno=web.1 connect=0ms service=75ms status=302 bytes=1916
2015-10-25T15:20:48.181538+00:00 app[web.1]: Started GET "/humans/auth/facebook/callback?ip=123&loc=8&mac=123&var=11&code=AQCqfCPHQUM_YzgXPJSUniVKumx6ii2fsQtgEw9Bc3B9MFwNyKmnRtdqZxCRWSl1bDxdZKIAgU_M_-DQGVedt7FRYsm8DxA7gPA8bky86H-jlaCaFQa1Gc2BRLxtuzEUPKtu3UPRmKjUpXBuJI0nHOmG4IF3WWjwRk1jtfvWvgHmEH5Q-h-JjoEgiTC5uqK6XN2E48hKqxYcqBVs-pDMLMp74WRmRCXN_R_R_RuAjyyj_9-GdNHhZ6uajuri_41AN5V8W9UqWPmtPHznL7ztNLzS9dDj7S9e25bINXUMneHVVNHwGpp5PWZULsN_hwJueUU4SFZlNgzrnupacHAXF9kU&state=1e8f5be4b10b96baedd6aab3cd2eb125b150e100c5a2c7bb" for 162.158.38.218 at 2015-10-25 15:20:48 +0000
2015-10-25T15:20:48.183305+00:00 app[web.1]: I, [2015-10-25T15:20:48.183218 #3] INFO -- omniauth: (facebook) Callback phase initiated.
2015-10-25T15:20:48.733053+00:00 app[web.1]: {"error":{"message":"Error validating verification code. Please make sure your redirect_uri is identical to the one you used in the OAuth dialog request","type":"OAuthException","code":100,"fbtrace_id":"B8bmqcG7i6M"}}
2015-10-25T15:20:48.733049+00:00 app[web.1]: E, [2015-10-25T15:20:48.732948 #3] ERROR -- omniauth: (facebook) Authentication failure! invalid_credentials: OAuth2::Error, :
2015-10-25T15:20:48.735557+00:00 app[web.1]: Parameters: {"ip"=>"123", "loc"=>"8", "mac"=>"123", "var"=>"11", "code"=>"AQCqfCPHQUM_YzgXPJSUniVKumx6ii2fsQtgEw9Bc3B9MFwNyKmnRtdqZxCRWSl1bDxdZKIAgU_M_-DQGVedt7FRYsm8DxA7gPA8bky86H-jlaCaFQa1Gc2BRLxtuzEUPKtu3UPRmKjUpXBuJI0nHOmG4IF3WWjwRk1jtfvWvgHmEH5Q-h-JjoEgiTC5uqK6XN2E48hKqxYcqBVs-pDMLMp74WRmRCXN_R_R_RuAjyyj_9-GdNHhZ6uajuri_41AN5V8W9UqWPmtPHznL7ztNLzS9dDj7S9e25bINXUMneHVVNHwGpp5PWZULsN_hwJueUU4SFZlNgzrnupacHAXF9kU", "state"=>"1e8f5be4b10b96baedd6aab3cd2eb125b150e100c5a2c7bb"}
2015-10-25T15:20:48.735493+00:00 app[web.1]: Processing by Humans::OmniauthCallbacksController#failure as HTML
And when it does:
2015-10-25T15:56:56.726873+00:00 heroku[router]: at=info method=GET path="/humans/auth/facebook?ip=123&loc=8&mac=123&var=11" host=yourhotspot.net request_id=1c01da5f-1bea-4dbb-9a1b-a80dcc442539 fwd="82.34.163.154,162.158.38.211" dyno=web.1 connect=1ms service=18ms status=302 bytes=1828
2015-10-25T15:56:56.714754+00:00 app[web.1]: I, [2015-10-25T15:56:56.714674 #3] INFO -- omniauth: (facebook) Request phase initiated.
2015-10-25T15:56:56.920771+00:00 app[web.1]: I, [2015-10-25T15:56:56.920692 #3] INFO -- omniauth: (facebook) Callback phase initiated.
2015-10-25T15:56:56.712897+00:00 app[web.1]: Started GET "/humans/auth/facebook?ip=123&loc=8&mac=123&var=11" for 162.158.38.211 at 2015-10-25 15:56:56 +0000
2015-10-25T15:56:56.919315+00:00 app[web.1]: Started GET "/humans/auth/facebook/callback?code=AQC7jHL3hk8TSP5F9lsDjzkyXlAIbk-Kf3027g3bU-9x0etBoOxUvHd6ofEIZjEolh-UajkUCS4WZ3z40q7tgrIYi8ZIy6fuhjRJwyqLhXBPfOnmL1LqCDlPFVIdizrHPUomZ5WZ-VLmFc7A1UsEUVpyW907LgoaL8S90Gukh9oGvykIcpc1tmHqpc-WaayJNCkTUPxaRtlEmuD5FTVUDoRAzFnVDYCURhNAZMs9eTk-O40_leapHbTX0Uz6sFC6RHn-qgien_diOJst2DlRvtKWCcfxXuoBZPFPa5BtRYg2_eP4K8zUxRtDeazwYsxJt7o1i9V93np56EABMMrfBmIK&state=952e4d3cbe773056b12f56d76b0a54c5ea841f51e61d5041" for 162.158.38.211 at 2015-10-25 15:56:56 +0000
2015-10-25T15:56:57.897756+00:00 app[web.1]: Processing by Humans::OmniauthCallbacksController#facebook as HTML
I just cannot wrap my head around what's going on here. The fact that my code, environments, config vars and app settings are identical is hurting my head.
If anyone can shed some light on what might be going wrong, I'd be very appreciative.
EDIT: (Commands used)
heroku git:clone -a myapp (At this point of cloning, I had already rolled back to v410, so this clone should be of that working copy)
(cd into new app directory, make a line
change so that I can re-commit)
git add .
git commit . -m "msg"
git push heroku master
(realise it's not working as expected)
heroku
rollback v410
Command logs gave no errors and the commands worked as expected. Yet something is changing oauth.
What definitely could change on deployment is a physical server ('dyno'). I would check following things: 1) does your app cache any authentication tokens issued by facebook, e.g. in configuration? 2) how possible is that such tokens are bound to the server's IP address?

ActiveRecord::StatementInvalid (Could not find table)

I've got a rails application on DigitalOcean. I'm using the Comfortable Mexican Sofa CMS. I added the gem and ran rails generate comfy:cms and rake db:migrate but when I navigate to example.com/admin, I get a 500 error and my application isn't able to find the necessary tables. Here's the error I get in the logs.
I, [2014-06-24T21:51:18.397255 #18789] INFO -- : Started GET "/" for 173.10.20.190 at 2014-06-24 21:51:18 +0000
I, [2014-06-24T21:51:18.425183 #18789] INFO -- : Processing by HomeController#index as HTML
I, [2014-06-24T21:51:18.442366 #18789] INFO -- : Rendered home/index.html.erb within layouts/application (1.2ms)
I, [2014-06-24T21:51:18.445116 #18789] INFO -- : Completed 200 OK in 20ms (Views: 9.5ms | ActiveRecord: 0.0ms)
I, [2014-06-24T21:51:18.599085 #18786] INFO -- : Started GET "/assets/rails.png" for 173.10.20.190 at 2014-06-24 21:51:18 +0000
I, [2014-06-24T21:51:23.516755 #18789] INFO -- : Started GET "/admin" for 173.10.20.190 at 2014-06-24 21:51:23 +0000
I, [2014-06-24T21:51:23.522184 #18789] INFO -- : Processing by Comfy::Admin::Cms::BaseController#jump as HTML
I, [2014-06-24T21:51:23.526053 #18789] INFO -- : Completed 500 Internal Server Error in 4ms
F, [2014-06-24T21:51:23.532357 #18789] FATAL -- :
ActiveRecord::StatementInvalid (Could not find table 'comfy_cms_sites'):
What seems strange to me is that when I run rails c and ActiveRecord::Base.connection.tables, the tables show up and 'comfy_cms_sites' is there.
Make sure you've run your migrations on your production db with
rake db:migrate RAILS_ENV=production

Resources