简体   繁体   中英

Error while deploying Rails 6 app to Google Cloud Platform App Engine

I have developed the first iteration of an app using Ruby on Rails (ROR - v6.0.0; Ruby - v2.6.3). I need to deploy it to gcp, google cloud platform as that is what the company I work for uses. I followed the tutorial google has for this, as seen here . However, no matter what I do, near the end of the push I get this error:

8536b8dd72f7: Pushed
f66b9865f45c: Layer already exists
8f213bf0e9c7: Pushed
ce02b74896ad: Pushed
a79efcc05468: Pushed
latest: digest: sha256:93b405b42825c93798db12c14f4f5d5dd09c6fc3e32861a1a1f3947c338e45a2 size: 2419
DONE
-----------------------------------------------------------------------------------------------------------------------------------------------------------

Updating service [default] (this may take several minutes)...failed.
ERROR: (gcloud.app.deploy) Error Response: [9]
Application startup error:
Puma starting in single mode...
* Version 3.12.1 (ruby 2.6.3-p62), codename: Llamas in Pajamas
* Min threads: 5, max threads: 5
* Environment: production
* Listening on tcp://0.0.0.0:8080
bundler: failed to load command: rackup (/app/vendor/bundle/ruby/2.6.0/bin/rackup)
Errno::ENOENT: No such file or directory @ rb_sysopen - tmp/pids/server.pid
  /app/vendor/bundle/ruby/2.6.0/gems/puma-3.12.1/lib/puma/launcher.rb:133:in `initialize'
  /app/vendor/bundle/ruby/2.6.0/gems/puma-3.12.1/lib/puma/launcher.rb:133:in `open'
  /app/vendor/bundle/ruby/2.6.0/gems/puma-3.12.1/lib/puma/launcher.rb:133:in `write_pid'
  /app/vendor/bundle/ruby/2.6.0/gems/puma-3.12.1/lib/puma/launcher.rb:106:in `write_state'
  /app/vendor/bundle/ruby/2.6.0/gems/puma-3.12.1/lib/puma/single.rb:103:in `run'
  /app/vendor/bundle/ruby/2.6.0/gems/puma-3.12.1/lib/puma/launcher.rb:186:in `run'
  /app/vendor/bundle/ruby/2.6.0/gems/puma-3.12.1/lib/rack/handler/puma.rb:73:in `run'
  /app/vendor/bundle/ruby/2.6.0/gems/rack-2.0.7/lib/rack/server.rb:297:in `start'
  /app/vendor/bundle/ruby/2.6.0/gems/rack-2.0.7/lib/rack/server.rb:148:in `start'
  /app/vendor/bundle/ruby/2.6.0/gems/rack-2.0.7/bin/rackup:4:in `<top (required)>'
  /app/vendor/bundle/ruby/2.6.0/bin/rackup:23:in `load'
  /app/vendor/bundle/ruby/2.6.0/bin/rackup:23:in `<top (required)>'

The strange thing is, I tried following google's tutorial with a brand new rails app (same machine, same environment), and I got the same error. Billing is enabled for the account, so I don't think it's that. The app works just fine when I run it locally. Anyway, here is my 'app.yml' file:

entrypoint: bundle exec rackup --port $PORT
env: flex
runtime: ruby

env_variables:
    SECRET_KEY_BASE: [MY_SECRET_KEY_IS_HERE]

When I run bundle exec rackup --port 8080 on my local machine, the app starts up just fine. I've searched all over and haven't been able to find a solution. I've seen similar posts, but they either aren't answered or do not solve this issue. I'm considering 'dockerizing' the app, not sure that would fix anything; But if I understand correctly docker is a way of telling other machines how to run a specific set of instructions, like an app, so that it can run on almost any machine. Idk, that's really all I can think of. Any and all suggestions are welcome and would be appreciated.

Thank you for your time in reading this, and I otherwise hope you have a great day.

I had the same issue.

I am using the puma gem as my app server. I needed to change entrypoint in the app.yaml file.

entrypoint: bundle exec rails server Puma -p $PORT

Documentation can be found here: https://cloud.google.com/appengine/docs/flexible/ruby/runtime

I experienced the same problem. My /config/puma.rb has this:

pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }

Which allowed me to set the location of the pid file to /tmp using env_variables . I added the following in app.yaml :

env_variables:
  PIDFILE: "/tmp/puma.pid"

Once I did this, the error went away.

I believe it was caused by the default location being read-only.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM