I'm trying to migrate from a flexible environment to a standard environment. I made the mistake of having having env: flex
in my app.yaml on the first deployment. When I deploy with env: standard
I get the confirmation Deployed service [default] to [project]
, though the deployment seems way too fast to be true. When I request the app I get a 500 error. I'm using ruby on rails.
2020-09-22 03:11:12 default[20200921t205538] Puma starting in single mode...
2020-09-22 03:11:12 default[20200921t205538] * Version 4.3.3 (ruby 2.7.1-p83), codename: Mysterious Traveller
2020-09-22 03:11:12 default[20200921t205538] * Min threads: 5, max threads: 5
2020-09-22 03:11:12 default[20200921t205538] * Environment: production
2020-09-22 03:11:12 default[20200921t205538] * Listening on tcp://0.0.0.0:8081
2020-09-22 03:11:12 default[20200921t205538] bundler: failed to load command: rackup (/workspace/.bundle/gems/ruby/2.7.0/bin/rackup)
2020-09-22 03:11:12 default[20200921t205538] Errno::ENOENT: No such file or directory @ rb_sysopen - tmp/pids/server.pid
2020-09-22 03:11:12 default[20200921t205538] /layers/google.ruby.bundle/gems/.bundle/gems/ruby/2.7.0/gems/puma-4.3.3/lib/puma/launcher.rb:216:in `initialize'
2020-09-22 03:11:12 default[20200921t205538] /layers/google.ruby.bundle/gems/.bundle/gems/ruby/2.7.0/gems/puma-4.3.3/lib/puma/launcher.rb:216:in `open'
2020-09-22 03:11:12 default[20200921t205538] /layers/google.ruby.bundle/gems/.bundle/gems/ruby/2.7.0/gems/puma-4.3.3/lib/puma/launcher.rb:216:in `write_pid'
2020-09-22 03:11:12 default[20200921t205538] /layers/google.ruby.bundle/gems/.bundle/gems/ruby/2.7.0/gems/puma-4.3.3/lib/puma/launcher.rb:105:in `write_state'
2020-09-22 03:11:12 default[20200921t205538] /layers/google.ruby.bundle/gems/.bundle/gems/ruby/2.7.0/gems/puma-4.3.3/lib/puma/single.rb:103:in `run'
2020-09-22 03:11:12 default[20200921t205538] /layers/google.ruby.bundle/gems/.bundle/gems/ruby/2.7.0/gems/puma-4.3.3/lib/puma/launcher.rb:172:in `run'
2020-09-22 03:11:12 default[20200921t205538] /layers/google.ruby.bundle/gems/.bundle/gems/ruby/2.7.0/gems/puma-4.3.3/lib/rack/handler/puma.rb:73:in `run'
2020-09-22 03:11:12 default[20200921t205538] /layers/google.ruby.bundle/gems/.bundle/gems/ruby/2.7.0/gems/rack-2.2.2/lib/rack/server.rb:327:in `start'
2020-09-22 03:11:12 default[20200921t205538] /layers/google.ruby.bundle/gems/.bundle/gems/ruby/2.7.0/gems/rack-2.2.2/lib/rack/server.rb:168:in `start'
2020-09-22 03:11:12 default[20200921t205538] /layers/google.ruby.bundle/gems/.bundle/gems/ruby/2.7.0/gems/rack-2.2.2/bin/rackup:5:in `<top (required)>'
2020-09-22 03:11:12 default[20200921t205538] /workspace/.bundle/gems/ruby/2.7.0/bin/rackup:23:in `load'
2020-09-22 03:11:12 default[20200921t205538] /workspace/.bundle/gems/ruby/2.7.0/bin/rackup:23:in `<top (required)>'
2020-09-22 03:11:13 default[20200921t205538] nginx failed to start: aborted, context canceled. subject:"nginx" Timeout:30m0s, attempts:2
2020-09-22 03:11:13 default[20200921t205538] "GET /favicon.ico HTTP/1.1" 500
The error on the logs you provided states:
bundler: failed to load command: rackup (/workspace/.bundle/gems/ruby/2.7.0/bin/rackup)
I can see that you're using Puma, and the App Engine Standard docs specify some steps to take for apps that depend on Rack:
Most web applications use a Rack-supported web server such as Puma, Unicorn or Thin.
You must add the server as a dependency in your application's
Gemfile
configuration file. The runtime will install all dependencies before your entrypoint is called.source "https://rubygems.org" gem "rack" gem "puma"
An example entrypoint using puma for a Rails application:
entrypoint: bundle exec rails server Puma -p $PORT
The instructions for flex are the same as the standard environment regarding the Gemfile and the entrypoint, so I'm not sure why one works and the other does not, but I encourage you to double-check if all those instructions are properly implemented.
I don't think there's anything inherently wrong with your app.yaml
, since the API would reject the deployment if you passed a configuration that was not allowed in App Engine.
It is likely related to the entrypoint or the dependencies. This would allow building the container and deploying it, but would fail when the script actually tries to start.