# arvados-dispatch-cloud
# crunch-dispatch-slurm
service:
- name: ''
+ name: crunch-dispatch-local
port: ''
##### KEEPPROXY
keepproxy:
--- /dev/null
+# -*- coding: utf-8 -*-
+# vim: ft=sls
+
+{#- Get the `tplroot` from `tpldir` #}
+{%- set tplroot = tpldir.split('/')[0] %}
+{%- set sls_config_file = tplroot ~ '.config.file' %}
+{%- from tplroot ~ "/map.jinja" import arvados with context %}
+{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
+
+include:
+ - ..package
+ - {{ sls_config_file }}
+ - .running
+
+{%- if arvados.dispatcher.pkg.name == 'crunch-dispatch-local' %}
+arvados-dispatcher-service-file-file-managed-crunch-run-sh:
+ file.managed:
+ - name: /usr/local/bin/crunch-run.sh
+ - source: {{ files_switch(['crunch-run-sh.tmpl'],
+ lookup='arvados-dispatcher-service-file-file-managed-crunch-run-sh',
+ use_subpath=True
+ )
+ }}
+ - mode: '0755'
+ - user: root
+ - group: root
+ - makedirs: True
+ - template: jinja
+ - context:
+ arvados: {{ arvados | json }}
+ - require:
+ - pkg: arvados-dispatcher-package-install-pkg-installed
+
+arvados-dispatcher-service-file-file-managed-crunch-dispatch-local-service:
+ file.managed:
+ - name: /etc/systemd/system/crunch-dispatch-local.service
+ - source: {{ files_switch(['crunch-dispatch-local-service.tmpl'],
+ lookup='arvados-dispatcher-service-file-file-managed-crunch-dispatch-local-service',
+ use_subpath=True
+ )
+ }}
+ - mode: '0644'
+ - user: root
+ - group: root
+ - makedirs: True
+ - template: jinja
+ - context:
+ arvados: {{ arvados | json }}
+ - require:
+ - file: arvados-dispatcher-service-file-file-managed-crunch-run-sh
+ - pkg: arvados-dispatcher-package-install-pkg-installed
+ cmd.run:
+ - name: systemctl daemon-reload
+ - require_in:
+ - service: arvados-dispatcher-service-running-service-running
+ - require:
+ - file: arvados-dispatcher-service-file-file-managed-crunch-dispatch-local-service
+{%- endif %}
--- /dev/null
+########################################################################
+# File managed by Salt at <{{ source }}>.
+# Your changes will be overwritten.
+########################################################################
+[Unit]
+Description=Arvados Crunch Dispatcher for LOCAL service
+Documentation=https://doc.arvados.org/
+After=network.target
+
+# systemd==229 (ubuntu:xenial) obeys StartLimitInterval in the [Unit] section
+StartLimitInterval=0
+
+# systemd>=230 (debian:9) obeys StartLimitIntervalSec in the [Unit] section
+StartLimitIntervalSec=0
+
+[Service]
+Type=simple
+EnvironmentFile=-/etc/arvados/environment
+ExecStart=/usr/bin/crunch-dispatch-local -poll-interval=1 -crunch-run-command=/usr/local/bin/crunch-run.sh
+# Set a reasonable default for the open file limit
+LimitNOFILE=65536
+Restart=always
+RestartSec=1
+LimitNOFILE=1000000
+
+# systemd<=219 (centos:7, debian:8, ubuntu:trusty) obeys StartLimitInterval in the [Service] section
+StartLimitInterval=0
+
+[Install]
+WantedBy=multi-user.target
--- /dev/null
+########################################################################
+# File managed by Salt at <{{ source }}>.
+# Your changes will be overwritten.
+########################################################################
+#!/bin/sh
+exec /usr/bin/crunch-run -container-enable-networking=default -container-network-mode=host $@
# vim: ft=sls
include:
+ - .file
- .running
{%- set tplroot = tpldir.split('/')[0] %}
{%- set sls_config_file = tplroot ~ '.config.file' %}
{%- from tplroot ~ "/map.jinja" import arvados with context %}
+{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
-{%- if arvados.dispatcher.pkg.name != 'crunch-dispatch-local' %}
include:
- ..package
+ - .file
- {{ sls_config_file }}
arvados-dispatcher-service-running-service-running:
- sls: {{ sls_config_file }}
- require:
- pkg: arvados-dispatcher-package-install-pkg-installed
- - only_if: test "{{ arvados.dispatcher.pkg.name }}" != "crunch-dispatch-local"
-{%- endif %}
--- /dev/null
+# InSpec Profile: `dispatcher`
+
+This shows the implementation of the `dispatcher` InSpec [profile](https://github.com/inspec/inspec/blob/master/docs/profiles.md).
+
+## Verify a profile
+
+InSpec ships with built-in features to verify a profile structure.
+
+```bash
+$ inspec check dispatcher
+Summary
+-------
+Location: dispatcher
+Profile: profile
+Controls: 4
+Timestamp: 2019-06-24T23:09:01+00:00
+Valid: true
+
+Errors
+------
+
+Warnings
+--------
+```
+
+## Execute a profile
+
+To run all **supported** controls on a local machine use `inspec exec /path/to/profile`.
+
+```bash
+$ inspec exec dispatcher
+..
+
+Finished in 0.0025 seconds (files took 0.12449 seconds to load)
+8 examples, 0 failures
+```
+
+## Execute a specific control from a profile
+
+To run one control from the profile use `inspec exec /path/to/profile --controls name`.
+
+```bash
+$ inspec exec dispatcher --controls package
+.
+
+Finished in 0.0025 seconds (files took 0.12449 seconds to load)
+1 examples, 0 failures
+```
+
+See an [example control here](https://github.com/inspec/inspec/blob/master/examples/profile/controls/example.rb).
--- /dev/null
+# frozen_string_literal: true
+
+dispatcher_stanza = <<-DISPATCHER_STANZA
+ DispatchCloud:
+ InternalURLs:
+ http://fixme.example.net:9006: {}
+DISPATCHER_STANZA
+
+control 'arvados configuration' do
+ title 'should match desired dispatcher lines'
+
+ describe file('/etc/arvados/config.yml') do
+ it { should be_file }
+ it { should be_owned_by 'root' }
+ # We're testing it in the API instance, so group will be nginx's
+ it { should be_grouped_into 'www-data' }
+ its('mode') { should cmp '0640' }
+ its('content') do
+ should include(
+ 'File managed by Salt at <salt://arvados/files/default/config.tmpl.jinja>.'
+ )
+ end
+ its('content') { should include(dispatcher_stanza) }
+ end
+end
--- /dev/null
+# frozen_string_literal: true
+
+control 'arvados dispatcher service' do
+ impact 0.5
+ title 'files should exist'
+
+ describe file('/usr/local/bin/crunch-run.sh') do
+ it { should be_file }
+ it { should be_owned_by 'root' }
+ it { should be_grouped_into 'root' }
+ its('mode') { should cmp '0755' }
+ its('content') do
+ should include(
+ # rubocop:disable Metrics/LineLength
+ 'File managed by Salt at <salt://arvados/dispatcher/service/files/default/crunch-run-sh.tmpl>.'
+ # rubocop:enable Metrics/LineLength
+ )
+ end
+ end
+ describe file('/etc/systemd/system/crunch-dispatch-local.service') do
+ it { should be_file }
+ it { should be_owned_by 'root' }
+ it { should be_grouped_into 'root' }
+ its('mode') { should cmp '0644' }
+ its('content') do
+ should include(
+ # rubocop:disable Metrics/LineLength
+ 'File managed by Salt at <salt://arvados/dispatcher/service/files/default/crunch-dispatch-local-service.tmpl>.'
+ # rubocop:enable Metrics/LineLength
+ )
+ end
+ end
+end
--- /dev/null
+# frozen_string_literal: true
+
+control 'arvados dispatcher package' do
+ title 'should be installed'
+
+ describe package('crunch-dispatch-local') do
+ it { should be_installed }
+ end
+end
--- /dev/null
+# frozen_string_literal: true
+
+control 'arvados dispatcher service' do
+ impact 0.5
+ title 'should be running and enabled'
+
+ describe service('crunch-dispatch-local') do
+ it { should be_enabled }
+ it { should be_running }
+ end
+end
--- /dev/null
+# -*- coding: utf-8 -*-
+# vim: ft=yaml
+---
+name: dispatcher
+title: arvados formula dispatcher submodule
+maintainer: SaltStack Formulas
+license: Apache-2.0
+summary: Verify that the arvados formula dispatcher is setup and configured correctly
+supports:
+ - platform-name: debian
+ - platform-name: ubuntu
+ - platform-name: centos
its('mode') { should cmp '0644' }
its('content') do
should include(
- # rubocop:disable Metrics/LineLength
+ # rubocop:disable Layout/LineLength
'File managed by Salt at <salt://arvados/shell/config/files/default/shell-shellinabox.tmpl.jinja>.'
- # rubocop:enable Metrics/LineLength
+ # rubocop:enable Layout/LineLength
)
end
its('content') { should include(siab_stanza) }
its('mode') { should cmp '0644' }
its('content') do
should include(
- # rubocop:disable Metrics/LineLength
+ # rubocop:disable Layout/LineLength
'File managed by Salt at <salt://arvados/shell/config/files/default/shell-libpam-arvados.tmpl.jinja>.'
- # rubocop:enable Metrics/LineLength
+ # rubocop:enable Layout/LineLength
)
end
its('content') { should include(libpam_stanza) }