Сервер Rails работает на экземпляре виртуальной машины GCP, но не может получить доступ к приложению rails в браузере - PullRequest
0 голосов
/ 22 января 2019

Я использую rails 4.2, ruby ​​2.3, puma 3.4, nginx и пытаюсь развернуть приложение rails на GCP compute engine экземпляр. пока я запускаю сервер rails на экземпляре gcp через ssh, сервер запускается, но в браузере я не могу получить доступ к приложению через любой порт. Я попробовал все ответы здесь, но ничего не помогло.

журнал сервера-

$ rails s -b 0.0.0.0
Array values in the parameter to `Gem.paths=` are deprecated.
Please use a String or nil.
An Array ({"GEM_PATH"=>["/home/sujeet/.rvm/gems/ruby-2.2.4", "/home/sujeet/.rvm/gems/ruby-2.2.4@global"]}) was passed in from bin/rails:3:in `load'
=> Booting Puma
=> Rails 4.2.1 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Rails Error: Unable to access log file. Please ensure that /home/sujeet/furdo/log/development.log exists and is writable (ie, make it writable for user and group: chmod 0664 /home/sujeet/furdo/log/development.log). The log level has been raised to WARN and the output directed to STDERR until the problem is fixed.
The PGconn, PGresult, and PGError constants are deprecated, and will be
removed as of version 1.0.

You should use PG::Connection, PG::Result, and PG::Error instead, respectively.

Called from /home/sujeet/.rvm/gems/ruby-2.2.4/gems/activerecord-4.2.1/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `new'
  Spree::Taxonomy Load (0.8ms)  SELECT  "spree_taxonomies".* FROM "spree_taxonomies" WHERE "spree_taxonomies"."name" = $1  ORDER BY spree_taxonomies.position, spree_taxonomies.created_at LIMIT 1  [["name", "Product Categories"]]
  Spree::Taxonomy Load (0.4ms)  SELECT  "spree_taxonomies".* FROM "spree_taxonomies" WHERE "spree_taxonomies"."name" = $1  ORDER BY spree_taxonomies.position, spree_taxonomies.created_at LIMIT 1  [["name", "Vendors"]]
  Spree::Taxonomy Load (0.2ms)  SELECT  "spree_taxonomies".* FROM "spree_taxonomies" WHERE "spree_taxonomies"."name" = $1  ORDER BY spree_taxonomies.position, spree_taxonomies.created_at LIMIT 1  [["name", "Package"]]
   (0.7ms)  SELECT "spree_taxons"."id" FROM "spree_taxons" WHERE "spree_taxons"."taxonomy_id" IS NULL AND ("spree_taxons"."parent_id" IS NOT NULL)
   (0.3ms)  SELECT "spree_taxons"."id" FROM "spree_taxons" WHERE "spree_taxons"."taxonomy_id" IS NULL AND ("spree_taxons"."parent_id" IS NOT NULL)
  Spree::Property Load (0.3ms)  SELECT  "spree_properties".* FROM "spree_properties" WHERE "spree_properties"."name" = $1 LIMIT 1  [["name", "vendor_link"]]
  Spree::Property Load (0.2ms)  SELECT  "spree_properties".* FROM "spree_properties" WHERE "spree_properties"."name" = $1 LIMIT 1  [["name", "stock"]]
  Spree::Property Load (0.2ms)  SELECT  "spree_properties".* FROM "spree_properties" WHERE "spree_properties"."name" = $1 LIMIT 1  [["name", "3d_modeled"]]
  Spree::Property Load (0.2ms)  SELECT  "spree_properties".* FROM "spree_properties" WHERE "spree_properties"."name" = $1 LIMIT 1  [["name", "theme_designer"]]
  Spree::OptionType Load (0.4ms)  SELECT  "spree_option_types".* FROM "spree_option_types" WHERE "spree_option_types"."name" = $1  ORDER BY spree_option_types.position LIMIT 1  [["name", "Focus"]]
  Spree::AuthenticationMethod Load (0.3ms)  SELECT "spree_authentication_methods".* FROM "spree_authentication_methods" WHERE "spree_authentication_methods"."environment" = $1  [["environment", "development"]]
  Spree::AuthenticationMethod Load (0.2ms)  SELECT "spree_authentication_methods".* FROM "spree_authentication_methods" WHERE "spree_authentication_methods"."environment" = $1  [["environment", "development"]]
  Spree::AuthenticationMethod Load (0.3ms)  SELECT "spree_authentication_methods".* FROM "spree_authentication_methods" WHERE "spree_authentication_methods"."environment" = $1  [["environment", "development"]]
  Spree::AuthenticationMethod Load (0.2ms)  SELECT "spree_authentication_methods".* FROM "spree_authentication_methods" WHERE "spree_authentication_methods"."environment" = $1  [["environment", "development"]]
  Spree::AuthenticationMethod Load (0.2ms)  SELECT "spree_authentication_methods".* FROM "spree_authentication_methods" WHERE "spree_authentication_methods"."environment" = $1  [["environment", "development"]]
DEPRECATION WARNING: Devise.allow_insecure_token_lookup= is deprecated and has no effect. (called from allow_insecure_token_lookup= at (eval):6)
  Spree::Preference Load (0.4ms)  SELECT  "spree_preferences".* FROM "spree_preferences" WHERE "spree_preferences"."key" = $1  ORDER BY "spree_preferences"."id" ASC LIMIT 1  [["key", "spree/auth_configuration/confirmable"]]
   (0.2ms)  BEGIN
  Spree::Preference Exists (0.6ms)  SELECT  1 AS one FROM "spree_preferences" WHERE ("spree_preferences"."key" = 'spree/auth_configuration/confirmable' AND "spree_preferences"."id" != 1) LIMIT 1
   (0.2ms)  COMMIT
  Spree::Preference Load (0.3ms)  SELECT  "spree_preferences".* FROM "spree_preferences" WHERE "spree_preferences"."key" = $1  ORDER BY "spree_preferences"."id" ASC LIMIT 1  [["key", "spree/app_configuration/default_country_id"]]
   (0.1ms)  BEGIN
  Spree::Preference Exists (0.3ms)  SELECT  1 AS one FROM "spree_preferences" WHERE ("spree_preferences"."key" = 'spree/app_configuration/default_country_id' AND "spree_preferences"."id" != 2) LIMIT 1
   (0.1ms)  COMMIT
  Spree::Preference Load (0.3ms)  SELECT  "spree_preferences".* FROM "spree_preferences" WHERE "spree_preferences"."key" = $1  ORDER BY "spree_preferences"."id" ASC LIMIT 1  [["key", "spree/app_configuration/always_include_confirm_step"]]
   (0.3ms)  BEGIN
  Spree::Preference Exists (0.3ms)  SELECT  1 AS one FROM "spree_preferences" WHERE ("spree_preferences"."key" = 'spree/app_configuration/always_include_confirm_step' AND "spree_preferences"."id" != 3) LIMIT 1
   (0.1ms)  COMMIT
  Spree::Preference Load (0.3ms)  SELECT  "spree_preferences".* FROM "spree_preferences" WHERE "spree_preferences"."key" = $1  ORDER BY "spree_preferences"."id" ASC LIMIT 1  [["key", "spree/app_configuration/check_for_spree_alerts"]]
   (0.1ms)  BEGIN
  Spree::Preference Exists (0.3ms)  SELECT  1 AS one FROM "spree_preferences" WHERE ("spree_preferences"."key" = 'spree/app_configuration/check_for_spree_alerts' AND "spree_preferences"."id" != 4) LIMIT 1
   (0.1ms)  COMMIT
  Spree::Preference Load (0.3ms)  SELECT  "spree_preferences".* FROM "spree_preferences" WHERE "spree_preferences"."key" = $1  ORDER BY "spree_preferences"."id" ASC LIMIT 1  [["key", "spree/social_configuration/path_prefix"]]
   (0.1ms)  BEGIN
  Spree::Preference Exists (0.3ms)  SELECT  1 AS one FROM "spree_preferences" WHERE ("spree_preferences"."key" = 'spree/social_configuration/path_prefix' AND "spree_preferences"."id" != 5) LIMIT 1
   (0.1ms)  COMMIT
Puma starting in single mode...
* Version 3.4.0 (ruby 2.2.4-p230), codename: Owl Bowl Brawl
* Min threads: 1, max threads: 6
* Environment: development
* Listening on tcp://0.0.0.0:3000
* Starting control server on unix:///tmp/puma-status-1548153185501-23281
Use Ctrl-C to stop*

1 Ответ

0 голосов
/ 26 января 2019

Вы удостоверились, что разрешаете трафик через порт, который публикует ваше приложение? Вот документ для создания правила брандмауэра в GCP , в правиле брандмауэра вы должны добавить порт или порты, которые использует ваше приложение. Также убедитесь, что ваш локальный брандмауэр не блокирует приложение.

...