GithubHelp home page GithubHelp logo

litaio / chef-lita Goto Github PK

View Code? Open in Web Editor NEW
17.0 17.0 16.0 87 KB

A Chef cookbook for installing Lita.

License: Apache License 2.0

Ruby 85.75% HTML 8.70% Shell 5.55%
chatops chef-cookbook devops lita ruby

chef-lita's People

Contributors

bhouse avatar esigler avatar harlanbarnes avatar hortoncd avatar jimmycuadra avatar mattmencel avatar mtylty avatar ngtjah avatar ptqa avatar shortdudey123 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

chef-lita's Issues

Adding auth groups

Is there away to trigger lita auth add from chef? So that this can be automated.

You could use #inspect instead of quoting/parsing symbols

Object#inspect produces valid ruby code with most of basic types (Int, String, Symbol, Array, ...). Works find in my (not public :() Lita cookbook.

>> puts 42.inspect
42
=> nil
>> puts "bar".inspect
"bar"
=> nil
>> puts :foo.inspect                                                                                                                    
:foo
=> nil
>> puts [:a, :b, :c].inspect                                                                                                            
[:a, :b, :c]
=> nil

Deprecated config.adapter - New HipChat 2.0.0 plugin requires config.adapters

[2014-10-23 15:34:52 UTC] WARN: config.adapter is deprecated and will be removed in Lita 5.0. Use config.adapters instead.
[2014-10-23 15:34:52 UTC] FATAL: Configuration attribute "jid" is required for "hipchat" adapter.

According to the docs the new way for adapters is this...

config.adapters.hipchat.jid = "......."

I've manually tested that and the newer HipChat adapter works with that change.

Rack 2.0.1 breaks `bundle install`

As Rack 2.0.1 now requires Ruby 2.2.2, the converging with the lita-cookbook fails:

================================================================================
           Error executing action `run` on resource 'execute[bundle-install-lita]'
           ================================================================================
​
           Mixlib::ShellOut::ShellCommandFailed
           ------------------------------------
           Expected process to exit with [0], but received '5'
           ---- Begin output of bundle install --path vendor/ --binstubs bin ----
           STDOUT: Fetching gem metadata from https://rubygems.org/.........
           Fetching version metadata from https://rubygems.org/..
           Resolving dependencies...
           Using bundler 1.12.5
           Installing chronic 0.10.2
           Installing multi_json 1.12.1
           Installing eventmachine 1.2.0.1 with native extensions
           Installing multipart-post 2.0.0
           Installing websocket-extensions 0.1.2
           Installing rack 2.0.1
​
           Gem::InstallError: rack requires Ruby version >= 2.2.2.
           Installing i18n 0.7.0
           Installing ice_nine 0.11.2
           Installing json 2.0.1 with native extensions
           Installing mixlib-shellout 2.2.6
           Installing mini_portile2 2.1.0
           Installing pkg-config 1.1.7
           Installing socksify 1.7.0
           Installing terminal-table 1.6.0
           Installing thor 0.19.1
           Installing puma 3.4.0 with native extensions
           Installing rb-readline 0.5.3
           Installing redis 3.3.0
           Installing ruby_cowsay 0.1.1
           Installing dogapi 1.22.0
           Installing faraday 0.9.2
           Installing websocket-driver 0.6.4 with native extensions
           An error occurred while installing rack (2.0.1), and Bundler cannot continue.
           Make sure that `gem install rack -v '2.0.1'` succeeds before bundling.
           STDERR:
           ---- End output of bundle install --path vendor/ --binstubs bin ----
           Ran bundle install --path vendor/ --binstubs bin returned 5
​
           Cookbook Trace:
           ---------------
           /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:41:in `run_action'
           /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:49:in `block in run_action'
           /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:47:in `each'
           /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:47:in `run_action'
​
           Resource Declaration:
           ---------------------
           # In /tmp/kitchen/cache/cookbooks/lita/recipes/install.rb
​
            76: execute "bundle-install-lita" do
            77:   action :nothing
            78:   command "bundle install --path vendor/ --binstubs bin"
            79:   cwd node["lita"]["install_dir"]
            80:   user node["lita"]["daemon_user"]
            81:   notifies :run, "execute[chown-cleanup]", :immediately
            82:   notifies :restart, "service[lita]"
            83: end
            84:
​
           Compiled Resource:
           ------------------
           # Declared in /tmp/kitchen/cache/cookbooks/lita/recipes/install.rb:76:in `from_file'
​
           execute("bundle-install-lita") do
             action [:nothing]
             retries 0
             retry_delay 2
             default_guard_interpreter :execute
             command "bundle install --path vendor/ --binstubs bin"
             backup 5
             cwd "/opt/lita"
             returns 0
             user "nobody"
             declared_type :execute
             cookbook_name "lita"
             recipe_name "install"
           end
