opengovfoundation / madison

Madison is a platform for lawmakers to share legislation with their citizens, allowing the community to add comments and suggest improvements.
GNU General Public License v3.0
675 stars 108 forks source link

make chef-cook server error #1063

Closed IuliiSe closed 7 years ago

IuliiSe commented 7 years ago

Please help.


~/madison# make chef-cook server=user@hostname
knife solo cook user@hostname -c .chef/knife.rb
Running Chef on hostname...
Checking Chef version...
user@hostname's password: 

Installing Berkshelf cookbooks to 'config/chef/cookbooks'...
Resolving cookbook dependencies...
Fetching 'base-server' from git@github.com:opengovfoundation/cookbook-base-server.git (at master)

ERROR: Berkshelf::GitCommandError: Git error: command `git clone git@github.com:opengovfoundation/cookbook-base-server.git "/root/.berkshelf/.cache/git/c5687aeade2da2ad96fa1ed768a1d47db0d07a17" --bare --no-hardlinks` failed. If this error persists, try removing the cache directory at '/root/.berkshelf/.cache/git/c5687aeade2da2ad96fa1ed768a1d47db0d07a17'.Output from the command:

Cloning into bare repository '/root/.berkshelf/.cache/git/c5687aeade2da2ad96fa1ed768a1d47db0d07a17'...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.
Makefile:107: recipe for target 'chef-cook' failed
make: *** [chef-cook] Error 100```
sethetter commented 7 years ago

@IuliiSe I pushed a commit to the dev branch to update the git urls in the Berksfile to use https instead of git. Clone that down, do rm -rf config/chef/cookbooks then make berks and try the chef-prepare and chef-cook commands again.

IuliiSe commented 7 years ago

@sethetter I've completed the suggested step. But, chef-cook still return errors:

  ================================================================================
  Recipe Compile Error in /root/chef-solo/local-mode-cache/cache/cookbooks/madison-server/recipes/default.rb
  ================================================================================

  Net::HTTPFatalError
  -------------------
  500 "Internal Server Error"

  Cookbook Trace:
  ---------------
    /root/chef-solo/local-mode-cache/cache/cookbooks/lamp-server/recipes/configure-sites.rb:50:in `rescue in block in from_file'
    /root/chef-solo/local-mode-cache/cache/cookbooks/lamp-server/recipes/configure-sites.rb:47:in `block in from_file'
    /root/chef-solo/local-mode-cache/cache/cookbooks/lamp-server/recipes/configure-sites.rb:45:in `each'
    /root/chef-solo/local-mode-cache/cache/cookbooks/lamp-server/recipes/configure-sites.rb:45:in `from_file'
    /root/chef-solo/local-mode-cache/cache/cookbooks/lamp-server/recipes/default.rb:15:in `from_file'
    /root/chef-solo/local-mode-cache/cache/cookbooks/madison-server/recipes/default.rb:8:in `from_file'

  Relevant File Content:
  ----------------------
  /root/chef-solo/local-mode-cache/cache/cookbooks/lamp-server/recipes/configure-sites.rb:

   43:  end
   44:  
   45:  sites.each do |site_name|
   46:    # Get the users' real data from the vault.
   47:    begin
   48:      Chef::EncryptedDataBagItem.load_secret
   49:    rescue
   50>>     full_site = Chef::DataBagItem.load('sites', site_name)
   51:    else
   52:      full_site = Chef::EncryptedDataBagItem.load('sites', site_name).to_hash
   53:    end
   54:  
   55:    # If the node is one this site belongs to, set it up on the box.
   56:    if full_site['servers'] and full_site['servers'].include? node.name
   57:  
   58:      # Apache setup.
   59:  

  Platform:
  ---------
  x86_64-linux-gnu

  Running handlers:
[2016-11-15T16:43:23+00:00] ERROR: Running exception handlers
  Running handlers complete
[2016-11-15T16:43:23+00:00] ERROR: Exception handlers complete
  Chef Client failed. 5 resources updated in 35 seconds
[2016-11-15T16:43:23+00:00] FATAL: Stacktrace dumped to /root/chef-solo/local-mode-cache/cache/chef-stacktrace.out
[2016-11-15T16:43:23+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2016-11-15T16:43:23+00:00] ERROR: 500 "Internal Server Error"
[2016-11-15T16:43:23+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
ERROR: RuntimeError: chef-solo failed. See output above.
Makefile:107: recipe for target 'chef-cook' failed
make: *** [chef-cook] Error 100
sethetter commented 7 years ago

@IuliiSe did you configure a site in config/chef/data_bags/sites/? There is an example in there.

IuliiSe commented 7 years ago

@sethetter yes, i did configure madison.json. Just double checked it. Changed url to IP instead of domain name. Still chef-cook returns errors.

    ================================================================================
    Error executing action `install` on resource 'apt_package[mariadb-server-10.0]'
    ================================================================================

    Mixlib::ShellOut::ShellCommandFailed
    ------------------------------------
    Expected process to exit with [0], but received '100'
    ---- Begin output of apt-get -q -y install mariadb-server-10.0=10.0.28+maria-1~xenial ----
    STDOUT: Reading package lists...
    Building dependency tree...
    Reading state information...
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:

    The following packages have unmet dependencies:
     mariadb-server-10.0 : Depends: mariadb-client-10.0 (>= 10.0.28+maria-1~xenial) but it is not going to be installed
                           Depends: mariadb-server-core-10.0 (>= 10.0.28+maria-1~xenial) but it is not going to be installed
    STDERR: E: Unable to correct problems, you have held broken packages.
    ---- End output of apt-get -q -y install mariadb-server-10.0=10.0.28+maria-1~xenial ----
    Ran apt-get -q -y install mariadb-server-10.0=10.0.28+maria-1~xenial returned 100

    Cookbook Trace:
    ---------------
    /root/chef-solo/local-mode-cache/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:41:in `run_action'

    Resource Declaration:
    ---------------------
    # In /root/chef-solo/local-mode-cache/cache/cookbooks/mariadb/recipes/_debian_server.rb

     53: package "mariadb-server-#{node['mariadb']['install']['version']}" do
     54:   action :install
     55: end

    Compiled Resource:
    ------------------
    # Declared in /root/chef-solo/local-mode-cache/cache/cookbooks/mariadb/recipes/_debian_server.rb:53:in `from_file'

    apt_package("mariadb-server-10.0") do
      package_name "mariadb-server-10.0"
      action [:install]
      retries 0
      retry_delay 2
      default_guard_interpreter :default
      declared_type :package
      cookbook_name "mariadb"
      recipe_name "_debian_server"
    end

    Platform:
    ---------
    x86_64-linux-gnu

