Deploying ruby ​​google cloud api

I am new to google cloud and I have this problem when I try to deploy my ruby ​​api in google cloud, here is what I did:

I uploaded my ruby ​​api to github (it works fine on localhost), here -> https://github.com/guisantogui/it

I got acquainted with the Google global textbook → https://cloud.google.com/ruby/getting-started/hello-world

and it worked as expected, but when I download my application, I received this message http 502 bad gateway, here are the logs:

2017-10-30 23:48:53 default[20171030t213633]  => Booting Puma
2017-10-30 23:48:53 default[20171030t213633]  => Rails 5.1.4 application starting in production 
2017-10-30 23:48:53 default[20171030t213633]  => Run `rails server -h` for more startup options
2017-10-30 23:48:53 default[20171030t213633]  Puma starting in single mode... 
2017-10-30 23:48:53 default[20171030t213633]  * Version 3.10.0 (ruby 2.4.1-p111), codename: Russell Teapot
2017-10-30 23:48:53 default[20171030t213633]  * Min threads: 5, max threads: 5
2017-10-30 23:48:53 default[20171030t213633]  * Environment: production
2017-10-30 23:48:53 default[20171030t213633]  * Listening on tcp://0.0.0.0:3000 
2017-10-30 23:48:53 default[20171030t213633] Use Ctrl-C to stop 
2017-10-30 23:58:01 default[20171030t213633]  "GET /" 502 
2017-10-30 23:58:02 default[20171030t213633]  "GET /favicon.ico" 502 
2017-10-30 23:58:06 default[20171030t213633]  "GET /" 502 
2017-10-30 23:58:06 default[20171030t213633]  "GET /favicon.ico" 502 
2017-11-01 10:54:50 default[20171030t213633]  "GET /" 502 
2017-11-01 10:54:50 default[20171030t213633]  "GET /favicon.ico" 502 
2017-11-01 10:55:02 default[20171030t213633]  "GET /favicon.ico" 502 
2017-11-01 10:55:02 default[20171030t213633]  "GET /tatoo_artis/list" 502

And finally, and I think the more important app.yaml file is:

entrypoint: bundle exec rails server Puma -p 3000
env: flex
runtime: ruby

Thanks in advance, I did not understand what the problem is and how to fix it!

+4
source share
1

Google Cloud https://cloud.google.com/ruby/getting-started/hello-world Sinatra, Rails. https://github.com/GoogleCloudPlatform/ruby-docs-samples/tree/master/appengine/hello_world app.yaml, :

# [START app_yaml]
runtime: ruby
env: flex
entrypoint: bundle exec ruby app.rb
# [END app_yaml]

app.rb - .

# [START app]
require "sinatra"
get "/" do
  "Hello world!"
end
# [END app]

Rails . , GCP App Engine Puma (, , ), rawn, , SECRET_KEY ( bundle exec rails secret), app.yaml :

# [START app_yaml]
runtime: ruby
env: flex
entrypoint: bundle exec rackup --port $PORT
env_variables:
  SECRET_KEY_BASE: [SECRET_KEY]
# [END app_yaml]

, :

RAILS_ENV=production bundle exec rails assets:precompile

gcloud app deploy

.

: https://cloud.google.com/ruby/rails/appengine, ( ) : " App Engine"

: Google: https://cloud.google.com/ruby/rails/appengine

: https://github.com/GoogleCloudPlatform/ruby-docs-samples/tree/master/appengine/rails-hello_world

EDIT: , GET , , , Puma . SECRET_KEY .

0

Source: https://habr.com/ru/post/1688523/


All Articles