Add initial version of devops-portal (#196)

* Add a glusterfs volume for devops_portal

* Add Docker Service definition for DevOps Portal

* Add haproxy configurat for devops_portal

* Add Gerrit and Jenkins services

* Add salt-formula for oss

* Add rundeck as an OSS service
diff --git a/devops_portal/service/gerrit.yml b/devops_portal/service/gerrit.yml
new file mode 100644
index 0000000..6dcad9c
--- /dev/null
+++ b/devops_portal/service/gerrit.yml
@@ -0,0 +1,9 @@
+parameters:
+  devops_portal:
+    config:
+      service:
+        gerrit:
+          endpoint:
+            address: ${_param:haproxy_gerrit_bind_host}
+            port: ${_param:haproxy_gerrit_bind_port}
+            https: ${_param:haproxy_gerrit_ssl:enabled}
diff --git a/devops_portal/service/jenkins.yml b/devops_portal/service/jenkins.yml
new file mode 100644
index 0000000..349a707
--- /dev/null
+++ b/devops_portal/service/jenkins.yml
@@ -0,0 +1,9 @@
+parameters:
+  devops_portal:
+    config:
+      service:
+        jenkins:
+          endpoint:
+            address: ${_param:haproxy_jenkins_bind_host}
+            port: ${_param:haproxy_jenkins_bind_port}
+            https: ${_param:haproxy_jenkins_ssl:enabled}
diff --git a/devops_portal/service/rundeck.yml b/devops_portal/service/rundeck.yml
new file mode 100644
index 0000000..1a15473
--- /dev/null
+++ b/devops_portal/service/rundeck.yml
@@ -0,0 +1,13 @@
+parameters:
+  devops_portal:
+    config:
+      service:
+        rundeck:
+          configure_proxy: true
+          credentials:
+            username: admin
+            password: ${_param:rundeck_admin_password}
+          endpoint:
+            address: ${_param:haproxy_rundeck_bind_host}
+            port: ${_param:haproxy_rundeck_bind_port}
+            https: ${_param:haproxy_rundeck_ssl:enabled}
diff --git a/docker/swarm/service/devops_portal.yml b/docker/swarm/service/devops_portal.yml
new file mode 100644
index 0000000..6a82aa5
--- /dev/null
+++ b/docker/swarm/service/devops_portal.yml
@@ -0,0 +1,23 @@
+parameters:
+  _param:
+    docker_devops_portal_replicas: 1
+    docker_image_devops_portal: docker-sandbox.sandbox.mirantis.net/ikharin/oss/devops-portal:latest
+  docker:
+    client:
+      service:
+        devops-portal:
+          replicas: ${_param:docker_devops_portal_replicas}
+          image: ${_param:docker_image_devops_portal}
+          restart:
+            condition: any
+          ports:
+            - 18800:8000
+          volume:
+            nginx:
+              type: bind
+              source: /srv/volumes/devops_portal/nginx/
+              destination: /etc/nginx/config
+            config:
+              type: bind
+              source: /srv/volumes/devops_portal/config/
+              destination: /opt/devops-portal/config
diff --git a/docker/swarm/service/rundeck.yml b/docker/swarm/service/rundeck.yml
new file mode 100644
index 0000000..baad94a
--- /dev/null
+++ b/docker/swarm/service/rundeck.yml
@@ -0,0 +1,47 @@
+parameters:
+  _param:
+    docker_rundeck_replicas: 1
+    docker_image_rundeck: docker-sandbox.sandbox.mirantis.net/ikharin/oss/rundeck:latest
+    rundeck_admin_password: password
+  docker:
+    client:
+      service:
+        rundeck:
+          environment:
+            SERVER_URL: "http://${_param:haproxy_rundeck_bind_host}:${_param:haproxy_rundeck_bind_port}"
+            RUNDECK_ADMIN_PASSWORD: ${_param:rundeck_admin_password}
+          replicas: ${_param:docker_rundeck_replicas}
+          image: ${_param:docker_image_rundeck}
+          restart:
+            condition: any
+          ports:
+            - 14440:4440
+          volume:
+            etc:
+              type: bind
+              source: /srv/volumes/rundeck/etc
+              destination: /etc/rundeck
+            rundeck:
+              type: bind
+              source: /srv/volumes/rundeck/rundeck
+              destination: /var/rundeck
+            mysql:
+              type: bind
+              source: /srv/volumes/rundeck/mysql
+              destination: /var/lib/mysql
+            log:
+              type: bind
+              source: /srv/volumes/rundeck/log
+              destination: /var/log/rundeck
+            logs:
+              type: bind
+              source: /srv/volumes/rundeck/logs
+              destination: /var/lib/rundeck/logs
+            plugins:
+              type: bind
+              source: /srv/volumes/rundeck/plugins
+              destination: /opt/rundeck-plugins
+            storage:
+              type: bind
+              source: /srv/volumes/rundeck/storage
+              destination: /var/lib/rundeck/var/storage
diff --git a/glusterfs/client/volume/devops_portal.yml b/glusterfs/client/volume/devops_portal.yml
new file mode 100644
index 0000000..9a3c291
--- /dev/null
+++ b/glusterfs/client/volume/devops_portal.yml
@@ -0,0 +1,10 @@
+parameters:
+  _param:
+    devops_portal_glusterfs_service_host: ${_param:glusterfs_service_host}
+  glusterfs:
+    client:
+      volumes:
+        devops_portal:
+          path: /srv/volumes/devops_portal
+          server: ${_param:devops_portal_glusterfs_service_host}
+          opts: 'defaults'
diff --git a/glusterfs/client/volume/rundeck.yml b/glusterfs/client/volume/rundeck.yml
new file mode 100644
index 0000000..b226aeb
--- /dev/null
+++ b/glusterfs/client/volume/rundeck.yml
@@ -0,0 +1,10 @@
+parameters:
+  _param:
+    rundeck_glusterfs_service_host: ${_param:glusterfs_service_host}
+  glusterfs:
+    client:
+      volumes:
+        rundeck:
+          path: /srv/volumes/rundeck
+          server: ${_param:rundeck_glusterfs_service_host}
+          opts: 'defaults'
diff --git a/glusterfs/server/volume/devops_portal.yml b/glusterfs/server/volume/devops_portal.yml
new file mode 100644
index 0000000..0b71b62
--- /dev/null
+++ b/glusterfs/server/volume/devops_portal.yml
@@ -0,0 +1,17 @@
+parameters:
+  glusterfs:
+    server:
+      volumes:
+        devops_portal:
+          storage: /srv/glusterfs/devops_portal
+          replica: 3
+          bricks:
+            - ${_param:cluster_node01_address}:/srv/glusterfs/devops_portal
+            - ${_param:cluster_node02_address}:/srv/glusterfs/devops_portal
+            - ${_param:cluster_node03_address}:/srv/glusterfs/devops_portal
+          options:
+            cluster.readdir-optimize: On
+            nfs.disable: On
+            network.remote-dio: On
+            diagnostics.client-log-level: WARNING
+            diagnostics.brick-log-level: WARNING
diff --git a/glusterfs/server/volume/rundeck.yml b/glusterfs/server/volume/rundeck.yml
new file mode 100644
index 0000000..22e5563
--- /dev/null
+++ b/glusterfs/server/volume/rundeck.yml
@@ -0,0 +1,17 @@
+parameters:
+  glusterfs:
+    server:
+      volumes:
+        rundeck:
+          storage: /srv/glusterfs/rundeck
+          replica: 3
+          bricks:
+            - ${_param:cluster_node01_address}:/srv/glusterfs/rundeck
+            - ${_param:cluster_node02_address}:/srv/glusterfs/rundeck
+            - ${_param:cluster_node03_address}:/srv/glusterfs/rundeck
+          options:
+            cluster.readdir-optimize: On
+            nfs.disable: On
+            network.remote-dio: On
+            diagnostics.client-log-level: WARNING
+            diagnostics.brick-log-level: WARNING
diff --git a/haproxy/proxy/listen/oss/devops_portal.yml b/haproxy/proxy/listen/oss/devops_portal.yml
new file mode 100644
index 0000000..e5c25cf
--- /dev/null
+++ b/haproxy/proxy/listen/oss/devops_portal.yml
@@ -0,0 +1,37 @@
+parameters:
+  _param:
+    haproxy_devops_portal_bind_host: ${_param:haproxy_bind_address}
+    haproxy_devops_portal_bind_port: 8800
+    haproxy_devops_portal_ssl:
+      enabled: false
+  haproxy:
+    proxy:
+      listen:
+        devops_portal:
+          mode: http
+          options:
+            - forwardfor
+            - httpchk
+            - httpclose
+            - httplog
+          balance: source
+          http_request:
+            - action: "add-header X-Forwarded-Proto https"
+              condition: "if { ssl_fc }"
+          binds:
+            - address: ${_param:haproxy_devops_portal_bind_host}
+              port: ${_param:haproxy_devops_portal_bind_port}
+              ssl: ${_param:haproxy_devops_portal_ssl}
+          servers:
+            - name: ${_param:cluster_node01_name}
+              host: ${_param:cluster_node01_address}
+              port: 18800
+              params: check
+            - name: ${_param:cluster_node02_name}
+              host: ${_param:cluster_node02_address}
+              port: 18800
+              params: backup check
+            - name: ${_param:cluster_node03_name}
+              host: ${_param:cluster_node03_address}
+              port: 18800
+              params: backup check
diff --git a/haproxy/proxy/listen/oss/rundeck.yml b/haproxy/proxy/listen/oss/rundeck.yml
new file mode 100644
index 0000000..fbabb38
--- /dev/null
+++ b/haproxy/proxy/listen/oss/rundeck.yml
@@ -0,0 +1,37 @@
+parameters:
+  _param:
+    haproxy_rundeck_bind_host: ${_param:haproxy_bind_address}
+    haproxy_rundeck_bind_port: 4440
+    haproxy_rundeck_ssl:
+      enabled: false
+  haproxy:
+    proxy:
+      listen:
+        rundeck:
+          mode: http
+          options:
+            - forwardfor
+            - httpchk
+            - httpclose
+            - httplog
+          balance: source
+          http_request:
+            - action: "add-header X-Forwarded-Proto https"
+              condition: "if { ssl_fc }"
+          binds:
+            - address: ${_param:haproxy_rundeck_bind_host}
+              port: ${_param:haproxy_rundeck_bind_port}
+              ssl: ${_param:haproxy_rundeck_ssl}
+          servers:
+            - name: ${_param:cluster_node01_name}
+              host: ${_param:cluster_node01_address}
+              port: 14440
+              params: check
+            - name: ${_param:cluster_node02_name}
+              host: ${_param:cluster_node02_address}
+              port: 14440
+              params: backup check
+            - name: ${_param:cluster_node03_name}
+              host: ${_param:cluster_node03_address}
+              port: 14440
+              params: backup check
diff --git a/salt/master/formula/git/oss.yml b/salt/master/formula/git/oss.yml
new file mode 100644
index 0000000..9354935
--- /dev/null
+++ b/salt/master/formula/git/oss.yml
@@ -0,0 +1,13 @@
+parameters:
+  _param:
+    salt_master_oss_repository: https://gerrit.mcp.mirantis.net/oss
+    salt_master_oss_revision: master
+  salt:
+    master:
+      environment:
+        dev:
+          formula:
+            devops-portal:
+              source: git
+              address: '${_param:salt_master_oss_repository}/salt-formula-devops-portal.git'
+              revision: ${_param:salt_master_oss_revision}