​
           Platform:
           ---------
           x86_64-linux
​
       Recipe: ntp::default
         * service[ntp] action restart
           - restart service service[ntp]
       Recipe: ntp::apparmor
         * service[apparmor] action restart
           - restart service service[apparmor]
       Recipe: jenkins::_master_war
         * runit_service[jenkins] action restart (up to date)
       Recipe: <Dynamically Defined Resource>
         * service[lita] action restart
​
           ================================================================================
           Error executing action `restart` on resource 'service[lita]'
           ================================================================================
​
           Mixlib::ShellOut::ShellCommandFailed
           ------------------------------------
           Expected process to exit with [0], but received '1'
           ---- Begin output of /usr/bin/sv restart /etc/service/lita ----
           STDOUT: fail: /etc/service/lita: unable to change to service directory: file does not exist
           STDERR:
           ---- End output of /usr/bin/sv restart /etc/service/lita ----
           Ran /usr/bin/sv restart /etc/service/lita returned 1
​
           Cookbook Trace:
           ---------------
           /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:41:in `run_action'
​
           Compiled Resource:
           ------------------
           # Declared in
​
           service("lita") do
             provider Chef::Provider::Service::Simple
             action [:nothing]
             supports {:restart=>true, :reload=>true, :status=>true}
             retries 0
             retry_delay 2
             default_guard_interpreter :default
             service_name "lita"
             pattern "lita"
             start_command "/usr/bin/sv start /etc/service/lita"
             stop_command "/usr/bin/sv stop /etc/service/lita"
             status_command "/usr/bin/sv status /etc/service/lita"
             restart_command "/usr/bin/sv restart /etc/service/lita"
           end
​
           Platform:
           ---------
           x86_64-linux
1 Comment Collaps

Freezing the Rack version in the /opt/lita/Gemfile does the trick:

$ cat /opt/lita/Gemfile
source "https://rubygems.org"

gem "rack", "1.6.4"
gem "lita", "~> 4.7.0"

gem "lita-slack"

Install to Non-Default Dir

Hello I had one small issue when using this cookbook.

I selected a directory to install to other than the default '/opt/lita' by doing this:

default[:lita][:install_dir]  = '/home/lita'
default[:lita][:log_dir]      = '/home/lita/logs'
default[:lita][:run_dir]      = '/home/lita/run'

For some reason everything works except that I end up with this one file that is incorrect.
[root@ngtrdev lita]# pwd
/etc/service/lita
[root@ngtrdev lita]# cat env/HOME
/opt/lita

I ended up just copy/pasting this section exactly how it was from 'attributes/init.rb' to my main(parent) cookbook's attributes file.

default['lita']['runit']['env'] = {
    'HOME' => node['lita']['install_dir'],
    'PATH' => [node['languages']['ruby']['bin_dir'],
               node['languages']['ruby']['gem_bin'],
               node['languages']['ruby']['ruby_dir']
    ].join(':')
}

Then Success
[root@ngtrdev lita]# cat env/HOME
/home/lita

I played around with it a bit and I suspect there is something I am not aware of that is happening when the non-default attributes files 'attributes/init.rb' is loaded.

I can see that when the node['lita']['runit']['env'] hash is passed to the 'runit_service' resource in 'recipes/init_service.rb' that the value is incorrect but I am just not quite sure why...

 {"HOME"=>"/opt/lita",
   "PATH"=>"/usr/local/rvm/rubies/ruby-2.2.3/bin:/usr/local/rvm/rubies/ruby-2.2.3/bin/gem:"}

-jah

lita, LANG, and US-ASCII

Hi Folks! I ran into an issue with encoding. I'm not really sure what the correct solution is, though I found a workaround. I'm opening this, since maybe folks have a suggestion, and if not, future people may appreciate it. Pretty sure litaio/lita-slack#42 is an instance of this.

Anyhow, on Ubuntu 12.04, using chef-lita, and runit, with the slack adapters. If users have non-ascii characters in their name, it causes lita-slack to crash:

2016-02-01_19:01:25.64141 /opt/lita/vendor/ruby/2.1.0/gems/activesupport-4.2.5.1/lib/active_support/core_ext/object/json.rb:34:in `encode': "\xC3" on US-ASCII (Encoding::InvalidByteSequenceError)
2016-02-01_19:01:25.64169   from /opt/lita/vendor/ruby/2.1.0/gems/activesupport-4.2.5.1/lib/active_support/core_ext/object/json.rb:34:in `to_json'
2016-02-01_19:01:25.64189   from /opt/lita/vendor/ruby/2.1.0/gems/activesupport-4.2.5.1/lib/active_support/core_ext/object/json.rb:34:in `to_json_with_active_support_encoder'
2016-02-01_19:01:25.64201   from /opt/lita/vendor/ruby/2.1.0/gems/activesupport-4.2.5.1/lib/active_support/json/encoding.rb:57:in `to_json'
2016-02-01_19:01:25.64215   from /opt/lita/vendor/ruby/2.1.0/gems/json-1.8.3/lib/json/common.rb:223:in `generate'
2016-02-01_19:01:25.64235   from /opt/lita/vendor/ruby/2.1.0/gems/json-1.8.3/lib/json/common.rb:223:in `generate'
2016-02-01_19:01:25.64251   from /opt/lita/vendor/ruby/2.1.0/gems/activesupport-4.2.5.1/lib/active_support/json/encoding.rb:101:in `stringify'
2016-02-01_19:01:25.64261   from /opt/lita/vendor/ruby/2.1.0/gems/activesupport-4.2.5.1/lib/active_support/json/encoding.rb:35:in `encode'
2016-02-01_19:01:25.64276   from /opt/lita/vendor/ruby/2.1.0/gems/activesupport-4.2.5.1/lib/active_support/json/encoding.rb:22:in `encode'
2016-02-01_19:01:25.64292   from /opt/lita/vendor/ruby/2.1.0/gems/activesupport-4.2.5.1/lib/active_support/core_ext/object/json.rb:37:in `to_json_with_active_support_encoder'
2016-02-01_19:01:25.64307   from /opt/lita/vendor/ruby/2.1.0/gems/multi_json-1.11.2/lib/multi_json/adapters/json_common.rb:19:in `dump'
2016-02-01_19:01:25.64326   from /opt/lita/vendor/ruby/2.1.0/gems/multi_json-1.11.2/lib/multi_json/adapter.rb:25:in `dump'
2016-02-01_19:01:25.64336   from /opt/lita/vendor/ruby/2.1.0/gems/multi_json-1.11.2/lib/multi_json.rb:136:in `dump'
2016-02-01_19:01:25.64351   from /opt/lita/vendor/ruby/2.1.0/gems/lita-slack-1.7.2/lib/lita/adapters/slack/rtm_connection.rb:89:in `payload_for'
2016-02-01_19:01:25.64366   from /opt/lita/vendor/ruby/2.1.0/gems/lita-slack-1.7.2/lib/lita/adapters/slack/rtm_connection.rb:104:in `safe_payload_for'
2016-02-01_19:01:25.64382   from /opt/lita/vendor/ruby/2.1.0/gems/lita-slack-1.7.2/lib/lita/adapters/slack/rtm_connection.rb:62:in `block (2 levels) in send_messages'
2016-02-01_19:01:25.64404   from /opt/lita/vendor/ruby/2.1.0/gems/lita-slack-1.7.2/lib/lita/adapters/slack/event_loop.rb:10:in `block in defer'
2016-02-01_19:01:25.64421   from /opt/lita/vendor/ruby/2.1.0/gems/eventmachine-1.0.9.1/lib/eventmachine.rb:1067:in `call'
2016-02-01_19:01:25.64442   from /opt/lita/vendor/ruby/2.1.0/gems/eventmachine-1.0.9.1/lib/eventmachine.rb:1067:in `block in spawn_threadpool'

