[Git][reproducible-builds/debian-rebuilder-setup][ansible] 2 commits: Start gunicorn-visualizer on boot

kpcyrd gitlab at salsa.debian.org
Mon Nov 5 21:06:45 CET 2018


kpcyrd pushed to branch ansible at Reproducible Builds / debian-rebuilder-setup


Commits:
0a0b0144 by kpcyrd at 2018-11-05T18:09:24Z
Start gunicorn-visualizer on boot

- - - - -
beae8c31 by kpcyrd at 2018-11-05T20:05:18Z
Refactor accumulator deployment

- - - - -


8 changed files:

- builder/srebuild
- external_vars.yml
- roles/builders/tasks/main.yml
- + roles/builders/templates/srebuild-endpoints.j2
- − roles/builders/templates/srebuild-runner.j2
- roles/visualizers/files/default.conf
- roles/visualizers/tasks/main.yml
- scheduler/srebuild-worker


Changes:

=====================================
builder/srebuild
=====================================
@@ -451,7 +451,7 @@ system_fatal "cat", $lnk;
 system_fatal "cat", $buildinfo_file;
 
 foreach my $visualizer (@ARGV) {
-  system_fatal "curl", "-F", "metadata=\@$lnk", "-F", "buildinfo=\@$buildinfo_file", "$visualizer";
+  system_fatal "curl", "-fF", "metadata=\@$lnk", "-F", "buildinfo=\@$buildinfo_file", "$visualizer";
 }
 
 say STDOUT "everything is okay!";


=====================================
external_vars.yml
=====================================
@@ -4,3 +4,6 @@ build_gpg_realname: "foo bar"
 build_gpg_email: "foo at localhost"
 main_template_enable: true
 http_template_enable: true
+
+rebuilder_publish:
+- http://127.0.0.1/new_build


=====================================
roles/builders/tasks/main.yml
=====================================
@@ -16,6 +16,11 @@
     - in-toto
     - colorama
 
+- name: Write endpoints that collect build data
+  template:
+    src: srebuild-endpoints.j2
+    dest: /etc/srebuild-endpoints
+
 - name: Copy srebuild
   copy:
     src: ../../../builder/srebuild
@@ -26,16 +31,10 @@
     src: ../../../builder/srebuild-hook
     dest: /usr/lib/srebuild-hook
 
-- name: Copy template
-  template:
-    src: srebuild-runner.j2
-    dest: /usr/bin/srebuild-runner
-
 - name: Set permissions
   file:
     path: "{{ item }}"
     mode: 0755
   with_items:
     - /usr/bin/srebuild
-    - /usr/bin/srebuild-runner
     - /usr/lib/srebuild-hook


=====================================
roles/builders/templates/srebuild-endpoints.j2
=====================================
@@ -0,0 +1,3 @@
+{% for endpoint in rebuilder_publish %}
+{{ endpoint }}
+{% endfor %}


=====================================
roles/builders/templates/srebuild-runner.j2 deleted
=====================================
@@ -1,3 +0,0 @@
-#!/usr/bin/env bash
-
-srebuild $1 {% for host in groups['visualizers'] %} "{{ hostvars[host]['ansible_default_ipv4']['address'] }}" {% endfor %}


=====================================
roles/visualizers/files/default.conf
=====================================
@@ -7,7 +7,7 @@ server {
     error_log  /var/log/nginx/error.log;
 
     location / {
-        proxy_pass         http://127.0.0.1:8000/;
+        proxy_pass         http://127.0.0.1:8000;
         proxy_redirect     off;
 
         proxy_set_header   Host                 $host;
@@ -15,4 +15,17 @@ server {
         proxy_set_header   X-Forwarded-For      $proxy_add_x_forwarded_for;
         proxy_set_header   X-Forwarded-Proto    $scheme;
     }
-}
\ No newline at end of file
+
+    location /new_build {
+        proxy_pass         http://127.0.0.1:4000;
+        proxy_redirect     off;
+
+        allow   127.0.0.1;
+        deny    all;
+
+        proxy_set_header   Host                 $host;
+        proxy_set_header   X-Real-IP            $remote_addr;
+        proxy_set_header   X-Forwarded-For      $proxy_add_x_forwarded_for;
+        proxy_set_header   X-Forwarded-Proto    $scheme;
+    }
+}


=====================================
roles/visualizers/tasks/main.yml
=====================================
@@ -40,3 +40,12 @@
 - name: Copy nginx config
   copy: src=default.conf dest=/etc/nginx/conf.d/default.conf
   notify: "(Handler: All OSs) Reload NGINX"
+
+- name: enable systemd services
+  systemd:
+    name: "{{ item }}"
+    state: started
+    enabled: yes
+  with_items:
+  - gunicorn-visualizer
+  - gunicorn-accumulator


=====================================
scheduler/srebuild-worker
=====================================
@@ -5,9 +5,12 @@ import subprocess
 
 
 def rebuild(buildinfo):
+    with open('/etc/srebuild-endpoints') as f:
+        endpoints = filter(None, (x.strip() for x in f))
+
     with tempfile.NamedTemporaryFile() as f:
         f.write(buildinfo)
-        cmd = ['srebuild-runner', f.name]
+        cmd = ['srebuild', f.name] + endpoints
         print('[+] invoking %r' % cmd)
         rc = subprocess.call(cmd)
         if rc != 0:



View it on GitLab: https://salsa.debian.org/reproducible-builds/debian-rebuilder-setup/compare/a70d2eea24e2729d2611b38be701e31338974d12...beae8c31d8441a96a48c421fed15309a2d532419

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/debian-rebuilder-setup/compare/a70d2eea24e2729d2611b38be701e31338974d12...beae8c31d8441a96a48c421fed15309a2d532419
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20181105/f060b11e/attachment.html>


More information about the rb-commits mailing list