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

Conditionally support upstart #19

Closed
wants to merge 1 commit into from
Closed

Conditionally support upstart #19

wants to merge 1 commit into from

Conversation

gmr
Copy link

@gmr gmr commented Mar 26, 2014

This cookbook will fail to start CouchDB and exit out on Ubuntu systems (and I assume debian proxy) as the package installs CouchDB with an Upstart init configuration instead of an init.d script.

@wohali
Copy link
Owner

wohali commented Mar 28, 2014

Debian doesn't have upstart by default. Can you change this to just Ubuntu and I can accept? Thanks.

@scalp42
Copy link

scalp42 commented Apr 11, 2014

@gmr are you on it please?

@michaelwittig
Copy link

I tried to use this fix with Ubuntu 12.04 and it doesn't work.

The problem ist, dass if you install apt-get install couchdb on Ubuntu you can not stop the service. https://issues.apache.org/jira/browse/COUCHDB-1795

include_recipe 'erlang' if node['couch_db']['install_erlang']
include_recipe 'apt::default'

case node['platform_family']
when 'rhel'
  group 'couchdb' do
    system true
  end

  user 'couchdb' do
    comment 'Couchdb Database Server'
    gid 'couchdb'
    shell '/bin/bash'
    home '/var/lib/couchdb'
    system true
  end

  include_recipe 'yum-epel'
end

package 'couchdb' do
  package_name value_for_platform(
    'openbsd' => { 'default' => 'apache-couchdb' },
    'gentoo' => { 'default' => 'dev-db/couchdb' },
    'default' => 'couchdb'
    )
end

if platform_family?('debian')
  execute "kill-couchdb" do
    command "sudo killall -u couchdb"
    action :run
  end
end

template '/etc/couchdb/local.ini' do
  source 'local.ini.erb'
  owner 'couchdb'
  group 'couchdb'
  mode 0664
  variables(
    :config => node['couch_db']['config']
  )
  notifies :restart, 'service[couchdb]'
end

directory '/var/lib/couchdb' do
  owner 'couchdb'
  group 'couchdb'
  recursive true
  path value_for_platform(
    'openbsd' => { 'default' => '/var/couchdb' },
    'freebsd' => { 'default' => '/var/couchdb' },
    'gentoo' => { 'default' => '/var/couchdb' },
    'default' => '/var/lib/couchdb'
  )
end

service 'couchdb' do
  if platform_family?('rhel', 'fedora')
    start_command '/sbin/service couchdb start &> /dev/null'
    stop_command '/sbin/service couchdb stop &> /dev/null'
  end
  supports [:restart, :status]
  action [:enable, :start]
end

works for me

@wohali
Copy link
Owner

wohali commented Apr 24, 2014

Thanks @michaelwittig. That bug is slated to be fixed in CouchDB 1.6.0 which should be released very shortly. Once it's avialable can you re-test if this upstart approach works?

I'm also still waiting on @gmr to except debian from this PR before merging. ;)

@michaelwittig
Copy link

Ok. CouchDB is 1.0.1 on Ubuntu 12.04 :) I tried to Install Ubuntu 1.5.0 from source (couchdb::source) and the recipe works perfectly.

I Just missed

include_recipe "build-essential"

at the beginning of the source recipe

@scalp42
Copy link

scalp42 commented Apr 25, 2014

What worked for us (dragons ahead):

chef_gem 'chef-rewind' do
  version '0.0.8'
end

require 'chef/rewind'

include_recipe 'couchdb'

rewind 'service[couchdb]' do
  stop_command '/etc/init.d/couchdb stop; sleep 1; pkill -U couchdb'
  restart_command '/etc/init.d/couchdb stop; sleep 1; pkill -U couchdb; /etc/init.d/couchdb start'
  status_command 'pgrep -u couchdb'
  supports [:restart, :status]
  action [:enable, :start]
end

service 'couchdb' do
  action [:enable, :start]
end

@wohali
Copy link
Owner

wohali commented Sep 23, 2014

Hey @michaelwittig and @gmr CouchDB 1.6.1 is out - can you please review and work through the issues on this PR? I'm afraid I don't have time to fix it from first principles, but if you can clean up this PR and squash I'm happy to merge.

@wohali
Copy link
Owner

wohali commented May 7, 2015

No action for 6 months, closing. Please feel free to reopen if you are still having issues with 1.6.1.

@wohali wohali closed this May 7, 2015
@gmr
Copy link
Author

gmr commented May 8, 2015

I'm not using Chef or CouchDB anymore, but the change was fairly trivial.

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 this pull request may close these issues.

None yet

4 participants