2

Eu tentei subir uma aplicação feita em Ruby 2 e RoR 4 no Openshift e não consegui.

Uma aplicação feita em Ruby 2 é compatível com Ruby 1.9? Quais as versões suportadas pelo Openshift?

Segue o erro:

==> app-root/logs/mysql.log <==
        140507 22:54:28 InnoDB: highest supported file format is Barracuda.
        140507 22:54:28  InnoDB: Waiting for the background threads to start
        140507 22:54:29 InnoDB: 5.5.36 started; log sequence number 1595675
        140507 22:54:29 [Note] Server hostname (bind-address): '127.8.120.2'; port: 3306
    140507 22:54:29 [Note]   - '127.8.120.2' resolves to '127.8.120.2';
    140507 22:54:29 [Note] Server socket created on IP: '127.8.120.2'.
    140507 22:54:29 [Warning] 'proxies_priv' entry '@ [email protected]' ignored in --skip-name-resolve mode.
    140507 22:54:29 [Note] Event Scheduler: Loaded 0 events
    140507 22:54:29 [Note] /opt/rh/mysql55/root/usr/libexec/mysqld: ready for connections.
    Version: '5.5.36'  socket: '/var/lib/openshift/536aeaba4382ece46b00023b/mysql//socket/mysql.sock'  port: 3306  MySQL Community Server (GPL)

    ==> app-root/logs/ruby.log <==
        from /opt/rh/ruby193/root/usr/share/ruby/erb.rb:838:in `eval'
        from /opt/rh/ruby193/root/usr/share/ruby/erb.rb:838:in `result'
        from /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/lib/phusion_passenger/html_template.rb:46:in `result'
        from /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/lib/phusion_passenger/spawn_manager.rb:328:in `send_error_page'
        from /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/lib/phusion_passenger/spawn_manager.rb:297:in `rescue in handle_spawn_application'
        from /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/lib/phusion_passenger/spawn_manager.rb:274:in `handle_spawn_application'
        from /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
        from /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
        from /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/helper-scripts/passenger-spawn-server:102:in `<main>'
    200.18.252.45 - - [08/May/2014:16:31:28 -0400] "GET /favicon.ico HTTP/1.1" 200 - "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.131 Safari/537.36"
    *** Exception SyntaxError in Class (/var/lib/openshift/536aeaba4382ece46b00023b/app-root/runtime/repo/app/controllers/avaliacoes_controller.rb:9: invalid multibyte char (US-ASCII)
    /var/lib/openshift/536aeaba4382ece46b00023b/app-root/runtime/repo/app/controllers/avaliacoes_controller.rb:9: invalid multibyte char (US-ASCII)
    /var/lib/openshift/536aeaba4382ece46b00023b/app-root/runtime/repo/app/controllers/avaliacoes_controller.rb:9: syntax error, unexpected $end, expecting ':'
    ...== 1 ? flash[:success] = "Você curtiu #{@avaliacao.item.nom...
    ...                               ^) (process 289738, thread #<Thread:0x00000000f35110>):
        from /var/lib/openshift/536aeaba4382ece46b00023b/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:247:in `require'
        from /var/lib/openshift/536aeaba4382ece46b00023b/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:247:in `block in require'
        from /var/lib/openshift/536aeaba4382ece46b00023b/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:232:in `load_dependency'
        from /var/lib/openshift/536aeaba4382ece46b00023b/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:247:in `require'
        from /var/lib/openshift/536aeaba4382ece46b00023b/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:348:in `require_or_load'
        from /var/lib/openshift/536aeaba4382ece46b00023b/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:307:in `depend_on'
        from /var/lib/openshift/536aeaba4382ece46b00023b/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:225:in `require_dependency'
        from /var/lib/openshift/536aeaba4382ece46b00023b/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/railties-4.1.0/lib/rails/engine.rb:468:in `block (2 levels) in eager_load!'
        from /var/lib/openshift/536aeaba4382ece46b00023b/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/railties-4.1.0/lib/rails/engine.rb:467:in `each'
        from /var/lib/openshift/536aeaba4382ece46b00023b/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/railties-4.1.0/lib/rails/engine.rb:467:in `block in eager_load!'
        from /var/lib/openshift/536aeaba4382ece46b00023b/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/railties-4.1.0/lib/rails/engine.rb:465:in `each'
        from /var/lib/openshift/536aeaba4382ece46b00023b/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/railties-4.1.0/lib/rails/engine.rb:465:in `eager_load!'
        from /var/lib/openshift/536aeaba4382ece46b00023b/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/railties-4.1.0/lib/rails/engine.rb:346:in `eager_load!'
        from /var/lib/openshift/536aeaba4382ece46b00023b/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/railties-4.1.0/lib/rails/application/finisher.rb:58:in `each'
        from /var/lib/openshift/536aeaba4382ece46b00023b/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/railties-4.1.0/lib/rails/application/finisher.rb:58:in `block in <module:Finisher>'
        from /var/lib/openshift/536aeaba4382ece46b00023b/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/railties-4.1.0/lib/rails/initializable.rb:30:in `instance_exec'
        from /var/lib/openshift/536aeaba4382ece46b00023b/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/railties-4.1.0/lib/rails/initializable.rb:30:in `run'
        from /var/lib/openshift/536aeaba4382ece46b00023b/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/railties-4.1.0/lib/rails/initializable.rb:55:in `block in run_initializers'
        from /opt/rh/ruby193/root/usr/share/ruby/tsort.rb:150:in `block in tsort_each'
        from /opt/rh/ruby193/root/usr/share/ruby/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
        from /opt/rh/ruby193/root/usr/share/ruby/tsort.rb:219:in `each_strongly_connected_component_from'
        from /opt/rh/ruby193/root/usr/share/ruby/tsort.rb:182:in `block in each_strongly_connected_component'
        from /opt/rh/ruby193/root/usr/share/ruby/tsort.rb:180:in `each'
        from /opt/rh/ruby193/root/usr/share/ruby/tsort.rb:180:in `each_strongly_connected_component'
        from /opt/rh/ruby193/root/usr/share/ruby/tsort.rb:148:in `tsort_each'
        from /var/lib/openshift/536aeaba4382ece46b00023b/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/railties-4.1.0/lib/rails/initializable.rb:54:in `run_initializers'
        from /var/lib/openshift/536aeaba4382ece46b00023b/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/railties-4.1.0/lib/rails/application.rb:288:in `initialize!'
        from /var/lib/openshift/536aeaba4382ece46b00023b/app-root/runtime/repo/config/environment.rb:5:in `<top (required)>'
        from config.ru:3:in `require'
        from config.ru:3:in `block in <main>'
        from /var/lib/openshift/536aeaba4382ece46b00023b/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
        from /var/lib/openshift/536aeaba4382ece46b00023b/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
        from config.ru:1:in `new'
        from config.ru:1:in `<main>'
        from /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/lib/phusion_passenger/rack/application_spawner.rb:225:in `eval'
        from /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/lib/phusion_passenger/rack/application_spawner.rb:225:in `load_rack_app'
        from /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/lib/phusion_passenger/rack/application_spawner.rb:75:in `block (2 levels) in spawn_application'
        from /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/lib/phusion_passenger/utils.rb:563:in `report_app_init_status'
        from /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/lib/phusion_passenger/rack/application_spawner.rb:73:in `block in spawn_application'
        from /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/lib/phusion_passenger/utils.rb:470:in `safe_fork'
        from /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/lib/phusion_passenger/rack/application_spawner.rb:64:in `spawn_application'
        from /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/lib/phusion_passenger/spawn_manager.rb:264:in `spawn_rack_application'
        from /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/lib/phusion_passenger/spawn_manager.rb:137:in `spawn_application'
        from /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
        from /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
        from /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
        from /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/helper-scripts/passenger-spawn-server:102:in `<main>'
    [ pid=353530 thr=140007617968096 file=ext/apache2/Hooks.cpp:884 time=2014-05-08 16:33:47.332 ]: Unexpected error in mod_passenger: Cannot spawn application '/var/lib/openshift/536aeaba4382ece46b00023b/app-root/runtime/repo': The spawn server has exited unexpectedly.
      Backtrace:
         in 'virtual Passenger::SessionPtr Passenger::ApplicationPool::Client::get(const Passenger::PoolOptions&)' (Client.h:742)
         in 'Passenger::SessionPtr Hooks::getSession(const Passenger::PoolOptions&)' (Hooks.cpp:312)
         in 'int Hooks::handleRequest(request_rec*)' (Hooks.cpp:585)
    200.18.252.45 - - [08/May/2014:16:33:34 -0400] "GET / HTTP/1.1" 500 629 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.131 Safari/537.36"
    *** Exception ArgumentError in spawn manager (invalid byte sequence in US-ASCII) (process 289738, thread #<Thread:0x00000000f35110>):
        from /opt/rh/ruby193/root/usr/share/ruby/erb.rb:912:in `gsub'
        from /opt/rh/ruby193/root/usr/share/ruby/erb.rb:912:in `html_escape'
        from (erb):47:in `block in result'
        from /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/lib/phusion_passenger/html_template.rb:63:in `block in layout'
        from (erb):22:in `get_binding'
        from /opt/rh/ruby193/root/usr/share/ruby/erb.rb:838:in `eval'
        from /opt/rh/ruby193/root/usr/share/ruby/erb.rb:838:in `result'
        from /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/lib/phusion_passenger/html_template.rb:66:in `layout'
        from (erb):1:in `result'
        from /opt/rh/ruby193/root/usr/share/ruby/erb.rb:838:in `eval'
        from /opt/rh/ruby193/root/usr/share/ruby/erb.rb:838:in `result'
        from /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/lib/phusion_passenger/html_template.rb:46:in `result'
        from /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/lib/phusion_passenger/spawn_manager.rb:328:in `send_error_page'
        from /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/lib/phusion_passenger/spawn_manager.rb:297:in `rescue in handle_spawn_application'
        from /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/lib/phusion_passenger/spawn_manager.rb:274:in `handle_spawn_application'
        from /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
        from /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
        from /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/helper-scripts/passenger-spawn-server:102:in `<main>'

2 Respostas 2

1

Vou responder de trás para frente. Você pergunta:

Uma aplicação feita em Ruby 2 é compatível com Ruby 1.9? Quais as versões suportadas pelo Openshift?

Então, de acordo com a própria ruby-lang.org:

Compatibility

We have also taken care with the 2.0.0 design to make it compatible with 1.9. It will be easier to migrate from 1.9 to 2.0 than it was from 1.8 to 1.9. (The notable incompatibilities are described later.)

E os problemas de incompatibilidade:

Incompatibility

There are five notable incompatibilities we know of:

  • The default encoding for ruby scripts is now UTF-8 [#6679]. Some people report that it affects existing programs, such as some benchmark programs becoming very slow [ruby-dev:46547].

  • Iconv was removed, which had already been deprecated when M17N was introduced in ruby 1.9. Use String#encode, etc. instead. There is ABI breakage [ruby-core:48984].

  • We think that normal users can/should just reinstall extension libraries. You should be aware: DO NOT COPY .so OR .bundle FILES FROM 1.9.

  • #lines, #chars, #codepoints, #bytes now returns an Array instead of an Enumerator [#6670]. This change allows you to avoid the common idiom "lines.to_a". Use #each_line, etc. to get an Enumerator.

  • Object#inspect does always return a string like # instead of delegating to #to_s. [#2152]

There are some comparatively small incompatibilities. [ruby-core:49119]

Agora, no que diz respeito à OpenShift, de acordo com este texto, "Ruby 2.0.0-p0 (patch level zero) is out" (Ruby 2.0.0-p0 (...) é lançado), mas você deve baixá-lo pelo rbenv ou rpm - ainda de acordo com o texto, rbenv é melhor.


Tendo conhecimento das suas perguntas, vou te relançar outra:

Eu tentei subir uma aplicação feita em Ruby 2 e RoR 4 no Openshift e não consegui.

Qual o erro especificamente e afinal?

1
  • Adicionei o erro no log. Commented 8/05/2014 às 20:38
1

As versões do Ruby disponíveis no Openshift Online são 1.8 e 1.9, e por isso deve estar apresentando este erro que você descreveu, veja que no seu log aparece o caminho /opt/rh/ruby193/.

A relação dos cartuchos disponíveis você encontra neste link https://www.openshift.com/developers/technologies.

No seu arquivo /app/controllers/avaliacoes_controller.rb existem caracteres não ASCII? Neste caso é necessário incluir # encoding: utf-8 na primeira linha dele.

1
  • Sim, eles ainda não suportam a 2.0! Que pena. Vou continuar desenvolvendo local então :/ Commented 9/05/2014 às 0:12

Você deve fazer log-in para responder a esta pergunta.

Esta não é a resposta que você está procurando? Pesquise outras perguntas com a tag .