- .package
- ..config
- .service
+ - .resources
--- /dev/null
+# -*- coding: utf-8 -*-
+# vim: ft=sls
+
+include:
+ - .virtual_machines
--- /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 %}
+
+{%- set virtual_machines = arvados.cluster.resources.virtual_machines | default({}) %}
+{%- set api_token = arvados.cluster.tokens.system_root | yaml_encode %}
+{%- set api_host = arvados.cluster.Services.Controller.ExternalURL | regex_replace('^http(s?)://', '', ignorecase=true) %}
+
+include:
+ - ..package
+ - {{ sls_config_file }}
+ - ..service
+
+{%- for vm, vm_params in virtual_machines.items() %}
+ {%- set vm_name = vm_params.name | default(vm) %}
+ {%- set vm_backend = vm_params.backend | default(vm_name) %}
+ {%- set vm_port = vm_params.port | default(4200) %}
+
+arvados-api-resources-virtual-machines-{{ vm }}-record-cmd-run:
+ cmd.run:
+ - env:
+ - ARVADOS_API_TOKEN: {{ api_token }}
+ - ARVADOS_API_HOST: {{ api_host }}
+ - name: |
+ arv --format=uuid \
+ virtual_machine \
+ create \
+ --virtual-machine '{"hostname":"{{ vm_name }}" }'
+ - onlyif: |
+ ARVADOS_API_TOKEN={{ api_token }} \
+ ARVADOS_API_HOST={{ api_host }} \
+ arv --short \
+ virtual_machine \
+ list \
+ --filters '[["hostname", "=", "{{ vm_name }}"]]' | \
+ /bin/grep -qE "fixme-2x53u-[a-z0-9_]{15}" && \
+ false
+{%- endfor %}
key: ''
insecure: false
+ resources: {}
+
### THESE ARE THE PACKAGES AND DAEMONS BASIC CONFIGS
##### API
api:
- path: test/integration/keepproxy
- path: test/integration/keepweb
- path: test/integration/controller
- #### workbench,workbench2
+ #### workbench,workbench2,webshell
- name: workbench
driver:
hostname: workbench.fixme.example.net
- example_nginx
- example_nginx_workbench
- example_nginx_workbench2
+ - example_nginx_webshell
pillars_from_files:
# yamllint disable rule:line-length
arvados.sls: test/salt/pillar/arvados.sls
example_nginx.sls: test/salt/pillar/examples/nginx_passenger.sls
example_nginx_workbench.sls: test/salt/pillar/examples/nginx_workbench_configuration.sls
example_nginx_workbench2.sls: test/salt/pillar/examples/nginx_workbench2_configuration.sls
+ example_nginx_webshell.sls: test/salt/pillar/examples/nginx_webshell_configuration.sls
# yamllint enable rule:line-length
verifier:
inspec_tests:
# verify-ca: false
# client_encoding: UTF8
-
tls:
# certificate: ''
# key: ''
keep_access_key: changemekeepaccesskey
keep_secret_key: changemekeepsecretkey
+ ### ARVADOS RESOURCES
+ # This dict allows you to create various resources in the Arvados
+ # database so they're ready to use.
+ # Check the `arvados.api.resources.* states to see which can be
+ # currently managed
+
+ ### SHELL / WEBSHELL REGISTRATION
+ # In order to use shell nodes via webshell, Arvados needs to know of
+ # their existence and they need to be configured as upstreams in nginx
+ # (see https://doc.arvados.org/v2.0/install/install-webshell.html)
+ # This could be achieved in various ways (ie, through salt mine if you
+ # want them to be dinamically created), but that's outside the scope of
+ # this formula. The following dict is just an example that will be used
+ # by the `arvados.api.resources.virtual_machines` state to add entries
+ # in Arvados' database of the cluster's resources'
+ # It's additionally used in the `test/salt/pillar/examples/nginx_webshell_configuration.sls`
+ # pillar to add the corresponding `location` entries in nginx's webshell vhosts & upstreams
+ resources:
+ virtual_machines:
+ shell1:
+ name: webshell1 # if not set, will match the one of the dict key above
+ backend: 1.2.3.4 # upstream host ip/name that has the shell role
+ port: 4200 # port where shellinabox is listening
+ # when no other parameter is set:
+ # `name` will match the name of the key
+ # backend` will match `name`
+ # `port` will default to shellinabox's 4200
+ webshell2: {}
+
### VOLUMES
## This should usually match all your `keepstore` instances
Volumes:
# service:
# name: keepstore
# port: 25107
-# #### GIT-HTTPD
-# githttpd:
-# pkg:
-# name: arvados-git-httpd
-# service:
-# name: arvados-git-httpd
-# port: 9001
# #### SHELL
# shell:
# pkg:
# service:
# name: arvados-ws
# port: 8005
-# #### SSO
-# sso:
-# pkg:
-# name: arvados-sso
-# service:
-# name: arvados-sso
-# port: 8900
# ## SALTSTACK FORMULAS TOFS configuration
# https://template-formula.readthedocs.io/en/latest/TOFS_pattern.html
--- /dev/null
+# frozen_string_literal: true
+
+test_cmd = <<~TEST_CMD
+ su -l kitchen -c \
+ "ARVADOS_API_TOKEN=\\"systemroottokenmushaveatleast32characters\\" \
+ ARVADOS_API_HOST=\\"fixme.example.net\\" \
+ arv virtual_machine list --filters '[[\\"hostname\\", \\"=\\", \\"%s\\"]]'"
+TEST_CMD
+
+control 'arvados api resources' do
+ impact 0.5
+ title 'should be created'
+
+ %w[
+ webshell1
+ webshell2
+ ].each do |vm|
+ describe "virtual machine #{vm}" do
+ subject do
+ command(test_cmd % vm)
+ end
+ its('stdout') { should match(/"uuid":"fixme-2x53u-[a-z0-9_]{15}"/) }
+ its('stdout') { should match(/"hostname":"#{vm}"/) }
+ its('stderr') { should eq '' }
+ its('exit_status') { should eq 0 }
+ end
+ end
+end
title 'should not exist'
describe file('/etc/arvados/config.yml') do
- it { should_not exist}
+ it { should_not exist }
end
end
# required to test with snakeoil certs
insecure: true
+ resources:
+ virtual_machines:
+ shell1:
+ name: webshell1
+ backend: 1.2.3.4
+ port: 4200
+ webshell2: {}
+
### TOKENS
tokens:
system_root: systemroottokenmushaveatleast32characters
### STREAMS
http:
+ {%- for shell_node, params in %}
upstream webshell_upstream:
- server: 'shell.internal:4200 fail_timeout=10s'