instance-runner-import.cfg.in 4.74 KB
Newer Older
1
[buildout]
2
extends = template-runner.cfg
3 4 5
          ${pbsready-import:output}

parts +=
6 7 8 9
  nginx_conf
  nginx-launcher
  certificate-authority
  ca-nginx
10 11
  gunicorn-launcher
  gunicorn-graceful
12
  slaprunner-promise
13
  slaprunner-supervisord-wrapper
14 15 16
  runner-sshd-add-authorized-key
  runner-sshd-graceful
  runner-sshd-promise
17 18
  runner-sshkeys-authority
  runner-sshkeys-sshd
19
  runtestsuite
20
  shellinabox
21
  symlinks
22
  slapos-cfg
23
  cron-entry-prepare-software
24
  deploy-instance-parameters
25
  instance-software-type
26
  bash-profile
27
  supervisord-wrapper
28
  importer-consistency-promise
29
  software-release-deployment-promise
30 31

  resilient-software-release-information
32
# have to repeat the next one, as it's not inherited from pbsready-import
33
  import-on-notification
34

35 36
  monitor-base

37 38 39 40
# For the needs of importer, we run the full slaprunner
# In case both exporter and importer (aka main instance and clone instance)
# run with the same IP (usually for testing purposes),
# run slaprunner using different ports.
41 42 43 44
[proxy-free-port]
recipe = slapos.cookbook:free_port
minimum = 49990
maximum = 49999
45
ip = $${slap-network-information:local-ipv4}
46 47 48 49 50 51 52

[runner-free-port]
recipe = slapos.cookbook:free_port
minimum = 50015
maximum = 50024
ip = $${slap-network-information:global-ipv6}

53
[slaprunner]
54 55 56 57 58 59 60 61 62 63 64
proxy_port = $${proxy-free-port:port}
runner_port = $${runner-free-port:port}

[supervisord-free-port]
recipe = slapos.cookbook:free_port
minimum = 39996
maximum = 40005
ip = $${slaprunner:ipv4}

[supervisord]
port = $${supervisord-free-port:port}
65

66
# Idem for some other services
67 68 69
[runner-sshd-port]
minimum = 22232
maximum = 22241
70

71
[importer]
72 73 74 75 76 77
recipe = slapos.recipe.template:jinja2
template = ${template-runner-import-script:location}/${template-runner-import-script:filename}
rendered = $${directory:bin}/$${slap-parameter:namebase}-importer
# backward compatibility for resilient stack
wrapper = $${:rendered}
mode = 700
78
restore-exit-code-file=$${directory:srv}/importer-exit-code-file
79 80
context =
  key backend_url slaprunner:access-url
81
  key proxy_host slaprunner:ipv4
82
  section directory directory
83 84
  raw  output_log_file $${directory:log}/resilient.log
  raw  shell_binary ${bash:location}/bin/bash
85
  raw  rsync_binary ${rsync:location}/bin/rsync
86 87 88
  raw  restore_exit_code_file $${:restore-exit-code-file}

[importer-consistency-promise]
89 90
# Test that the importer script and "after-import" subscripts
# are not older than 1 day (24h), and have succeeded
91 92
recipe = collective.recipe.template
input = inline: #!/bin/sh
93 94
  EXIT_CODE_FILE=$(find "$${importer:restore-exit-code-file}")
  RECENT_EXIT_CODE_FILE=$(find "$${importer:restore-exit-code-file}" -mtime -1)
95
  if [ -z "$EXIT_CODE_FILE" ]; then
96 97 98 99 100 101 102 103 104 105 106
    exit 0;
  else
    if [ -z "$RECENT_EXIT_CODE_FILE" ]; then
       echo "Consistency check is too old.";
       exit 1;
    else
      EXIT_CODE=$(cat $EXIT_CODE_FILE)
      exit $EXIT_CODE
    fi
  fi
  exit 1; # Something else went wrong
107 108
output = $${directory:promises}/importer-consistency-promise
mode = 755
109

110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
[software-release-deployment-promise]
recipe = collective.recipe.template
input = inline: #!/bin/sh
  PROJECT_FILE=$(find "$${directory:etc}" -maxdepth 1 -name .project)
  if [ -z "$PROJECT_FILE" ]; then
    exit 0;
  else
    INSTALLATION_FILE=$(find "$${runnerdirectory:software-root}" -mindepth 2 -maxdepth 2 -name .completed)
    if [ -n "$INSTALLATION_FILE" ]; then
      exit 0;
    else
      exit 1;
    fi
  fi
  exit 1
output = $${directory:promises}/software-release-deployment-promise
mode = 755

128 129 130 131 132 133
[resilient-software-release-information]
recipe = slapos.recipe.template
url = ${template-resilient-software-release-information:destination}/${template-resilient-software-release-information:filename}
output = $${directory:cgi-bin}/resilient_software_release_information.py
mode = 0600

134 135
[slap-parameter]
auto-deploy-instance = false
136
auto-deploy = true
137 138 139 140
name = Webrunner import
monitor-cors-domains = 
monitor-username = $${monitor-htpasswd:username}
monitor-password = $${monitor-htpasswd:passwd}
141

142
[resilient-publish-connection-parameter]
143 144 145 146
monitor-base-url = $${publish:monitor-base-url}
monitor-url = $${publish:monitor-url}
monitor-user = $${publish:monitor-user}
monitor-password = $${publish:monitor-password}
147

148 149 150 151 152 153 154 155 156 157 158 159 160 161
[monitor-instance-parameter]
monitor-httpd-port = 8360
#monitor-title = $${slap-parameter:name}
#cors-domains = $${slap-parameter:monitor-cors-domains}
#username = $${slap-parameter:monitor-username}
#password = $${slap-parameter:monitor-password}
# Pass some parameter to dispay in monitoring interface
instance-configuration =
  raw takeover-url http://[$${resilient-web-takeover-httpd-configuration-file:listening-ip}]:$${resilient-web-takeover-httpd-configuration-file:listening-port}/
  raw takeover-password $${resilient-web-takeover-password:passwd}

[monitor-conf-parameters]
private-path-list += 
  $${directory:logrotate-backup}