Though /etc/default/locale is set to en_US.UTF-8, so I'm not sure where we're getting downgraded to ascii.

I worked around this, by whomping the runit env in my wrapper cookbook:

lita_runit_env = {
  'HOME' => node['lita']['install_dir'],
  'PATH' => [node['languages']['ruby']['bin_dir'],
    node['languages']['ruby']['gem_bin'],
    node['languages']['ruby']['ruby_dir']
  ].join(':'),
  'LANG' => 'en_US.UTF-8',
}
node.default['lita']['runit']['env'] = lita_runit_env

Documentation

The documentation doesn't correctly match the recipe. Can someone please review the documentation and compare it to the recipe. I noticed this when trying to include the recipe in a berksfile and other recipes.

Test Kitchen fails due to "missing 'VERSION' file"

I've clone this repo, because I was experiencing the same issue pulling in Lita from Berkshelf

Error Resolving Cookbooks for Run List:
================================================================================

       Unknown Server Error:
       ---------------------

       The server had a fatal error attempting to load the node data.

       Server Response:
       ----------------
       Exception raised!  #<Errno::ENOENT: No such file or directory @ rb_sysopen - /tmp/kitchen/cookbooks/lita/VERSION>

       /tmp/kitchen/cookbooks/lita/metadata.rb:7:in `read'
       /tmp/kitchen/cookbooks/lita/metadata.rb:7:in `from_file'
       /opt/chef/embedded/apps/chef/lib/chef/mixin/from_file.rb:30:in `instance_eval'
       /opt/chef/embedded/apps/chef/lib/chef/mixin/from_file.rb:30:in `from_file'

       /opt/chef/embedded/apps/chef/lib/chef/cookbook/cookbook_version_loader.rb:253:in `apply_ruby_metadata'
       /opt/chef/embedded/apps/chef/lib/chef/cookbook/cookbook_version_loader.rb:161:in `block in metadata'
       /opt/chef/embedded/apps/chef/lib/chef/cookbook/cookbook_version_loader.rb:158:in `each'
       /opt/chef/embedded/apps/chef/lib/chef/cookbook/cookbook_version_loader.rb:158:in `metadata'
       /opt/chef/embedded/apps/chef/lib/chef/cookbook/cookbook_version_loader.rb:76:in `load'
       /opt/chef/embedded/apps/chef/lib/chef/chef_fs/file_system/chef_repository_file_system_cookbook_dir.rb:46:in `chef_object'

       /opt/chef/embedded/apps/chef/lib/chef/chef_fs/chef_fs_data_store.rb:150:in `block in get'
       /opt/chef/embedded/apps/chef/lib/chef/chef_fs/chef_fs_data_store.rb:439:in `with_entry'
       /opt/chef/embedded/apps/chef/lib/chef/chef_fs/chef_fs_data_store.rb:145:in `get'
       /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-3.2.1/lib/chef_zero/data_store/v1_to_v2_adapter.rb:47:in `block in get'
       /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-3.2.1/lib/chef_zero/data_store/v1_to_v2_adapter.rb:113:in `fix_exceptions'

       /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-3.2.1/lib/chef_zero/data_store/v1_to_v2_adapter.rb:40:in `get'
       /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-3.2.1/lib/chef_zero/rest_base.rb:52:in `get_data'
       /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-3.2.1/lib/chef_zero/endpoints/environment_cookbook_versions_endpoint.rb:77:in `block in depsolve'
       /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-3.2.1/lib/chef_zero/endpoints/environment_cookbook_versions_endpoint.rb:71:in `each'
       /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-3.2.1/lib/chef_zero/endpoints/environment_cookbook_versions_endpoint.rb:71:in `depsolve'
       /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-3.2.1/lib/chef_zero/endpoints/environment_cookbook_versions_endpoint.rb:37:in `post'

       /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-3.2.1/lib/chef_zero/rest_base.rb:30:in `call'
       /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-3.2.1/lib/chef_zero/rest_router.rb:24:in `call'
       /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-3.2.1/lib/chef_zero/server.rb:554:in `block in app'
       /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `call'
       /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
       /opt/chef/embedded/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service'

       /opt/chef/embedded/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run'
       /opt/chef/embedded/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread'



Running handlers:
[2015-01-08T15:22:33+00:00] ERROR: Running exception handlers
       Running handlers complete
       [2015-01-08T15:22:33+00:00] ERROR: Exception handlers complete
[2015-01-08T15:22:33+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
Chef Client failed. 0 resources updated in 82.119693841 seconds
[2015-01-08T15:22:33+00:00] ERROR: 500 "Internal Server Error "
[2015-01-08T15:22:35+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)```

