Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3803115
D2465.id6210.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D2465.id6210.diff
View Options
diff --git a/PORTS b/PORTS
--- a/PORTS
+++ b/PORTS
@@ -38,4 +38,6 @@
41080 ACME DNS server HTTP
42080 Jenkins HTTP - CI
43080 Hauk
+ 44080 Hound
+ # 45080 should be reserved for OpenGrok to compare with Hound
50000 Jenkins master's port for JNLP-based Jenkins agents - CD
diff --git a/pillar/paas/docker.sls b/pillar/paas/docker.sls
--- a/pillar/paas/docker.sls
+++ b/pillar/paas/docker.sls
@@ -51,6 +51,7 @@
- nasqueron/etherpad:production
- nasqueron/notifications
- nasqueron/phabricator
+ - etsy/hound
# Continuous deployment jobs
- jenkins/jenkins
@@ -281,6 +282,12 @@
# Infrastructure and development services
+ hound:
+ hound:
+ app_port: 44080
+ host: code.nasqueron.org
+ github_account: nasqueron
+
notifications:
notifications:
host: notifications.nasqueron.org
diff --git a/roles/paas-docker/containers/files/hound/generate-config.py b/roles/paas-docker/containers/files/hound/generate-config.py
new file mode 100755
--- /dev/null
+++ b/roles/paas-docker/containers/files/hound/generate-config.py
@@ -0,0 +1,53 @@
+#!/usr/bin/env python3
+
+
+import json
+import sys
+
+
+# -------------------------------------------------------------
+# Configuration methods
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+
+def generate_config(account, repositories):
+ repos = [get_repo_config(account, repo) for repo in repositories]
+
+ return {
+ "max-concurrent-indexers": 2,
+ "dbpath": "data",
+ "title": f"{account} code search".title(),
+ "health-check-uri": "/healthz",
+ "vcs-config": {
+ "git": {
+ "detect-ref": True
+ }
+ },
+ "repos": dict(repos)
+ }
+
+
+def get_repo_config(account, repo):
+ return repo, {
+ "url": f"https://www.github.com/{account}/{repo}.git"
+ }
+
+
+# -------------------------------------------------------------
+# Application entry point
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+
+def run(account):
+ repos = [line.strip() for line in sys.stdin]
+
+ config = generate_config(account, repos)
+ print(json.dumps(config))
+
+
+if __name__ == "__main__":
+ try:
+ run(sys.argv[1])
+ except IndexError:
+ print("Usage:", sys.argv[0], "<GitHub org account>", file=sys.stderr)
+ sys.exit(2)
diff --git a/roles/paas-docker/containers/hound.sls b/roles/paas-docker/containers/hound.sls
new file mode 100644
--- /dev/null
+++ b/roles/paas-docker/containers/hound.sls
@@ -0,0 +1,75 @@
+# -------------------------------------------------------------
+# Salt — Provision Docker engine
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+{% set has_selinux = salt['grains.get']('selinux:enabled', False) %}
+{% set containers = pillar['docker_containers'][grains['id']] %}
+
+
+# -------------------------------------------------------------
+# Configuration provider
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+/usr/local/bin/hound-generate-config:
+ file.managed:
+ - source: salt://roles/paas-docker/containers/files/hound/generate-config.py
+ - mode: 755
+
+
+{% for instance, container in containers['hound'].items() %}
+
+# -------------------------------------------------------------
+# Home directory
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+/srv/hound/{{ instance }}:
+ file.directory:
+ - makedirs: True
+
+{% if has_selinux %}
+selinux_context_{{ instance }}_data:
+ selinux.fcontext_policy_present:
+ - name: /srv/hound/{{ instance }}
+ - sel_type: container_file_t
+
+selinux_context_{{ instance }}_data_applied:
+ selinux.fcontext_policy_applied:
+ - name: /srv/hound/{{ instance }}
+{% endif %}
+
+# -------------------------------------------------------------
+# Configuration
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+{% set repos_path = "/srv/hound/" + instance + "/repos.txt" %}
+{% set config_path = "/srv/hound/" + instance + "/config.json" %}
+
+hound_{{ instance }}_repositories:
+ cmd.run:
+ - name: docker run --rm nasqueron/devtools github/list-repositories.py {{ container['github_account'] }} > {{ repos_path }}
+ - creates: {{ repos_path }}
+
+hound_{{ instance }}_config:
+ cmd.run:
+ - name: hound-generate-config {{ container['github_account'] }} < {{ repos_path }} > {{ config_path }}
+ - creates: {{ config_path }}
+
+# -------------------------------------------------------------
+# Container
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+{{ instance }}:
+ docker_container.running:
+ - detach: True
+ - interactive: True
+ - image: etsy/hound
+ - binds: /srv/hound/{{ instance }}:/data
+ - ports:
+ - 6080
+ - port_bindings:
+ - {{ container['app_port'] }}:6080
+
+{% endfor %}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 30, 14:40 (19 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2273076
Default Alt Text
D2465.id6210.diff (5 KB)
Attached To
Mode
D2465: Provide Hound container to search Nasqueron codebase
Attached
Detach File
Event Timeline
Log In to Comment