Recipe: chef-client::init_service
  * service[chef-client] action restart
    - restart service service[chef-client]

Running handlers:
[2016-11-15T21:53:22+00:00] ERROR: Running exception handlers
Running handlers complete
[2016-11-15T21:53:22+00:00] ERROR: Exception handlers complete
Chef Client failed. 45 resources updated in 54 seconds
[2016-11-15T21:53:22+00:00] FATAL: Stacktrace dumped to /root/chef-solo/local-mode-cache/cache/chef-stacktrace.out
[2016-11-15T21:53:22+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2016-11-15T21:53:22+00:00] ERROR: apt_package[mariadb-server-10.0] (mariadb::_debian_server line 53) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '100'
---- Begin output of apt-get -q -y install mariadb-server-10.0=10.0.28+maria-1~xenial ----
STDOUT: Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 mariadb-server-10.0 : Depends: mariadb-client-10.0 (>= 10.0.28+maria-1~xenial) but it is not going to be installed
                       Depends: mariadb-server-core-10.0 (>= 10.0.28+maria-1~xenial) but it is not going to be installed
STDERR: E: Unable to correct problems, you have held broken packages.
---- End output of apt-get -q -y install mariadb-server-10.0=10.0.28+maria-1~xenial ----
Ran apt-get -q -y install mariadb-server-10.0=10.0.28+maria-1~xenial returned 100
[2016-11-15T21:53:22+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
ERROR: RuntimeError: chef-solo failed. See output above.
Makefile:107: recipe for target 'chef-cook' failed
make: *** [chef-cook] Error 100
IuliiSe commented 7 years ago

@sethetter Does chef-cookneed to install mariadb (as above)?

sethetter commented 7 years ago

@IuliiSe I think the issue may be the Ubuntu version. Could you try the provisioning on an Ubuntu 14.04 LTS server?

IuliiSe commented 7 years ago

@sethetter there is a new issue with berkshelf

WARNING: #<LoadError: cannot load such file -- berkshelf>
WARNING: Berkshelf could not be loaded
WARNING: Please add the berkshelf gem to your Gemfile or install it manually with `gem install berkshelf`
Uploading the kitchen...
sethetter commented 7 years ago

@IuliiSe try gem install berkshelf for now. I added it to the Gemfile in the dev branch. Thanks for finding that!

IuliiSe commented 7 years ago

This is solved. Thank you @sethetter !

sethetter commented 7 years ago

Great! What was the solution?

On Nov 20, 2016 2:51 PM, "IuliiSe" notifications@github.com wrote:

This is solved. Thank you @sethetter https://github.com/sethetter !

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/opengovfoundation/madison/issues/1063#issuecomment-261804739, or mute the thread https://github.com/notifications/unsubscribe-auth/AAoAjIxJCA8XjRe6KdjN7HskGlstIZclks5rALLagaJpZM4Kx2Sc .

IuliiSe commented 7 years ago

The key issue was with the Ubuntu version. Needed to downgrade to Ubuntu 14.04 LTS. Needed to fetch the latest Gemfile from dev and update ssh keys. But, cap deploy causes a new issue. I opened a new ticket asking for support.