problem while deploying sinatra application on heroku - heroku

I am able to deploy my basic sinatra app on heroku but running it gives "APP CRASHES" error
running "heroku logs" give the following error. I am using ruby1.9.1. dont know why this ruby1.8.7 shows in the backtrace. Please help
anmol#anmol-laptop:heroku$ heroku logs
/usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require': no such file to load -- sinatra (LoadError)
from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire'
from ./main.rb:2
from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require'
from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire'
from config.ru:1
from /home/heroku_rack/heroku.ru:23
from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:29:in instance_eval'
from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:29:ininitialize'
from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:46:in new'
from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:46:inmap'
from /home/heroku_rack/heroku.ru:18
from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:29:in instance_eval'
from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:29:ininitialize'
from /home/heroku_rack/heroku.ru:11:in new'
from /home/heroku_rack/heroku.ru:11
from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:29:ininstance_eval'
from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:29:in initialize'
from /home/heroku_rack/heroku.ru:1:innew'
from /home/heroku_rack/heroku.ru:1
==> dyno-3277552.log (crash) <==
/usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require': no such file to load -- sinatra (LoadError)
from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire'
from ./main.rb:2
from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require'
from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire'
from config.ru:1
from /home/heroku_rack/heroku.ru:23
from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:29:in instance_eval'
from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:29:ininitialize'
from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:46:in new'
from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:46:inmap'
from /home/heroku_rack/heroku.ru:18
from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:29:in instance_eval'
from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:29:ininitialize'
from /home/heroku_rack/heroku.ru:11:in new'
from /home/heroku_rack/heroku.ru:11
from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:29:ininstance_eval'
from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:29:in initialize'
from /home/heroku_rack/heroku.ru:1:innew'
from /home/heroku_rack/heroku.ru:1
-----> Your application is requiring a file that it can't find.
Most often this is due to missing gems, or it could be that you failed
to commit the file to your repo. See http://docs.heroku.com/gems for
more information on managing gems.
Examine the backtrace above this message to debug.

create a file with a name ".gems" and include this line "sinatra".
by this way you are instructing to include sinatra gem
More information is here: http://docs.heroku.com/rack#sinatra

Related

YARD infinitely recurses on Ruby project

