<commit_before>#
# Cookbook Name:: omnitruck
# Recipe:: default
#

begin
  release = data_bag_item('omnitruck', node['applications']['omnitruck'])
rescue
  release = nil
end

group 'hab'

user 'hab' do
  group 'hab'
  home '/hab'
end

hab_install 'habitat' do
  action :upgrade
end

hab_package 'chef-es/omnitruck' do
  # TODO: (jtimberman) We need multi-component building, which means
  # we'll have multiple artifacts.
  # if release
  # version version [release['artifact']['pkg_version'], release['artifact']['pkg_release']].join('/')
  # end
end

hab_package 'chef-es/omnitruck-unicorn-proxy' do
  # if release
  # version [release['artifact']['pkg_version'], release['artifact']['pkg_release']].join('/')
  # end
end

hab_service_systemd 'chef-es/omnitruck' do
  action [:enable, :start]
end

hab_service_systemd 'chef-es/omnitruck-unicorn-proxy' do
  unit_content(lazy {
    {
      Unit: {
        Description: 'Nginx proxy for Unicorn',
        After: 'network.target audit.service omnitruck.service'
      },
      Service: {
        Environment: "SSL_CERT_FILE=#{hab('pkg', 'path', 'core/cacerts').stdout.chomp}/ssl/cert.pem",
        ExecStart: "/bin/hab start chef-es/omnitruck-unicorn-proxy --listen-gossip 0.0.0.0:9639 --listen-http 0.0.0.0:9632",
        Restart: "on-failure"
      }
    }
    })
  action [:enable, :start]
end

cookbook_file '/etc/cron.d/poller-cron' do
  mode '0755'
end<commit_msg>rename hab_service_systemd to hab_service<commit_after>#
# Cookbook Name:: omnitruck
# Recipe:: default
#

begin
  release = data_bag_item('omnitruck', node['applications']['omnitruck'])
rescue
  release = nil
end

group 'hab'

user 'hab' do
  group 'hab'
  home '/hab'
end

hab_install 'habitat' do
  action :upgrade
end

hab_package 'chef-es/omnitruck' do
  # TODO: (jtimberman) We need multi-component building, which means
  # we'll have multiple artifacts.
  # if release
  # version version [release['artifact']['pkg_version'], release['artifact']['pkg_release']].join('/')
  # end
end

hab_package 'chef-es/omnitruck-unicorn-proxy' do
  # if release
  # version [release['artifact']['pkg_version'], release['artifact']['pkg_release']].join('/')
  # end
end

hab_service 'chef-es/omnitruck' do
  action [:enable, :start]
end

hab_service 'chef-es/omnitruck-unicorn-proxy' do
  unit_content(lazy {
    {
      Unit: {
        Description: 'Nginx proxy for Unicorn',
        After: 'network.target audit.service omnitruck.service'
      },
      Service: {
        Environment: "SSL_CERT_FILE=#{hab('pkg', 'path', 'core/cacerts').stdout.chomp}/ssl/cert.pem",
        ExecStart: "/bin/hab start chef-es/omnitruck-unicorn-proxy --listen-gossip 0.0.0.0:9639 --listen-http 0.0.0.0:9632",
        Restart: "on-failure"
      }
    }
    })
  action [:enable, :start]
end

cookbook_file '/etc/cron.d/poller-cron' do
  mode '0755'
end
{'fraction_non_alphanumeric': 0.15228070175438596, 'fraction_numerical': 0.014035087719298246, 'mean_word_length': 3.7201986754966887, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6525051', 'n_tokens_mistral': 1071, 'n_tokens_neox': 1019, 'n_words': 220}