Remove dependencies on ruby-ng and redis2

There are so many cookbooks to install ruby and redis nowadays that it doesn't make any sense to require user to upload those particular two cookbooks.

Even if you set "ruby_install_type" and "redis_install_type" to "none" it'll still require those cookbook to be on your chef-server:

% knife cookbook upload lita
Uploading lita           [0.0.3]
ERROR: Cookbook lita depends on cookbooks which are not currently
ERROR: being uploaded and cannot be found on the server.
ERROR: The missing cookbook(s) are: 'ruby-ng' version '~> 0.1.1', 'redis2' version '~> 0.5.0'

One option is to replace "depends" in metadata with "recommends" or "suggests":
https://docs.getchef.com/essentials_cookbook_metadata.html#settings

But using Berkshelf (which is a recommended way to manage cookbooks versions) they'll still be resolved and uploaded to the chef-server. You don't want any non-used cookbooks to be present on your chef-server, right?

I think having a section in docs just like https://github.com/opscode-cookbooks/jenkins#java should be enough for users to figure out dependencies and there's no need for ruby-ng and redis2 to be in chef-lita cookbook at all.

Ubuntu 12.04 ruby path

When installing onto Ubuntu 12.04, the first converge fails to work. It results in runit trying to launch lita, and complaining that ruby 2.1 isn't found.

I think this is because the lita_runit_env stuff is weird. Perhaps it's generated on run start, and the ruby-ng installation doesn't end up updating it.

Given that all the ruby installation methods are system package based (or backport styled), I removed the PATH override from lita_runit_env. Works for me

Switch to runit

Any thoughts on switching to runit for managing lita process?
https://github.com/hw-cookbooks/runit

Current initd script doesn't even know if Lita failed to start and always says "* lita started". Instead of tuning a script it might be better to switch to a service supervision system.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.