Ruby 3.0.0, YARD 0.9.28, Linux (Fedora 35).
Running yardoc on my project works through most of the tasks, but blows up with an apparent infinite recursion when it comes to the Serializing to doc/top-level-namespace.html. I had this problem earlier in development, but I have no idea what I did to make it go away — and now it's back.
It might have something to do with the convoluted interplay of include and extend uses; there are four modules in the project that get mixed into almost every source file in some combination or other. Regardless, this has me stumped, and I haven't found anything like it online.
Here's the tail-end of the processing (I had to pull it out of the Rake task and do it by hand because the Rake output didn't compress the repeating lines):
% bundle exec yardoc
:
:
[debug]: Parsing ["config/macros.yard", "lib/sptaf.rb", "lib/sptaf/classmethods.rb", "lib/sptaf/cli.rb", "lib/sptaf/container.rb", "lib/sptaf/debugging.rb", "lib/sptaf/exceptions.rb", "lib/sptaf/faction.rb", "lib/sptaf/feature.rb", "lib/sptaf/game.rb", "lib/sptaf/inventory.rb", "lib/sptaf/item.rb", "lib/sptaf/location.rb", "lib/sptaf/mixin/actor.rb", "lib/sptaf/mixin/container.rb", "lib/sptaf/mixin/location.rb", "lib/sptaf/mixin/thing.rb", "lib/sptaf/npc.rb", "lib/sptaf/player.rb", "lib/sptaf/version.rb"] with `ruby` parser
[debug]: Parsing config/macros.yard
[debug]: Parsing lib/sptaf.rb
[debug]: Parsing lib/sptaf/classmethods.rb
:
:
[debug]: Serializing to doc/top-level-namespace.html
bundler: failed to load command: yardoc (./vendor/bundle/ruby/3.0.0/bin/yardoc)
./vendor/bundle/ruby/3.0.0/gems/yard-0.9.28/lib/yard/code_objects/proxy.rb:101:in `path': stack level too deep (SystemStackError)
from ./vendor/bundle/ruby/3.0.0/gems/yard-0.9.28/lib/yard/code_objects/proxy.rb:129:in `equal?'
from ./vendor/bundle/ruby/3.0.0/gems/yard-0.9.28/lib/yard/code_objects/module_object.rb:15:in `block in inheritance_tree'
from ./vendor/bundle/ruby/3.0.0/gems/yard-0.9.28/lib/yard/code_objects/module_object.rb:14:in `map'
from ./vendor/bundle/ruby/3.0.0/gems/yard-0.9.28/lib/yard/code_objects/module_object.rb:14:in `inheritance_tree'
from ./vendor/bundle/ruby/3.0.0/gems/yard-0.9.28/lib/yard/code_objects/proxy.rb:180:in `method_missing'
from ./vendor/bundle/ruby/3.0.0/gems/yard-0.9.28/lib/yard/code_objects/module_object.rb:17:in `block in inheritance_tree'
from ./vendor/bundle/ruby/3.0.0/gems/yard-0.9.28/lib/yard/code_objects/module_object.rb:14:in `map'
from ./vendor/bundle/ruby/3.0.0/gems/yard-0.9.28/lib/yard/code_objects/module_object.rb:14:in `inheritance_tree'
... 10681 levels...
from /usr/share/gems/gems/bundler-2.2.33/lib/bundler/friendly_errors.rb:103:in `with_friendly_errors'
from /usr/share/gems/gems/bundler-2.2.33/libexec/bundle:37:in `<top (required)>'
from /home/coar/bin/bundle:23:in `load'
from /home/coar/bin/bundle:23:in `<main>'
Here is the .yardopts file it is using:
--charset="utf-8"
--verbose
--debug
--backtrace
--no-cache
--title="Text Adventure Framework (TAF) Gem"
--private
--embed-mixins
--markup-provider="rdiscount"
--markup="markdown"
config/macros.yard
lib/sptaf.rb
lib/sptaf/classmethods.rb
lib/sptaf/cli.rb
lib/sptaf/container.rb
lib/sptaf/debugging.rb
lib/sptaf/exceptions.rb
lib/sptaf/faction.rb
lib/sptaf/feature.rb
lib/sptaf/game.rb
lib/sptaf/inventory.rb
lib/sptaf/item.rb
lib/sptaf/location.rb
lib/sptaf/mixin/actor.rb
lib/sptaf/mixin/container.rb
lib/sptaf/mixin/location.rb
lib/sptaf/mixin/thing.rb
lib/sptaf/npc.rb
lib/sptaf/player.rb
lib/sptaf/version.rb
-
CHANGELOG.md
CODE_OF_CONDUCT.md
LICENCE.md
README.md
TODO.md
My apologies if the #documentation tag is inappropriate here; it says it's for questions about document generators, which seems to kinda fit.
As always, thanks for reading and particularly for any kind feedback!

Ruby script can't open SQLite3 file, but only when running as a Daemon

I'm running a script (running on an AWS EC2 instance) that continually pulls state legislative data from an API, and persists it to a SQLite3 .db file. When I try to run the script as a daemon in the background, the process immediately stops and I'm given the following error.
stateleg.rb: process with pid 4666 started.
Traceback (most recent call last):
11: from stateleg_daemon.rb:4:in `<main>'
10: from /usr/local/rvm/gems/ruby-2.5.1/gems/daemons-1.3.1/lib/daemons.rb:149:in `run'
9: from /usr/local/rvm/gems/ruby-2.5.1/gems/daemons-1.3.1/lib/daemons/cmdline.rb:121:in `catch_exceptions'
8: from /usr/local/rvm/gems/ruby-2.5.1/gems/daemons-1.3.1/lib/daemons.rb:150:in `block in run'
7: from /usr/local/rvm/gems/ruby-2.5.1/gems/daemons-1.3.1/lib/daemons/controller.rb:59:in `run'
6: from /usr/local/rvm/gems/ruby-2.5.1/gems/daemons-1.3.1/lib/daemons/application.rb:307:in `start'
5: from /usr/local/rvm/gems/ruby-2.5.1/gems/daemons-1.3.1/lib/daemons/application.rb:228:in `start_load'
4: from /usr/local/rvm/gems/ruby-2.5.1/gems/daemons-1.3.1/lib/daemons/application.rb:228:in `load'
3: from /home/ubuntu/stateleg.rb:8:in `<top (required)>'
2: from /home/ubuntu/stateleg.rb:8:in `new'
1: from /usr/local/rvm/gems/ruby-2.5.1/gems/sqlite3-1.4.1/lib/sqlite3/database.rb:89:in `initialize'
/usr/local/rvm/gems/ruby-2.5.1/gems/sqlite3-1.4.1/lib/sqlite3/database.rb:89:in `open_v2': unable to open database file (SQLite3::CantOpenException)
When I try to run the script in the foreground, the script runs perfectly, and the necessary information is written to the .db file.
How can I make this daemon open the database file? Are SQLite3 and Ruby daemons in some way incompatible? Any information at all would be tremendously helpful.
This is the entirety of the daemon script.
require 'daemons'
Daemons.run('stateleg.rb')
When something is "daemonized" it's usually running in a different working directory than the one you expect. This is especially true for services that are spun up on boot, such as through systemd, or on cron.
In order to account for this you need to specify the full path to files you're intending to work with. These are called absolute paths since they're not impacted by the current working directory. /a/b/c is an absolute path, it starts with /, but b/c is relative. If you're in /a it's equivalent, but it won't work outside of that scope.
If you know the location of that file relative to your script, you can usually do this:
Daemons.run(File.expand_path('stateleg.rb', __dir__))
Where __dir__ is the directory in which the currently executing script file is stored.

AWS Codedeploy failed during Install: UnknownError "\xCC" from ASCII-8BIT to UTF-8

I have tried to troubleshoot an UnknownError returned by the CodeDeploy Agent on an Amazon Linux EC2 instance. I push files from my local git repo on my Mac to a S3 bucket, and deploy from there to the EC2 instance.
I have edited the /etc/codedeploy-agent/conf/codedeployagent.yml and set :verbose: to true on a EC2 instance. I tried to deploy again and open codedeploy-agent.log at /var/log/aws/codedeploy-agent.
The last lines in log before failing shows that the agent installs ELB scripts provided by AWS.
2015-06-19 08:09:13 DEBUG [codedeploy-agent(7637)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandBuilder: Copying /opt/codedeploy-agent/deployment-root/c6b25857-8911-4f61-8b30-b39f0c34c395/d-6UZ0VFID9/deployment-archive/scripts/stop_server.sh to /var/www/html/scripts/stop_server.sh
2015-06-19 08:09:13 DEBUG [codedeploy-agent(7637)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandBuilder: Copying /opt/codedeploy-agent/deployment-root/c6b25857-8911-4f61-8b30-b39f0c34c395/d-6UZ0VFID9/deployment-archive/scripts/register_with_elb.sh to /var/www/html/scripts/register_with_elb.sh
2015-06-19 08:09:13 DEBUG [codedeploy-agent(7637)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller: Calling PutHostCommandComplete: "Code Error"
2015-06-19 08:09:13 INFO [codedeploy-agent(7637)]: [Aws::CodeDeployCommand::Client 200 0.084236 0 retries] put_host_command_complete(command_status:"Failed",diagnostics:{format:"JSON",payload:"{\"error_code\":5,\"script_name\":\"\",\"message\":\"\\\"\\\\xCC\\\" from ASCII-8BIT to UTF-8\",\"log\":\"\"}"},host_command_identifier:"WyJjb20uYW1hem9uLmFwb2xsby5kZXBsb3ljb250cm9sLmRvbWFpbi5Ib3N0Q29tbWFuZElkZW50aWZpZXIiLHsiZGVwbG95bWVudElkIjoiQ29kZURlcGxveS9ldS13ZXN0LTEvUHJvZC9hcm46YXdzOnNkczpldS13ZXN0LTE6NzMzNTE3MzY5MDAyOmRlcGxveW1lbnQvZC02VVowVkZJRDkiLCJob3N0SWQiOiJhcm46YXdzOmVjMjpldS13ZXN0LTE6NzMzNTE3MzY5MDAyOmluc3RhbmNlL2ktZWRjYTkzNDciLCJjb21tYW5kTmFtZSI6Ikluc3RhbGwiLCJjb21tYW5kUG9zaXRpb24iOjQsImNvbW1hbmRBdHRlbXB0IjoxfV0=")
The last files installed are not related. Since I also have tried to remove the scripts I mention above. The error seems to be upstream and Ruby related.
2015-06-19 08:09:13 ERROR [codedeploy-agent(7637)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller: Error during perform: Encoding::UndefinedConversionError - "\xCC" from ASCII-8BIT to UTF-8 - /opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/install_instruction.rb:165:in `encode'
/opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/install_instruction.rb:165:in `to_json'
/opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/install_instruction.rb:165:in `to_json'
/opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/installer.rb:38:in `block in install'
/opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/installer.rb:37:in `open'
/opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/installer.rb:37:in `install'
/opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/command_executor.rb:103:in `block in <class:CommandExecutor>'
/opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/command_executor.rb:51:in `execute_command'
/opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/command_poller.rb:123:in `process_command'
/opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/command_poller.rb:56:in `perform'
/opt/codedeploy-agent/lib/instance_agent/agent/base.rb:28:in `run'
/opt/codedeploy-agent/lib/instance_agent/runner/child.rb:38:in `block in run'
/opt/codedeploy-agent/lib/instance_agent/runner/child.rb:55:in `with_error_handling'
/opt/codedeploy-agent/lib/instance_agent/runner/child.rb:37:in `run'
/opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/child.rb:70:in `block in run_with_error_handling'
/opt/codedeploy-agent/lib/instance_agent/runner/child.rb:55:in `with_error_handling'
/opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/child.rb:69:in `run_with_error_handling'
/opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/child.rb:33:in `block in start'
/opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/child.rb:22:in `loop'
/opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/child.rb:22:in `start'
/opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/master.rb:198:in `block in spawn_child'
/opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/master.rb:196:in `fork'
/opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/master.rb:196:in `spawn_child'
/opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/master.rb:188:in `block in spawn_children'
/opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/master.rb:187:in `times'
/opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/master.rb:187:in `spawn_children'
/opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/master.rb:133:in `start'
/opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/master.rb:36:in `block in start'
/opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/master.rb:35:in `fork'
/opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/master.rb:35:in `start'
/opt/codedeploy-agent/bin/codedeploy-agent:37:in `block (2 levels) in <main>'
/opt/codedeploy-agent/vendor/gems/gli-2.5.6/lib/gli/command_support.rb:130:in `call'
/opt/codedeploy-agent/vendor/gems/gli-2.5.6/lib/gli/command_support.rb:130:in `execute'
/opt/codedeploy-agent/vendor/gems/gli-2.5.6/lib/gli/app_support.rb:262:in `block in call_command'
/opt/codedeploy-agent/vendor/gems/gli-2.5.6/lib/gli/app_support.rb:275:in `call'
/opt/codedeploy-agent/vendor/gems/gli-2.5.6/lib/gli/app_support.rb:275:in `call_command'
/opt/codedeploy-agent/vendor/gems/gli-2.5.6/lib/gli/app_support.rb:69:in `run'
/opt/codedeploy-agent/bin/codedeploy-agent:84:in `<main>'
I have tried $ grep --color -in -r '\xCC' /my/folder/ which returns something like
Binary file /my/folder/a.png matches
But also returned /my/folder/wp-content/plugins/wordpress-seo/admin/class-metabox.php:348:'Ì'
So I removed the plugin and tried to convert the filenames from ASCII to UTF-8 with convmv (it didn't convert anything). But without success.
I have also updated several gems according to a couple of StackOverflow threads.
How could I mitigate this error? I find the error message from Amazon CodeDeploy vaugue and hard to troubleshoot and I've run out of ideas.
Issue looks to be LANG env has not been set when Installing / Starting CodeDeploy.
I found that if I were to restart CodeDeploy via the CLI then the app would deploy without issue.
You can check the LANG env of the codedploy process by running
ps auxe |grep codede
We deploy CodeDeploy via puppet and have to set (environment => 'LANG=en_US.UTF-8') when running the install script.
Try updating codedeploy-agent. It worked for me.
SSH into your instance and run this command:
sudo /opt/codedeploy-agent/bin/install auto
The LANG environment variable must be defined when the deployment starts or else the CodeDeploy install event fails.
You can ensure that CodeDeploy has it by editing the CodeDeploy agent service configuration:
sudo vim /etc/init.d/codedeploy-agent
You can export the variable when the service first starts with this line: export LANG="en_US.UTF-8".
So the start block will look like this:
start() {
echo -n $"Starting $prog:"
export LANG="en_US.UTF-8"
cd $AGENT_ROOT
nohup $BIN start >/dev/null </dev/null 2>&1 # Try to start the server
exit $?
}
Some additional notes
For me the problem was only occurring during an auto scale event. In other words I could manually launch the instance and then deploy just fine, but not right when a new instance was launched. This indicates a race condition in the sense that the environment is not ready as soon as the service starts. I tried changing the upstart timing by running:
update-rc.d -f codedeploy-agent remove
update-rc.d codedeploy-agent start 99 2 3 4 5 . stop 20 0 1 6 .
but this did not work. Setting the variable in the start block guaranteed that it was available in time.
To ensure you have all required environment variables available to CodeDeploy as soon as it starts it's probably wise to follow Amazon's advice:
we recommend that you keep the agent service in a stopped state and use the launch scripts to start the agent service

Cloudfoundry Deploy Micro Bosh Fails

I am trying to follow this guide here: http://kendrickcoleman.com/index.php/Tech-Blog/from-zero-to-cloud-foundry-on-vsphere-part-1-how-to-install-microbosh.html
I am up to step 13.
I get a error in the log:
I, [2014-10-08T15:57:11.460375 #30531] [attach_disk(vm-3bfd53b7-1bac-44e1-b6a9-87454f9d0f88, disk-e1e99cad-1c98-4096-a78c-4b81ee1509ee)] INFO -- : Updating agent env to: {"vm"=>{"name"=>"vm-3bfd53b7-1bac-44e1-b6a9-87454f9d0f88", "id"=>"vm-8857"},
"agent_id"=>"bm-913097b0-3865-4f87-b5b1-9608e66b34c9",
"networks"=>
{"bosh"=>
{"cloud_properties"=>{"name"=>"Network Private"},
"netmask"=>"mynetmask",
"gateway"=>"mygateway",
"ip"=>"myip",
"dns"=>["mydns"],
"type"=>nil,
"default"=>["dns", "gateway"],
"mac"=>"00:50:56:93:17:23"}},
"disks"=>
{"system"=>"0",
"ephemeral"=>"1",
"persistent"=>{"disk-e1e99cad-1c98-4096-a78c-4b81ee1509ee"=>"2"}},
"ntp"=>["ntp.example.com.au"],
"blobstore"=>
{"provider"=>"local",
"options"=>{"blobstore_path"=>"/var/vcap/micro_bosh/data/cache"}},
"mbus"=>"https://vcap:b00tstrap#0.0.0.0:6868",
"env"=>{"bosh"=>{"password"=>nil}}}
I, [2014-10-08T15:57:18.350121 #30531] [attach_disk(vm-3bfd53b7-1bac-44e1-b6a9-87454f9d0f88, disk-e1e99cad-1c98-4096-a78c-4b81ee1509ee)] INFO -- : Attaching disk
I, [2014-10-08T15:57:20.381994 #30531] [attach_disk(vm-3bfd53b7-1bac-44e1-b6a9-87454f9d0f88, disk-e1e99cad-1c98-4096-a78c-4b81ee1509ee)] INFO -- : Finished attaching disk
This is what my console says:
Started deploy micro bosh > Mount disk. Done (00:00:07)
Done deploy micro bosh > Updating persistent disk (00:00:17)
Started deploy micro bosh > Stopping agent services. Done (00:00:01)
Started deploy micro bosh > Applying micro BOSH spec/usr/local/rvm/gems/ruby-2.0.0-p576/gems/bosh_cli_plugin_micro-1.2732.0/lib/bosh/deployer/instance_manager/vsphere.rb:32:in `[]': no implicit conversion of String into Integer (TypeError)
from /usr/local/rvm/gems/ruby-2.0.0-p576/gems/bosh_cli_plugin_micro-1.2732.0/lib/bosh/deployer/instance_manager/vsphere.rb:32:in `update_spec'
from /usr/local/rvm/gems/ruby-2.0.0-p576/gems/bosh_cli_plugin_micro-1.2732.0/lib/bosh/deployer/instance_manager.rb:380:in `block in apply'
from /usr/local/rvm/gems/ruby-2.0.0-p576/gems/bosh_cli_plugin_micro-1.2732.0/lib/bosh/deployer/instance_manager.rb:85:in `step'
from /usr/local/rvm/gems/ruby-2.0.0-p576/gems/bosh_cli_plugin_micro-1.2732.0/lib/bosh/deployer/instance_manager.rb:378:in `apply'
from /usr/local/rvm/gems/ruby-2.0.0-p576/gems/bosh_cli_plugin_micro-1.2732.0/lib/bosh/deployer/instance_manager.rb:146:in `create'
from /usr/local/rvm/gems/ruby-2.0.0-p576/gems/bosh_cli_plugin_micro-1.2732.0/lib/bosh/deployer/instance_manager.rb:98:in `block in create_deployment'
from /usr/local/rvm/gems/ruby-2.0.0-p576/gems/bosh_cli_plugin_micro-1.2732.0/lib/bosh/deployer/instance_manager.rb:92:in `with_lifecycle'
from /usr/local/rvm/gems/ruby-2.0.0-p576/gems/bosh_cli_plugin_micro-1.2732.0/lib/bosh/deployer/instance_manager.rb:98:in `create_deployment'
from /usr/local/rvm/gems/ruby-2.0.0-p576/gems/bosh_cli_plugin_micro-1.2732.0/lib/bosh/cli/commands/micro.rb:179:in `perform'
from /usr/local/rvm/gems/ruby-2.0.0-p576/gems/bosh_cli-1.2732.0/lib/cli/command_handler.rb:57:in `run'
from /usr/local/rvm/gems/ruby-2.0.0-p576/gems/bosh_cli-1.2732.0/lib/cli/runner.rb:56:in `run'
from /usr/local/rvm/gems/ruby-2.0.0-p576/gems/bosh_cli-1.2732.0/lib/cli/runner.rb:16:in `run'
from /usr/local/rvm/gems/ruby-2.0.0-p576/gems/bosh_cli-1.2732.0/bin/bosh:7:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.0.0-p576/bin/bosh:23:in `load'
from /usr/local/rvm/gems/ruby-2.0.0-p576/bin/bosh:23:in `<main>'
from /usr/local/rvm/gems/ruby-2.0.0-p576/bin/ruby_executable_hooks:15:in `eval'
from /usr/local/rvm/gems/ruby-2.0.0-p576/bin/ruby_executable_hooks:15:in `<main>'
root#vmt-cf-01:/bosh/deployments#
I am not getting enough info to help my googleing. Any ideas?
thanks
Confirmed, this from Amit fixed my issue.
... In particular I'd guess that your apply_spec.properties.vcenter looks like an array instead of a hash. It's confusing because under cloud.properties.vcenters it looks the same, but there it should be an array. The difference is whether the appropriate line says - host: some_address or host: some_address (without the - to indicate array).

