Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amazon AWS issues #358

Open
serebrov opened this issue Dec 19, 2014 · 13 comments
Open

Amazon AWS issues #358

serebrov opened this issue Dec 19, 2014 · 13 comments

Comments

@serebrov
Copy link

I am learning AWS OpsWorks and trying to deploy a single mongodb instance via OpsWorks.
On the way I had problems using the mongodb recipe with both Amazon Linux 2014.09 and Ubuntu 14.04.

Ubuntu 14.04

The default mongo config file is is /etc/mongodb.conf while ubuntu actually uses /etc/monod.conf.
So any custom mongo settings are not applied.

The solution seems to be (I didn't actually verify this) to change [:mongodb][:dbconfig_file] setting from '/etc/mongodb.conf' to '/etc/mongod.conf'.
And I think this should be fixed or mentioned in documentation.

Amazon Linux 2014.09

Here there is a problem with changing the default db settings using the approach described in the readme.
The following code leads to the deployment error:

mongodb_instance "mongodb" do
  bind_ip "127.0.0.1,#{node[:opsworks][:instance][:private_ip]}"
end

And the error is:

[2014-12-18T20:35:10+00:00] INFO: template[/etc/init.d/mongod] sending run action to execute[mongodb-systemctl-daemon-reload] (immediate)
[2014-12-18T20:35:10+00:00] INFO: Processing execute[mongodb-systemctl-daemon-reload] action run (mongodb-singlenode::default line 174)

================================================================================
Error executing action `run` on resource 'execute[mongodb-systemctl-daemon-reload]'
================================================================================

Errno::ENOENT
-------------
No such file or directory - systemctl

Resource Declaration:
---------------------
# In /var/lib/aws/opsworks/cache.stage2/cookbooks/mongodb/definitions/mongodb.rb

174:   execute 'mongodb-systemctl-daemon-reload' do
175:     command 'systemctl daemon-reload'
176:     action :nothing
177:   end
178: 

Compiled Resource:
------------------
# Declared in /var/lib/aws/opsworks/cache.stage2/cookbooks/mongodb/definitions/mongodb.rb:174:in `block in from_file'

execute("mongodb-systemctl-daemon-reload") do
params {:mongodb_type=>"mongod", :action=>[:enable, :start], :logpath=>"/var/log/mongodb/mongodb.log", :dbpath=>"/data", :configservers=>[], :replicaset=>nil, :notifies=>[], :bind_ip=>"127.0.0.1,172.31.45.215", :name=>"mongod"}
action [:nothing]
retries 0
retry_delay 2
command "systemctl daemon-reload"
backup 5
returns 0
cookbook_name "mongodb-singlenode"
recipe_name "default"
end

Here it seems like there is some OS-level incompatibility and Amazon Linux does not have systemctl.
The solution was to avoid this restart - I had to set the bind_ip before including the recipe:

node.normal[:mongodb][:config][:bind_ip] = "127.0.0.1,#{node[:opsworks][:instance][:private_ip]}"

include_recipe "mongodb::default"

And one more issue with Amazon Linux is that it shows the following warning during the deploy:

[2014-12-18T21:23:48+00:00] WARN: CentOS doesn't provide mongodb, forcing use of mongodb-org repo
[2014-12-18T21:23:48+00:00] WARN: 10gen_repo is deprecated, use mongodb_org_repo

Sorry for posting multiple problems as a single issue, I just not sure if these are actual problems or this is just me doing something wrong.

@mirzali
Copy link

mirzali commented Dec 24, 2014

I have installed it into the Ubuntu 14. The cookbook makes config file (among others) at /etc/mongodb.conf . However the problem is that service mongodb is already started with a config file at /etc/mongod.conf (without any custom settings). I presume this is from the default package installation.

So one of the possible solutions is to

service mongod stop
service mongodb start

and it will pick up the correct config file. This does still work after restart, but if you want to make sure, you could remove the mongod(.conf) files from /etc/init and /etc/init.d

@geerzo
Copy link

geerzo commented Mar 8, 2015

I believe this is fixed with PR #373

@nabulaer
Copy link

on first install it will run mongod upstart instead of mongodb , but stop and start the instances and it will revert to mongodb with the correct config

@joshystuart
Copy link

I'm still having issues with this. Can anyone detail a step by step solution? Or a more permanent fix in code?

@geerzo I am trying your suggested fix but it doesn't seem to be working.

@geerzo
Copy link

geerzo commented Mar 29, 2015

@crimsonronin You applied the PR I submitted to your local copy and you are still getting this error?

@joshystuart
Copy link

Hi @geerzo, I tried the PR but it still threw up the same error. I then commented out the whole section and it seemed to work fine evergram@a9f76e5.

I haven't had time to look into a more permanent solution yet.

@dmarcelino
Copy link

👍 I've also experienced this.

on first install it will run mongod upstart instead of mongodb , but stop and start the instances and it will revert to mongodb with the correct config

@nabulaer's suggestion worked, thanks!

dmarcelino added a commit to dmarcelino/aws-cookbook-boilerplate that referenced this issue May 12, 2015
@rentrop
Copy link

rentrop commented Jul 1, 2015

Are there any updates on this topic?
Just tried it again: mongodb::default works fine on Ubuntu LTS 14.04 but fails on Amazon Linux.

@geerzo
Copy link

geerzo commented Jul 8, 2015

I haven't done anything here because it works for me. I'm using this fork https://github.com/geerzo/chef-mongodb/tree/amazon_linux_support which is where the PR came from. I'm curious why it won't work for others though. I'm running multiple Amazon Linux servers using it just fine.

@geerzo
Copy link

geerzo commented Jul 8, 2015

Actually, one note is I'm running replica-sets, I don't think I've tried running mongoldb:default in a long time. Maybe that is broken?

@mitchross
Copy link

Any update, I think mongodb:default is broken?

@miguelcnf
Copy link

The problem is this platform check and the fact that amazon reports as rhel familly.

chef (12.4.3)> node[:platform_family]
 => "rhel"
chef (12.4.3)> node[:platform_version]
 => "2015.09"
chef (12.4.3)> node[:platform_version].to_i >= 7
 => true
chef (12.4.3)> node[:platform_version].to_i
 => 2015
chef (12.4.3)> node[:platform]
 => "amazon"

It should check platform and not only platform_family.

@lianyi
Copy link

lianyi commented Dec 9, 2015

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants