<commit_before># frozen_string_literal: true

#
# Cookbook Name:: resource_container_host_linux
# Recipe:: nomad
#
# Copyright 2017, <NAME>
#

directory Nomad::Helpers::CONFIG_ROOT.to_s do
  owner 'root'
  group 'root'
  mode '0755'
  action :create
end

file "#{Nomad::Helpers::CONFIG_ROOT}/nomad_client.hcl" do
  action :create
  content <<~HCL
    atlas {
      join = false
    }

    client {
      enabled = true
      node_class = "linux"
      reserved {
        cpu            = 500
        disk           = 1024
        memory         = 512
        reserved_ports = "22,8300-8600"
      }
    }

    consul {
      address = "127.0.0.1:8500"
      auto_advertise = true
      client_auto_join = true
      server_auto_join = true
    }

    data_dir = "/var/lib/nomad"

    disable_update_check = true

    enable_syslog = true

    leave_on_interrupt = true
    leave_on_terminate = true

    log_level = "DEBUG"

    server {
      enabled = false
    }

    vault {
      enabled = false
    }
  HCL
end

#
# INSTALL NOMAD
#

# This installs nomad as follows
# - Binaries: /usr/local/bin/nomad
include_recipe 'nomad::install'

# Install the service that will run nomad
# Command line will be: nomad agent -config="#{Nomad::Helpers::CONFIG_ROOT}"
include_recipe 'nomad::manage'

#
# ALLOW NOMAD THROUGH THE FIREWALL
#

firewall_rule 'nomad-http' do
  command :allow
  description 'Allow Nomad HTTP traffic'
  dest_port 4646
  direction :in
end

firewall_rule 'nomad-rpc' do
  command :allow
  description 'Allow Nomad RCP traffic'
  dest_port 4647
  direction :in
end

firewall_rule 'nomad-serf' do
  command :allow
  description 'Allow Nomad Serf traffic'
  dest_port 4648
  direction :in
end<commit_msg>Disable the nomad service until after the machine is provisioned because nomad doesn't like restarts very much<commit_after># frozen_string_literal: true

#
# Cookbook Name:: resource_container_host_linux
# Recipe:: nomad
#
# Copyright 2017, <NAME>
#

directory Nomad::Helpers::CONFIG_ROOT.to_s do
  owner 'root'
  group 'root'
  mode '0755'
  action :create
end

file "#{Nomad::Helpers::CONFIG_ROOT}/nomad_client.hcl" do
  action :create
  content <<~HCL
    atlas {
      join = false
    }

    client {
      enabled = true
      node_class = "linux"
      reserved {
        cpu            = 500
        disk           = 1024
        memory         = 512
        reserved_ports = "22,8300-8600"
      }
    }

    consul {
      address = "127.0.0.1:8500"
      auto_advertise = true
      client_auto_join = true
      server_auto_join = true
    }

    data_dir = "/var/lib/nomad"

    disable_update_check = true

    enable_syslog = true

    leave_on_interrupt = true
    leave_on_terminate = true

    log_level = "DEBUG"

    server {
      enabled = false
    }

    vault {
      enabled = false
    }
  HCL
end

#
# INSTALL NOMAD
#

# This installs nomad as follows
# - Binaries: /usr/local/bin/nomad
include_recipe 'nomad::install'

# Install the service that will run nomad
# Command line will be: nomad agent -config="#{Nomad::Helpers::CONFIG_ROOT}"
include_recipe 'nomad::manage'

# Make sure the nomad service doesn't start automatically. This will be changed
# after we have provisioned the box
service 'nomad' do
  action [:disable]
end

#
# ALLOW NOMAD THROUGH THE FIREWALL
#

firewall_rule 'nomad-http' do
  command :allow
  description 'Allow Nomad HTTP traffic'
  dest_port 4646
  direction :in
end

firewall_rule 'nomad-rpc' do
  command :allow
  description 'Allow Nomad RCP traffic'
  dest_port 4647
  direction :in
end

firewall_rule 'nomad-serf' do
  command :allow
  description 'Allow Nomad Serf traffic'
  dest_port 4648
  direction :in
end
{'fraction_non_alphanumeric': 0.08507179626117584, 'fraction_numerical': 0.0270929287455974, 'mean_word_length': 2.763506625891947, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '3870332', 'n_tokens_mistral': 1331, 'n_tokens_neox': 1242, 'n_words': 345}