diff --git a/files/reg-server/cron-prod b/files/reg-server/cron-prod new file mode 100644 index 0000000000..4b54bedfa4 --- /dev/null +++ b/files/reg-server/cron-prod @@ -0,0 +1,4 @@ +SHELL=/bin/bash +MAILTO=maxamillion@fedoraproject.org + +*/5 * * * * root cd /var/lib/reg-server/ && reg-server -r registry.fedoraproject.org --once \ No newline at end of file diff --git a/files/reg-server/cron-stg b/files/reg-server/cron-stg new file mode 100644 index 0000000000..a6f7ceb3c0 --- /dev/null +++ b/files/reg-server/cron-stg @@ -0,0 +1,4 @@ +SHELL=/bin/bash +MAILTO=maxamillion@fedoraproject.org + +*/5 * * * * root cd /var/lib/reg-server/ && reg-server -r registry.stg.fedoraproject.org --once \ No newline at end of file diff --git a/files/reg-server/repositories.html b/files/reg-server/repositories.html new file mode 100644 index 0000000000..1068772c4f --- /dev/null +++ b/files/reg-server/repositories.html @@ -0,0 +1,69 @@ +{{define "repositories"}} +<!DOCTYPE html> +<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> +<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]--> +<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]--> +<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]--> +<head> + <meta charset="utf-8"> + <base href="/" > + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> + <title>{{ .RegistryDomain }}</title> + <link rel="icon" type="image/ico" href="/static/favicon.ico"> + <link rel="stylesheet" href="/static/css/styles.css" /> +</head> +<body> + <h1>{{ .RegistryDomain }}</h1> + <form> + <input name="filter" type="search"><a class="clear">clear</a> + </form> + + <div class="wrapper"> + <table> + <tr> + <th>Repository Name</th> + <th>Pull Command</th> + </tr> + {{ range $key, $value := .Repositories }} + <tr> + <td valign="top"> + <a href="/repo/{{ $value.Name | urlquery }}/tags"> + {{ $value.Name }} + </a> + </td> + + <td align="right" nowrap> + <a href="/repo/{{ $value.Name | urlquery }}/tags"> + <code>docker pull {{ $value.URI }}</code> + </a> + </td> + </tr> + {{ end }} + </table> + </div> + + <div class="footer"> + <p>Last Updated: {{ .LastUpdated }}</p> + <p> + Fedora Container Layered Images brought to you by the + <a href="https://fedoraproject.org/wiki/Atomic_WG">Fedora Atomic Working + Group</a> + </p> + <p> + <a href="https://github.com/jessfraz/reg/tree/master/server">reg-server + was originally written and is maintained upstream by</a> + <a href="https://twitter.com/jessfraz">@jessfraz</a> + </p> + </div><!--/.footer--> + <script src="/static/js/scripts.js"></script> + <script> +(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ + (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), +m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) +})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); +ga('create', 'UA-29404280-12', 'jessfraz.com'); +ga('send', 'pageview'); + </script> +</body> +</html> +{{end}} diff --git a/files/reg-server/tags.html b/files/reg-server/tags.html new file mode 100644 index 0000000000..2204f21a40 --- /dev/null +++ b/files/reg-server/tags.html @@ -0,0 +1,74 @@ +{{define "tags"}} +<!DOCTYPE html> +<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> +<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]--> +<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]--> +<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]--> +<head> + <meta charset="utf-8"> + <base href="/" > + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> + <title>{{ .RegistryDomain }}/{{ .Name }}</title> + <link rel="icon" type="image/ico" href="/static/favicon.ico"> + <link rel="stylesheet" href="/static/css/styles.css" /> +</head> +<body> + <h1>{{ .RegistryDomain }}/{{ .Name }}</h1> + <div class="wrapper"> + <table> + <tr> + <th>Name</th> + <th>Tag</th> + <th>Created</th> + </tr> + {{ range $key, $value := .Repositories }} + <tr> + <td valign="left" nowrap> + {{ $value.Name }} + </td> + <td align="right" nowrap> + {{ $value.Tag }} + </td> + <td align="right" nowrap> + {{ $value.Created.Format "02 Jan, 2006 15:04:05 UTC" }} + </td> + </tr> + {{ end }} + </table> + </div> + + <div class="footer"> + Fedora Container Layered Images brought to you by the + <a href="https://fedoraproject.org/wiki/Atomic_WG">Fedora Atomic Working + Group</a> + </p> + <p> + <a href="https://github.com/jessfraz/reg/tree/master/server">reg-server + was originally written and is maintained upstream by</a> + <a href="https://twitter.com/jessfraz">@jessfraz</a> + </p> + </div><!--/.footer--> + <script src="/static/js/scripts.js"></script> + <script type="text/javascript"> + var ajaxCalls = [ + {{ range $key, $value := .Repositories }} + '/repo/{{ $value.Name | urlquery }}/tag/{{ $value.Tag }}/vulns.json', + {{ end }} + ]; + window.onload = function() { + Array.prototype.forEach.call(ajaxCalls, function(url, index){ + loadVulnerabilityCount(url); + }); + }; + </script> + <script> +(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ + (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), +m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) +})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); +ga('create', 'UA-29404280-12', 'jessfraz.com'); +ga('send', 'pageview'); + </script> +</body> +</html> +{{end}} diff --git a/playbooks/groups/sundries.yml b/playbooks/groups/sundries.yml index b71977add9..25233ff4c1 100644 --- a/playbooks/groups/sundries.yml +++ b/playbooks/groups/sundries.yml @@ -54,6 +54,8 @@ - include: "{{ tasks_path }}/yumrepos.yml" - include: "{{ tasks_path }}/2fa_client.yml" - include: "{{ tasks_path }}/motd.yml" + - include: "{{ tasks_path }}/reg-server.yml" + when: master_sundries_node and env == "staging" handlers: - include: "{{ handlers_path }}/restart_services.yml" diff --git a/tasks/reg-server.yml b/tasks/reg-server.yml new file mode 100644 index 0000000000..490ef3cde9 --- /dev/null +++ b/tasks/reg-server.yml @@ -0,0 +1,25 @@ +- name: install reg-server + package: + name: reg-server + state: latest + +- name: Copy reg-server repositories html template + copy: + src: "{{files}}/reg-server/repositories.html" + dest: "/var/lib/reg-server/templates/repositories.html" + +- name: Copy reg-server tags html template + copy: + src: "{{files}}/reg-server/tags.html" + dest: "/var/lib/reg-server/templates/tags.html" + +- name: Install cronjob file + copy: + src: "{{files}}/reg-server/cron-prod" + dest: "/etc/cron.d/reg-server" + +- name: Install cronjob file - stg + copy: + src: "{{files}}/reg-server/cron-stg" + dest: "/etc/cron.d/reg-server" + when: env == "staging"