Cannot Start thin server Ruby Gem

I am trying to setup redmine on my server which is Redhat 6.2
I intend it to run with Nginx using thin ruby gem.
I was following http://www.redmine.org/projects/redmine/wiki/HowTo_configure_Nginx_to_run_Redmine
I did following things
gem install thin
thin install
this gives me init script under /etc/rc.d/thin The YML file config is as follows:
---
chdir: /app/redmine-root/
environment: development
address: 0.0.0.0
port: 5000
timeout: 30
log: log/thin.log
pid: tmp/pids/thin.pid
max_conns: 1024
max_persistent_conns: 100
require: []
wait: 30
servers: 4
daemonize: true
Now when I do /etc/rc.d/thin start it shows
Starting server on 0.0.0.0:5000 ...
Starting server on 0.0.0.0:5001 ...
Starting server on 0.0.0.0:5002 ...
Starting server on 0.0.0.0:5003 ...
but when I see pids under /app/redmine-root/tmp/pids there are no Pids.
therefore, I can't see any service running. This is issue number 1
Second thing I'd like to ask that, in Nginx conf as suggested by the above link the upstream block is like as follows:
upstream thin_cluster {
server unix:/tmp/thin.0.sock;
server unix:/tmp/thin.1.sock;
server unix:/tmp/thin.2.sock;
server unix:/tmp/thin.3.sock;
}
But the pid file is in /app/redmine-root/tmp/pids should this work?
Third, At the time of Install I marked the env as production
RAILS_ENV=production rake db:migrate
But whenever I do thin config -C /etc/thin/redmine.yml it changes to development.
Please note that I have RVM also. And the user & owner of /app/redmine-root/ is apache.
My nginx runs with apache and I am trying to run thin also as apache.
I have no background in Ruby. Any help is much appreciated.
EDIT
After suggestions, I found this in log.
/usr/local/lib/ruby/gems/2.0.0/gems/thin-1.5.1/lib/thin/backends/tcp_server.rb:16:in `connect': cannot load such file -- thin/connection (LoadError)
from /usr/local/lib/ruby/gems/2.0.0/gems/thin-1.5.1/lib/thin/backends/base.rb:55:in `block in start'
from /usr/local/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `call'
from /usr/local/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run_machine'
from /usr/local/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run'
from /usr/local/lib/ruby/gems/2.0.0/gems/thin-1.5.1/lib/thin/backends/base.rb:63:in `start'
from /usr/local/lib/ruby/gems/2.0.0/gems/thin-1.5.1/lib/thin/server.rb:159:in `start'
from /usr/local/lib/ruby/gems/2.0.0/gems/thin-1.5.1/lib/thin/controllers/controller.rb:86:in `start'
from /usr/local/lib/ruby/gems/2.0.0/gems/thin-1.5.1/lib/thin/runner.rb:187:in `run_command'
from /usr/local/lib/ruby/gems/2.0.0/gems/thin-1.5.1/lib/thin/runner.rb:152:in `run!'
from /usr/local/lib/ruby/gems/2.0.0/gems/thin-1.5.1/bin/thin:6:in `<top (required)>'
from /usr/local/bin/thin:23:in `load'
from /usr/local/bin/thin:23:in `<main>'
is it because, I am trying to configure on UNIX socket or its something else??
You should add gem thin to your Gemfile
PS: see at https://github.com/macournoyer/thin/issues/115 for example.

Resources