Merge "DevOps portal: Pushkin service"
diff --git a/devops_portal/service/elasticsearch.yml b/devops_portal/service/elasticsearch.yml
new file mode 100644
index 0000000..b945af3
--- /dev/null
+++ b/devops_portal/service/elasticsearch.yml
@@ -0,0 +1,10 @@
+parameters:
+  devops_portal:
+    config:
+      service:
+        elasticsearch:
+          configure_proxy: true
+          endpoint:
+            address: ${_param:haproxy_elasticsearch_bind_host}
+            port: ${_param:haproxy_elasticsearch_bind_port}
+            https: ${_param:haproxy_elasticsearch_ssl:enabled}
diff --git a/docker/swarm/service/elasticsearch.yml b/docker/swarm/service/elasticsearch.yml
new file mode 100644
index 0000000..02dea57
--- /dev/null
+++ b/docker/swarm/service/elasticsearch.yml
@@ -0,0 +1,19 @@
+parameters:
+  _param:
+    elasticsearch_replicas: 1
+    docker_image_oss_elasticsearch: docker-sandbox.sandbox.mirantis.net/vstoiko/oss/elasticsearch:latest
+  docker:
+    client:
+      service:
+        elasticsearch:
+          replicas: ${_param:elasticsearch_replicas}
+          image: ${_param:docker_image_oss_elasticsearch}
+          restart:
+            condition: any
+          ports:
+            - ${_param:haproxy_elasticsearch_exposed_port}:${_param:haproxy_elasticsearch_bind_port}
+          volume:
+            elasticsearch:
+              type: bind
+              source: /srv/volumes/elasticsearch
+              destination: /var/lib/elasticsearch/data
diff --git a/docker/swarm/service/pushkin.yml b/docker/swarm/service/pushkin.yml
new file mode 100644
index 0000000..e4fe424
--- /dev/null
+++ b/docker/swarm/service/pushkin.yml
@@ -0,0 +1,28 @@
+parameters:
+  _param:
+    docker_pushkin_replicas: 1
+    docker_image_pushkin: docker-sandbox.sandbox.mirantis.net/vstoiko/oss/pushkin:latest
+    pushkin_db_password: pushkin
+    pushkin_db_user: pushkin
+    pushkin_db: pushkin
+  docker:
+    client:
+      service:
+        pushkin-backend:
+          environment:
+            POSTGRES_USER: ${_param:pushkin_db_user}
+            POSTGRES_PASSWORD: ${_param:pushkin_db_password}
+            POSTGRES_DB: ${_param:pushkin_db}
+            PUSHKINDBHOST: ${_param:haproxy_pushkin_db_bind_host}
+            PUSHKINELASTICHOST: ${_param:haproxy_elasticsearch_bind_host}
+          replicas: ${_param:docker_pushkin_replicas}
+          image: ${_param:docker_image_pushkin}
+          restart:
+            condition: any
+          ports:
+            - ${_param:haproxy_pushkin_exposed_port}:${_param:haproxy_pushkin_bind_port}
+          volume:
+            pushkin:
+              type: bind
+              source: /srv/volumes/pushkin/logs
+              destination: /var/log/pushkin/logs
\ No newline at end of file
diff --git a/docker/swarm/service/pushkin_db.yml b/docker/swarm/service/pushkin_db.yml
new file mode 100644
index 0000000..9b81778
--- /dev/null
+++ b/docker/swarm/service/pushkin_db.yml
@@ -0,0 +1,27 @@
+parameters:
+  _param:
+    docker_pushkin_db_replicas: 1
+    docker_image_pushkin_db: docker-sandbox.sandbox.mirantis.net/vstoiko/oss/pushkindb:latest
+    pushkin_db_password: pushkin
+    pushkin_db_user: pushkin
+    pushkin_db: pushkin
+  docker:
+    client:
+      service:
+        pushkin-db:
+          environment:
+            POSTGRES_USER: ${_param:pushkin_db_user}
+            POSTGRES_PASSWORD: ${_param:pushkin_db_password}
+            POSTGRES_DB: ${_param:pushkin_db}
+          replicas: ${_param:docker_pushkin_db_replicas}
+          image: ${_param:docker_image_pushkin_db}
+          restart:
+            condition: any
+          ports:
+            - ${_param:haproxy_pushkin_db_exposed_port}:${_param:haproxy_pushkin_db_bind_port}
+          volume:
+            pushkin:
+              type: bind
+              source: /srv/volumes/pushkin/data
+              destination: /var/lib/postgresql/data
+
diff --git a/glusterfs/client/volume/elasticsearch.yml b/glusterfs/client/volume/elasticsearch.yml
new file mode 100644
index 0000000..f5ad7ae
--- /dev/null
+++ b/glusterfs/client/volume/elasticsearch.yml
@@ -0,0 +1,10 @@
+parameters:
+  _param:
+    elasticsearch_glusterfs_service_host: ${_param:glusterfs_service_host}
+  glusterfs:
+    client:
+      volumes:
+        elasticsearch:
+          path: /srv/volumes/elasticsearch
+          server: ${_param:elasticsearch_glusterfs_service_host}
+          opts: 'defaults'
diff --git a/glusterfs/client/volume/pushkin.yml b/glusterfs/client/volume/pushkin.yml
new file mode 100644
index 0000000..1853863
--- /dev/null
+++ b/glusterfs/client/volume/pushkin.yml
@@ -0,0 +1,10 @@
+parameters:
+  _param:
+    pushkin_glusterfs_service_host: ${_param:glusterfs_service_host}
+  glusterfs:
+    client:
+      volumes:
+        pushkin:
+          path: /srv/volumes/pushkin
+          server: ${_param:pushkin_glusterfs_service_host}
+          opts: 'defaults'
diff --git a/glusterfs/server/volume/elasticsearch.yml b/glusterfs/server/volume/elasticsearch.yml
new file mode 100644
index 0000000..73f35c1
--- /dev/null
+++ b/glusterfs/server/volume/elasticsearch.yml
@@ -0,0 +1,17 @@
+parameters:
+  glusterfs:
+    server:
+      volumes:
+        elasticsearch:
+          storage: /srv/glusterfs/elasticsearch
+          replica: 3
+          bricks:
+            - ${_param:cluster_node01_address}:/srv/glusterfs/elasticsearch
+            - ${_param:cluster_node02_address}:/srv/glusterfs/elasticsearch
+            - ${_param:cluster_node03_address}:/srv/glusterfs/elasticsearch
+          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/pushkin.yml b/glusterfs/server/volume/pushkin.yml
new file mode 100644
index 0000000..52d393e
--- /dev/null
+++ b/glusterfs/server/volume/pushkin.yml
@@ -0,0 +1,17 @@
+parameters:
+  glusterfs:
+    server:
+      volumes:
+        pushkin:
+          storage: /srv/glusterfs/pushkin
+          replica: 3
+          bricks:
+            - ${_param:cluster_node01_address}:/srv/glusterfs/pushkin
+            - ${_param:cluster_node02_address}:/srv/glusterfs/pushkin
+            - ${_param:cluster_node03_address}:/srv/glusterfs/pushkin
+          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/elasticsearch.yml b/haproxy/proxy/listen/oss/elasticsearch.yml
new file mode 100644
index 0000000..2f5d1ee
--- /dev/null
+++ b/haproxy/proxy/listen/oss/elasticsearch.yml
@@ -0,0 +1,38 @@
+parameters:
+  _param:
+    haproxy_elasticsearch_bind_host: ${_param:haproxy_bind_address}
+    haproxy_elasticsearch_bind_port: 9200
+    haproxy_elasticsearch_exposed_port: 19200
+    haproxy_elasticsearch_ssl:
+      enabled: false
+  haproxy:
+    proxy:
+      listen:
+        elasticsearch:
+          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_elasticsearch_bind_host}
+              port: ${_param:haproxy_elasticsearch_bind_port}
+              ssl: ${_param:haproxy_elasticsearch_ssl}
+          servers:
+            - name: ${_param:cluster_node01_name}
+              host: ${_param:cluster_node01_address}
+              port: ${_param:haproxy_elasticsearch_exposed_port}
+              params: check
+            - name: ${_param:cluster_node02_name}
+              host: ${_param:cluster_node02_address}
+              port: ${_param:haproxy_elasticsearch_exposed_port}
+              params: backup check
+            - name: ${_param:cluster_node03_name}
+              host: ${_param:cluster_node03_address}
+              port: ${_param:haproxy_elasticsearch_exposed_port}
+              params: backup check
diff --git a/haproxy/proxy/listen/oss/pushkin.yml b/haproxy/proxy/listen/oss/pushkin.yml
new file mode 100644
index 0000000..458a226
--- /dev/null
+++ b/haproxy/proxy/listen/oss/pushkin.yml
@@ -0,0 +1,37 @@
+parameters:
+  _param:
+    haproxy_pushkin_bind_host: ${_param:haproxy_bind_address}
+    haproxy_pushkin_bind_port: 8887
+    haproxy_pushkin_exposed_port: 18887
+    haproxy_pushkin_ssl:
+      enabled: false
+  haproxy:
+    proxy:
+      listen:
+        pushkin:
+          mode: http
+          options:
+          - httpchk get /apps
+          balance: source
+          http_request:
+            - action: "add-header X-Forwarded-Proto https"
+              condition: "if { ssl_fc }"
+          sticks:
+          - http-check expect ! rstatus ^5
+          binds:
+            - address: ${_param:haproxy_pushkin_bind_host}
+              port: ${_param:haproxy_pushkin_bind_port}
+              ssl: ${_param:haproxy_pushkin_ssl}
+          servers:
+            - name: ${_param:cluster_node01_name}
+              host: ${_param:cluster_node01_address}
+              port: ${_param:haproxy_pushkin_exposed_port}
+              params: check
+            - name: ${_param:cluster_node02_name}
+              host: ${_param:cluster_node02_address}
+              port: ${_param:haproxy_pushkin_exposed_port}
+              params: backup check
+            - name: ${_param:cluster_node03_name}
+              host: ${_param:cluster_node03_address}
+              port: ${_param:haproxy_pushkin_exposed_port}
+              params: backup check
diff --git a/haproxy/proxy/listen/oss/pushkin_db.yml b/haproxy/proxy/listen/oss/pushkin_db.yml
new file mode 100644
index 0000000..74b15a2
--- /dev/null
+++ b/haproxy/proxy/listen/oss/pushkin_db.yml
@@ -0,0 +1,32 @@
+parameters:
+  _param:
+    haproxy_pushkin_db_bind_host: ${_param:haproxy_bind_address}
+    haproxy_pushkin_db_bind_port: 5432
+    haproxy_pushkin_db_exposed_port: 15432
+    haproxy_pushkin_db_ssl:
+      enabled: false
+  haproxy:
+    proxy:
+      listen:
+        pushkin_db:
+          mode: tcp
+          balance: source
+          options:
+          - pgsql-check user ${_param:pushkin_db_user}
+          binds:
+            - address: ${_param:haproxy_pushkin_db_bind_host}
+              port: ${_param:haproxy_pushkin_db_bind_port}
+              ssl: ${_param:haproxy_pushkin_db_ssl}
+          servers:
+            - name: ${_param:cluster_node01_name}
+              host: ${_param:cluster_node01_address}
+              port: ${_param:haproxy_pushkin_db_exposed_port}
+              params: check
+            - name: ${_param:cluster_node02_name}
+              host: ${_param:cluster_node02_address}
+              port: ${_param:haproxy_pushkin_db_exposed_port}
+              params: backup check
+            - name: ${_param:cluster_node03_name}
+              host: ${_param:cluster_node03_address}
+              port: ${_param:haproxy_pushkin_db_exposed_port}
+              params: backup check