nanobox
nanobox copied to clipboard
nanobox run failed with ruby 2.4.2 ?
Hi,
I've tried to create a new default rails 5 app and adding nanobox. If I use ruby 2.4.2, the build process fails when running nanobox run for the first time. I'm running macOS Sierra. I retried with the default ruby 2.3 and it worked so I guess it's related to this version.
note2: not sure if this is the right place to post this info. Apologies if not.
Error msg below:
Preparing environment : Mounting codebase :
- HEADS UP:
- This is the first build for this project and will take longer than usual.
- Future builds will pull from the cache and will be much faster.
Building runtime : Starting docker container : Preparing environment for build : - Copying ssh keys into the build environment... - Setting up directories and permissions... - Cloning engine : Cloning into 'engine'... remote: Counting objects: 869, done. remote: Total 869 (delta 0), reused 0 (delta 0), pack-reused 869 Receiving objects: 100% (869/869), 134.60 KiB | 111.00 KiB/s, done. Resolving deltas: 100% (416/416), done. Checking connectivity... done.
- Cleaning up any previous builds...
- Updating pkg database...
- Installing user-requested packages :
calculating dependencies... done.
nothing to upgrade.
1 packages to be installed (15M to download, 50M to install):
nodejs-8.6.0
downloading packages...
nodejs-8.6.0.tgz 100% 15MB 7.7MB/s 5.5MB/s 00:02
installing packages...
installing nodejs-8.6.0...
pkg_install warnings: 0, errors: 0
reading local summary...
processing local summary...
marking nodejs-8.6.0 as non auto-removable
Gathering requirements : Mounting cache_dirs : Installing binaries and runtimes : - Installing packages : calculating dependencies... done.
nothing to upgrade.
10 packages to be installed (19M to download, 62M to install):
libgpg-error-1.27 libyaml-0.1.7 libffi-3.2.1nb4 xmlcatmgr-2.2nb1 libgcrypt-1.8.1 ruby-2.4.2nb1 redis-4.0.0 pkgconf-1.3.5 libxml2-2.9.5 libxslt-1.1.30
downloading packages...
libgpg-error-1.27.tgz 100% 276KB 275.6KB/s 275.6KB/s 00:00
libyaml-0.1.7.tgz 100% 120KB 119.9KB/s 119.9KB/s 00:00
libffi-3.2.1nb4.tgz 100% 54KB 53.7KB/s 53.7KB/s 00:00
xmlcatmgr-2.2nb1.tgz 100% 28KB 27.7KB/s 27.7KB/s 00:00
libgcrypt-1.8.1.tgz 100% 1122KB 561.1KB/s 58.1KB/s 00:02
ruby-2.4.2nb1.tgz 100% 12MB 12.2MB/s 2.3MB/s 00:01
redis-4.0.0.tgz 100% 2184KB 2.1MB/s 2.1MB/s 00:00
pkgconf-1.3.5.tgz 100% 75KB 75.1KB/s 75.1KB/s 00:00
libxml2-2.9.5.tgz 100% 2353KB 2.3MB/s 2.3MB/s 00:00
libxslt-1.1.30.tgz 100% 675KB 674.6KB/s 674.6KB/s 00:00
installing packages...
installing libgpg-error-1.27...
installing libyaml-0.1.7...
installing libffi-3.2.1nb4...
installing xmlcatmgr-2.2nb1...
installing libgcrypt-1.8.1...
installing ruby-2.4.2nb1...
installing redis-4.0.0...
installing pkgconf-1.3.5...
installing libxml2-2.9.5...
installing libxslt-1.1.30...
pkg_install warnings: 0, errors: 0
reading local summary...
processing local summary...
marking ruby-2.4.2nb1 as non auto-removable
marking redis-4.0.0 as non auto-removable
marking pkgconf-1.3.5 as non auto-removable
marking libxml2-2.9.5 as non auto-removable
marking libxslt-1.1.30 as non auto-removable
! FAILED TO BUILD ENVIRONMENT !
Exit
1
Command
su - gonano -c "cd /opt/nanobox/engine/bin; export PATH=\"/data/sbin:/data/bin:/opt/gonano/sbin:/opt/gonano/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\"; export CODE_DIR=\"/app\"; export DATA_DIR=\"/data\"; export APP_DIR=\"/mnt/app\"; export CACHE_DIR=\"/mnt/cache\"; export ETC_DIR=\"/data/etc\"; export ENV_DIR=\"/data/etc/env.d\"; export CONFIG_RUNTIME_TYPE=\"string\"; export CONFIG_RUNTIME_VALUE=\"'ruby-2.4.2'\"; export CONFIG_NODES=\"runtime\"; stdbuf -o0 /opt/nanobox/engine/bin/build '{\"code_dir\":\"/app\",\"data_dir\":\"/data\",\"app_dir\":\"/mnt/app\",\"cache_dir\":\"/mnt/cache/app\",\"etc_dir\":\"/data/etc\",\"env_dir\":\"/data/etc/env.d\",\"config\":{\"runtime\":\"ruby-2.4.2\"}}'"
Output
- Installing packages :
calculating dependencies... done.
nothing to upgrade.
10 packages to be installed (19M to download, 62M to install):
libgpg-error-1.27 libyaml-0.1.7 libffi-3.2.1nb4 xmlcatmgr-2.2nb1 libgcrypt-1.8.1 ruby-2.4.2nb1 redis-4.0.0 pkgconf-1.3.5 libxml2-2.9.5 libxslt-1.1.30
downloading packages...
libgpg-error-1.27.tgz 100% 276KB 275.6KB/s 275.6KB/s 00:00
libyaml-0.1.7.tgz 100% 120KB 119.9KB/s 119.9KB/s 00:00
libffi-3.2.1nb4.tgz 100% 54KB 53.7KB/s 53.7KB/s 00:00
xmlcatmgr-2.2nb1.tgz 100% 28KB 27.7KB/s 27.7KB/s 00:00
libgcrypt-1.8.1.tgz 100% 1122KB 561.1KB/s 58.1KB/s 00:02
ruby-2.4.2nb1.tgz 100% 12MB 12.2MB/s 2.3MB/s 00:01
redis-4.0.0.tgz 100% 2184KB 2.1MB/s 2.1MB/s 00:00
pkgconf-1.3.5.tgz 100% 75KB 75.1KB/s 75.1KB/s 00:00
libxml2-2.9.5.tgz 100% 2353KB 2.3MB/s 2.3MB/s 00:00
libxslt-1.1.30.tgz 100% 675KB 674.6KB/s 674.6KB/s 00:00
installing packages...
installing libgpg-error-1.27...
installing libyaml-0.1.7...
installing libffi-3.2.1nb4...
installing xmlcatmgr-2.2nb1...
installing libgcrypt-1.8.1...
installing ruby-2.4.2nb1...
installing redis-4.0.0...
installing pkgconf-1.3.5...
installing libxml2-2.9.5...
installing libxslt-1.1.30...
pkg_install warnings: 0, errors: 0
reading local summary...
processing local summary...
marking ruby-2.4.2nb1 as non auto-removable
marking redis-4.0.0 as non auto-removable
marking pkgconf-1.3.5 as non auto-removable
marking libxml2-2.9.5 as non auto-removable
marking libxslt-1.1.30 as non auto-removable
Error : failed to execute hook (build) on 7d5469f99ac44328062789591641a106fc240c5ac7cc146c6279d2b39dc83d08: util:Exec:/opt/nanobox/hooks/build: bad exit code(1): Context : failed to build the code -> failed to run the (build)build hook
@psousa thank you for the report. This does look like either a ruby engine or a package issue.
The best place to get real time help is by joining our slack channel, hope to see you there soon.
Thanks. It's not a blocking issue for me because I got around using a older version of Ruby. I just wanted to report it since this was my first experience with nanobox and took me a while to figure out what was going on.
I was playing with rails 5.2.0.beta2. I had to make a few changes to get it to work in a nanobox.
Remove the following from config/boot.rb as specified at https://guides.nanobox.io/ruby/rails/existing-app:
require 'rails/commands/server'
module Rails
class Server
alias :_default_options :default_options
def default_options
_default_options.merge!(Host:'0.0.0.0')
end
end
end
Also had to specify the ruby version in the boxfile.yml because it’s set as default in the Gemfile:
run.config:
engine: ruby
engine.config:
runtime: ruby-2.4
...
I reported this in the #ruby channel on the nanobox slack https://nanoboxio.slack.com/archives/C2FE1LXMF/p1512257390000039
When you say "Remove the following ... as specified [in the docs]", do you mean "skip this step in the docs" or "this step in the docs is extra important"? Note that its purpose is to ensure the app is always listening on 0.0.0.0, which it will need to in order to be accessible from outside the container, so an equivalent change will still be needed somewhere.
@danhunsaker Yes I mean "skip". I understand the reason for it, but it fails because the file can't be required. Something about the Server class has changed. Skipping this instruction seemed to work for me, and has worked every time since; but I totally understand it probably can't be guaranteed that the app will be listening on 0.0.0.0.
I think the main "take away" for @psousa is that the ruby engine version needs to also be set in the boxfile.
Fair. Though I'm pretty sure this issue was created at the start of our package troubles we finally completely resolved a few weeks back.