Page MenuHomeDevCentral

No OneTemporary

diff --git a/config.yml b/config.yml
index 79253b5..11db05b 100644
--- a/config.yml
+++ b/config.yml
@@ -1,35 +1,37 @@
# Your project's server will run on localhost:xxxx at this port
PORT: 8000
# https://localtunnel.github.io/www/
TUNNEL: "serverslog"
# Autoprefixer will make sure your CSS works with these browsers
COMPATIBILITY:
- "last 2 versions"
- "ie >= 9"
- "ios >= 7"
# UnCSS will use these settings
UNCSS_OPTIONS:
html:
- "src/**/*.html"
ignore:
- !!js/regexp .foundation-mq
- !!js/regexp ^\.is-.*
# Gulp will reference these paths when it copies files
PATHS:
# Path to dist folder
dist: "dist"
# Paths to static assets that aren't images, CSS, or JavaScript
assets:
- "src/assets/**/*"
- "!src/assets/{img,js,scss}{,/**/*}"
# Paths to Sass libraries, which can then be loaded with @import
sass:
- "node_modules/foundation-sites/scss"
- "node_modules/motion-ui/src"
# Paths to JavaScript entry points for webpack to bundle modules
entries:
- - "src/assets/js/app.js"
\ No newline at end of file
+ - "src/assets/js/app.js"
+ - "src/assets/js/docker-registry.js"
+ - "src/assets/js/servers-log.js"
diff --git a/src/assets/js/app.js b/src/assets/js/app.js
index 9fbaeba..6c476e2 100644
--- a/src/assets/js/app.js
+++ b/src/assets/js/app.js
@@ -1,343 +1,22 @@
/* -------------------------------------------------------------
Nasqueron infrastructure
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Project: Nasqueron
Author: Sébastien Santoro aka Dereckson
Dependencies: jQuery
Filename: app.js
Licence: CC-BY 4.0, MIT, BSD-2-Clause (multi-licensing)
------------------------------------------------------------- */
import $ from 'jquery';
window.$ = $;
import Foundation from 'foundation-sites';
-/* -------------------------------------------------------------
- Table of contents
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- :: Servers log
- :: Code to run when document is ready
-
- */
-
-var ServersLog = function (url, container) {
- var serversLog = {
-
- ///
- /// Private properties
- ///
-
- /**
- * A JQuery selector expression to a DOM element to publish the log in.
- *
- * @var string
- */
- container: "",
-
- /**
- * The URL to fetch the log.
- *
- * @var string
- */
- url: "",
-
- /**
- * The log entries fetched.
- *
- * @var array
- */
- logEntries: [],
-
- ///
- /// Constructor
- ///
-
- /**
- * Initializes an instance of this object.
- *
- * @param url The URL to the log
- * @param container The DOM element JQuery selector where to write
- */
- load: function (url, container) {
- this.url = url;
- this.container = container;
- this.refreshData();
- },
-
- ///
- /// Main methods
- ///
-
- /**
- * Fetches log entries. That will trigger an UI refresh once fetched.
- */
- refreshData: function () {
- this.fetchLogEntries();
- },
-
- /**
- * Refreshes the UI from the content in logEntries array.
- */
- refreshUI: function () {
- $(this.container).html(this.formatEntries());
- },
-
- ///
- /// Data helper methods
- ///
-
- /**
- * Fetches the log entries at the log URL, fills logEntries array,
- * refreshes the UI.
- */
- fetchLogEntries: function () {
- $.getJSON(this.url, function(data) {
- serversLog.logEntries = data.reverse(); // Log is chronological.
- serversLog.refreshUI();
- });
- },
-
- ///
- /// UI helper methods
- ///
-
- formatEntries: function () {
- var currentDate = "";
- var currentMonth = "";
-
- var entries = "";
- for (var i = 0; i < this.logEntries.length; i++) {
- var entry = this.logEntries[i];
- var date = this.getDate(entry.date);
- if (date != currentDate) {
- // Month heading
- var month = this.getMonth(entry.date);
- if (month != currentMonth) {
- entries += this.formatMonthHeadings(entry.date);
- currentMonth = month;
- }
-
- // Day heading
- entries += this.formatDateHeadings(date);
- currentDate = date;
- }
- entries += this.formatEntry(entry);
- }
- return entries;
- },
-
- formatEntry: function (entry) {
- var format = `<p class="log-entry">
- <span class="log-component secondary label">%%component%%</span>
- <span class="log-time">%%date%%</span>
- <span class="log-emitter">%%emitter%%</span>:
- <span class="log-message">%%message%%</span>
- </p>`;
- return format
- .replace("%%component%%", entry.component)
- .replace("%%date%%", this.getTime(entry.date))
- .replace("%%emitter%%", entry.emitter)
- .replace("%%message%%", this.formatMessage(entry.entry))
- ;
- },
-
- ///
- /// Formats date headings
- ///
-
- /**
- * The month names.
- *
- * @var array
- */
- monthNames: [
- "January", "February", "March",
- "April", "May", "June",
- "July", "August", "September",
- "October", "November", "December"
- ],
-
- /**
- ** Gets a day headings element.
- *
- * @param date The date to print
- * @returns {string} The day heading
- */
- formatDateHeadings: function (date) {
- return '<h3>' + date + '</h3>';
- },
-
- /**
- * Gets a month heading element.
- *
- * @param timestamp The date to parse
- * @returns {string} The month heading
- */
- formatMonthHeadings: function (timestamp) {
- var date = new Date(timestamp);
- var month = this.monthNames[date.getUTCMonth()];
-
- return "<h2>" + month + "</h2>";
- },
-
- ///
- /// Format messages helper functions
- ///
-
- /**
- * @var array
- */
- messageDecorators: [
- {
- // SHA-1 Git commit hashes
- re: /\b([0-9a-f]{7,40})\b/g,
-
- /**
- * Callback method to linkify when needed a SHA-1 hash.
- *
- * @param match The expression matched by the regexp
- * @param p1 The SHA-1 hash candidate
- * @param offset The position p1 has been found
- * @param string The full string p1 has been found
- * @returns {string}
- */
- replaceBy: function (match, p1, offset, string) {
- if (!serversLog.isHash(p1)) {
- return p1;
- }
-
- return '<a href="https://devcentral.nasqueron.org/search/?query=%1">%1</a>'
- .replace(/%1/g, p1);
- },
- },
- {
- // Tasks, reviews and pastes
- re: /\b([TDP][0-9]{1,6}(\#[0-9]{1,10})?)\b/g,
- replaceBy: '<a href="https://devcentral.nasqueron.org/$1">$1</a>',
- },
- {
- // Repositories callsigns
- re: /\br([A-Z]{3,32})\b/g,
- replaceBy: '<a rel="repository" href="https://devcentral.nasqueron.org/diffusion/$1/">r$1</a>',
- },
- {
- // Commits with callsigns
- re: /\br([A-Z]{3,32}[0-9a-f]{7,40})\b/g,
- replaceBy: '<a rel="commit" href="https://devcentral.nasqueron.org/r$1">r$1</a>',
- },
- {
- // Code (or SQL query parameter)
- re: /`(.*?)`/g,
- replaceBy: '<code>$1</code>'
- }
- ],
-
- /**
- * Whitelist of known hexadecimal words.
- *
- * @var array
- */
- hexadecimalKnownWord: [
- "added",
- "accede",
- "adead",
- "decade",
- "deedeed",
- "deface",
- "ed25519",
- "efface",
- "facade",
- "faced",
- "faded",
- ],
-
- /**
- * Determines if an expression matches a whitelisted hexadecimal word.
- *
- * @param word The word to check
- * @returns {boolean}
- */
- isHexadecimalKnownWord: function (word) {
- return this.hexadecimalKnownWord.indexOf(word) > -1;
- },
-
- /**
- * Determines if the specified expression is probably an hash.
- *
- * An hash is anything hexadecimal with at least one digit < 10
- * and one digit > 9 (A-F), not matching known vocabulary.
- *
- * @param hash
- * @returns {boolean}
- */
- isHash: function (hash) {
- if (this.isHexadecimalKnownWord(hash)) {
- return false;
- }
-
- if (/^\d+$/.test(hash) || /^[a-z]+$/i.test(hash)) {
- // Contains only letter or digits,
- // so not a good hash candidate.
- return false;
- }
-
- return true;
- },
-
- formatMessage: function (message) {
- for (var i = 0; i < this.messageDecorators.length; i++) {
- var decorator = this.messageDecorators[i];
- message = message.replace(decorator.re, decorator.replaceBy);
- }
-
- return message;
- },
-
- ///
- /// Date and time helper functions
- ///
-
- pad: function (number) {
- if (number < 10) {
- return '0' + number;
- }
- return number;
- },
-
- getDate: function (timestamp) {
- var date = new Date(timestamp);
- return date.getUTCFullYear()
- + '-' + this.pad(date.getUTCMonth() + 1)
- + '-' + this.pad(date.getUTCDate());
- },
-
- getTime: function (timestamp) {
- var date = new Date(timestamp);
- return this.pad(date.getUTCHours())
- + ':' + this.pad(date.getUTCMinutes());
- },
-
- getMonth: function (timestamp) {
- var date = new Date(timestamp);
- return date.getUTCMonth();
- }
-
- }
-
- typeof container === 'string' && serversLog.load(url, container);
-
- return serversLog;
-}
-
-
/* -------------------------------------------------------------
Code to run when document is ready
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
$(document).ready(function() {
$(document).foundation();
-
- new ServersLog("https://api.nasqueron.org/servers-log/all.json", "#log");
});
diff --git a/src/assets/js/docker-registry.js b/src/assets/js/docker-registry.js
new file mode 100644
index 0000000..4939e7a
--- /dev/null
+++ b/src/assets/js/docker-registry.js
@@ -0,0 +1,100 @@
+/* -------------------------------------------------------------
+ Nasqueron infrastructure
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ Project: Nasqueron
+ Author: Sébastien Santoro aka Dereckson
+ Dependencies: jQuery
+ Filename: docker-registry.js
+ Licence: CC-BY 4.0, MIT, BSD-2-Clause (multi-licensing)
+ ------------------------------------------------------------- */
+
+/* -------------------------------------------------------------
+ Table of contents
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ :: Docker registry API client
+ :: Code to run when document is ready
+
+ */
+
+/* -------------------------------------------------------------
+ Docker registry API client
+
+ Note: this code consumes our own private microservice in Rust
+ https://devcentral.nasqueron.org/source/docker-registry-api/
+
+ The Docker private registry also provides a REST API, but
+ the client isn't compatible.
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+let DockerRegistryClient = function (url, container) {
+ let dockerRegistryClient = {
+ url: "",
+ container: "",
+ repositories: [],
+
+ ///
+ /// Constructor
+ ///
+
+ load: function (url, container) {
+ this.url = url;
+ this.container = container;
+
+ $(container).text(`Querying ${this.url}…`);
+ this.refreshData();
+ },
+
+ ///
+ /// Main methods
+ ///
+
+ /**
+ * Fetches log entries. That will trigger an UI refresh once fetched.
+ */
+ refreshData: function () {
+ this.getAllRepositories();
+ },
+
+ refreshUI: function () {
+ this.clearUI();
+ for (let repository of this.repositories) {
+ $(container).append(`<h3>${repository.name}</h3>`);
+ for (let tag of repository.tags) {
+ $(container).append(`<p><strong>${tag.name}</strong> — ${tag.hash}</p>`);
+ }
+ }
+ },
+
+ clearUI: function () {
+ $(container).text("");
+ },
+
+ ///
+ /// API client methods
+ ///
+
+ getAllRepositories: function () {
+ const url = this.url + "/repository/getAll";
+
+ $.getJSON(url, function(repositories) {
+ dockerRegistryClient.repositories = repositories;
+ dockerRegistryClient.refreshUI();
+ });
+ }
+ };
+
+ typeof container === 'string' && dockerRegistryClient.load(url, container);
+
+ return dockerRegistryClient;
+};
+
+
+/* -------------------------------------------------------------
+ Code to run when document is ready
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+$(document).ready(function() {
+ new DockerRegistryClient("https://api.nasqueron.org/docker/registry", "#registry");
+});
+
diff --git a/src/assets/js/app.js b/src/assets/js/servers-log.js
similarity index 98%
copy from src/assets/js/app.js
copy to src/assets/js/servers-log.js
index 9fbaeba..7483892 100644
--- a/src/assets/js/app.js
+++ b/src/assets/js/servers-log.js
@@ -1,343 +1,335 @@
/* -------------------------------------------------------------
Nasqueron infrastructure
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Project: Nasqueron
Author: Sébastien Santoro aka Dereckson
Dependencies: jQuery
- Filename: app.js
+ Filename: servers-log.js
Licence: CC-BY 4.0, MIT, BSD-2-Clause (multi-licensing)
------------------------------------------------------------- */
-import $ from 'jquery';
-window.$ = $;
-
-import Foundation from 'foundation-sites';
-
/* -------------------------------------------------------------
Table of contents
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
:: Servers log
:: Code to run when document is ready
*/
var ServersLog = function (url, container) {
var serversLog = {
///
/// Private properties
///
/**
* A JQuery selector expression to a DOM element to publish the log in.
*
* @var string
*/
container: "",
/**
* The URL to fetch the log.
*
* @var string
*/
url: "",
/**
* The log entries fetched.
*
* @var array
*/
logEntries: [],
///
/// Constructor
///
/**
* Initializes an instance of this object.
*
* @param url The URL to the log
* @param container The DOM element JQuery selector where to write
*/
load: function (url, container) {
this.url = url;
this.container = container;
this.refreshData();
},
///
/// Main methods
///
/**
* Fetches log entries. That will trigger an UI refresh once fetched.
*/
refreshData: function () {
this.fetchLogEntries();
},
/**
* Refreshes the UI from the content in logEntries array.
*/
refreshUI: function () {
$(this.container).html(this.formatEntries());
},
///
/// Data helper methods
///
/**
* Fetches the log entries at the log URL, fills logEntries array,
* refreshes the UI.
*/
fetchLogEntries: function () {
$.getJSON(this.url, function(data) {
serversLog.logEntries = data.reverse(); // Log is chronological.
serversLog.refreshUI();
});
},
///
/// UI helper methods
///
formatEntries: function () {
var currentDate = "";
var currentMonth = "";
var entries = "";
for (var i = 0; i < this.logEntries.length; i++) {
var entry = this.logEntries[i];
var date = this.getDate(entry.date);
if (date != currentDate) {
// Month heading
var month = this.getMonth(entry.date);
if (month != currentMonth) {
entries += this.formatMonthHeadings(entry.date);
currentMonth = month;
}
// Day heading
entries += this.formatDateHeadings(date);
currentDate = date;
}
entries += this.formatEntry(entry);
}
return entries;
},
formatEntry: function (entry) {
var format = `<p class="log-entry">
<span class="log-component secondary label">%%component%%</span>
<span class="log-time">%%date%%</span>
<span class="log-emitter">%%emitter%%</span>:
<span class="log-message">%%message%%</span>
</p>`;
return format
.replace("%%component%%", entry.component)
.replace("%%date%%", this.getTime(entry.date))
.replace("%%emitter%%", entry.emitter)
.replace("%%message%%", this.formatMessage(entry.entry))
;
},
///
/// Formats date headings
///
/**
* The month names.
*
* @var array
*/
monthNames: [
"January", "February", "March",
"April", "May", "June",
"July", "August", "September",
"October", "November", "December"
],
/**
** Gets a day headings element.
*
* @param date The date to print
* @returns {string} The day heading
*/
formatDateHeadings: function (date) {
return '<h3>' + date + '</h3>';
},
/**
* Gets a month heading element.
*
* @param timestamp The date to parse
* @returns {string} The month heading
*/
formatMonthHeadings: function (timestamp) {
var date = new Date(timestamp);
var month = this.monthNames[date.getUTCMonth()];
return "<h2>" + month + "</h2>";
},
///
/// Format messages helper functions
///
/**
* @var array
*/
messageDecorators: [
{
// SHA-1 Git commit hashes
re: /\b([0-9a-f]{7,40})\b/g,
/**
* Callback method to linkify when needed a SHA-1 hash.
*
* @param match The expression matched by the regexp
* @param p1 The SHA-1 hash candidate
* @param offset The position p1 has been found
* @param string The full string p1 has been found
* @returns {string}
*/
replaceBy: function (match, p1, offset, string) {
if (!serversLog.isHash(p1)) {
return p1;
}
return '<a href="https://devcentral.nasqueron.org/search/?query=%1">%1</a>'
.replace(/%1/g, p1);
},
},
{
// Tasks, reviews and pastes
re: /\b([TDP][0-9]{1,6}(\#[0-9]{1,10})?)\b/g,
replaceBy: '<a href="https://devcentral.nasqueron.org/$1">$1</a>',
},
{
// Repositories callsigns
re: /\br([A-Z]{3,32})\b/g,
replaceBy: '<a rel="repository" href="https://devcentral.nasqueron.org/diffusion/$1/">r$1</a>',
},
{
// Commits with callsigns
re: /\br([A-Z]{3,32}[0-9a-f]{7,40})\b/g,
replaceBy: '<a rel="commit" href="https://devcentral.nasqueron.org/r$1">r$1</a>',
},
{
// Code (or SQL query parameter)
re: /`(.*?)`/g,
replaceBy: '<code>$1</code>'
}
],
/**
* Whitelist of known hexadecimal words.
*
* @var array
*/
hexadecimalKnownWord: [
"added",
"accede",
"adead",
"decade",
"deedeed",
"deface",
"ed25519",
"efface",
"facade",
"faced",
"faded",
],
/**
* Determines if an expression matches a whitelisted hexadecimal word.
*
* @param word The word to check
* @returns {boolean}
*/
isHexadecimalKnownWord: function (word) {
return this.hexadecimalKnownWord.indexOf(word) > -1;
},
/**
* Determines if the specified expression is probably an hash.
*
* An hash is anything hexadecimal with at least one digit < 10
* and one digit > 9 (A-F), not matching known vocabulary.
*
* @param hash
* @returns {boolean}
*/
isHash: function (hash) {
if (this.isHexadecimalKnownWord(hash)) {
return false;
}
if (/^\d+$/.test(hash) || /^[a-z]+$/i.test(hash)) {
// Contains only letter or digits,
// so not a good hash candidate.
return false;
}
return true;
},
formatMessage: function (message) {
for (var i = 0; i < this.messageDecorators.length; i++) {
var decorator = this.messageDecorators[i];
message = message.replace(decorator.re, decorator.replaceBy);
}
return message;
},
///
/// Date and time helper functions
///
pad: function (number) {
if (number < 10) {
return '0' + number;
}
return number;
},
getDate: function (timestamp) {
var date = new Date(timestamp);
return date.getUTCFullYear()
+ '-' + this.pad(date.getUTCMonth() + 1)
+ '-' + this.pad(date.getUTCDate());
},
getTime: function (timestamp) {
var date = new Date(timestamp);
return this.pad(date.getUTCHours())
+ ':' + this.pad(date.getUTCMinutes());
},
getMonth: function (timestamp) {
var date = new Date(timestamp);
return date.getUTCMonth();
}
}
typeof container === 'string' && serversLog.load(url, container);
return serversLog;
}
-
/* -------------------------------------------------------------
Code to run when document is ready
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
$(document).ready(function() {
- $(document).foundation();
-
new ServersLog("https://api.nasqueron.org/servers-log/all.json", "#log");
});
diff --git a/src/layouts/default.html b/src/layouts/default.html
index 3fe6f70..66e5fd4 100644
--- a/src/layouts/default.html
+++ b/src/layouts/default.html
@@ -1,19 +1,22 @@
{{!-- This is the base layout for your project, and will be used on every page. --}}
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ title }} — Nasqueron</title>
<link href="https://fonts.googleapis.com/css?family=Dosis:200|Source+Sans+Pro|Roboto+Mono" rel="stylesheet">
<link rel="stylesheet" href="{{root}}assets/css/app.css">
</head>
<body>
{{> header}}
{{> body}}
{{> footer}}
<script src="{{root}}assets/js/app.js"></script>
+ {{#if app}}
+ <script src="{{root}}assets/js/{{app}}.js"></script>
+ {{/if}}
</body>
</html>
diff --git a/src/pages/docker/registry/index.html b/src/pages/docker/registry/index.html
new file mode 100644
index 0000000..546e743
--- /dev/null
+++ b/src/pages/docker/registry/index.html
@@ -0,0 +1,23 @@
+---
+title: Docker registry
+app: docker-registry
+---
+
+<section class="row">
+ <div class="large-12 columns">
+ {{> docker-registry-intro}}
+ </div>
+</section>
+
+<div class="row">
+ <div class="large-9 columns">
+ <h2>Docker Hub</h2>
+ <p>As we mainly use and produce open source code, we store our images on the Docker Hub.</p>
+ <p>This is the primary and default source for images.</p>
+ <h2>Private registry</h2>
+ <div id="registry"></div>
+ </div>
+ <div class="large-3 columns">
+ {{> docker-registry-help}}
+ </div>
+</div>
diff --git a/src/pages/servers-log/index.html b/src/pages/servers-log/index.html
index 35c687c..bb1ffbd 100644
--- a/src/pages/servers-log/index.html
+++ b/src/pages/servers-log/index.html
@@ -1,17 +1,18 @@
---
title: Servers log
+app: servers-log
---
<section class="row">
<div class="large-12 columns">
{{> log-intro}}
</div>
</section>
<div class="row">
<div class="large-9 columns" id="log">
</div>
<div class="large-3 columns">
{{> log-help}}
</div>
</div>
diff --git a/src/partials/docker-registry/docker-registry-help.html b/src/partials/docker-registry/docker-registry-help.html
new file mode 100644
index 0000000..440100d
--- /dev/null
+++ b/src/partials/docker-registry/docker-registry-help.html
@@ -0,0 +1,20 @@
+<div class="callout primary">
+ <h3>Source</h3>
+ <p>The entries are the containers pushed to the private registry.</p>
+ <p>They are fetched through our <a href="https://docs.nasqueron.org/docker-registry-api/">Docker registry API </a>.</p>
+</div>
+<div class="callout primary">
+ <h3>Add a container</h3>
+ <p>
+ On Equatower:
+ <br /><code>docker tag &lt;hash&gt; localhost:5000/image_name</code>
+ <br /><code>docker push localhost:5000/image_name</code>
+ </p>
+ <p>If you don't have an access, reach Dereckson on Freenode #nasqueron-ops.</p>
+</div>
+<div class="callout primary">
+ <h3>License</h3>
+ <p>Individual records are too short to be original, and so are in the public domain.</p>
+ <p>When original enough, content is available under <a rel="license" href="https://creativecommons.org/licenses/by/4.0/">CC-BY 4.0</a> licence.</p>
+ <p>This log, as a database, is made available under the <a rel="license" href="http://www.opendatacommons.org/licenses/pddl/1.0/">Public Domain Dedication and License v1.0</a>.</p>
+</div>
diff --git a/src/partials/docker-registry/docker-registry-intro.html b/src/partials/docker-registry/docker-registry-intro.html
new file mode 100644
index 0000000..1b868ab
--- /dev/null
+++ b/src/partials/docker-registry/docker-registry-intro.html
@@ -0,0 +1,4 @@
+<div class="callout">
+ <p>Our Docker PaaS contains a private <strong>Docker registry</strong> to store migrations and work in progress containers.</p>
+ <p>This index offers the list of images and tags available.</p>
+</div>

File Metadata

Mime Type
text/x-diff
Expires
Sat, Nov 14, 19:17 (4 d, 17 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4246182
Default Alt Text
(28 KB)

Event Timeline