diff --git a/.gitignore b/.gitignore
index 5f5ac902c5..9e15d9491d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -59,6 +59,7 @@ spar.integration-aws.yaml
integration-aws.yaml
DOCKER_ID*
swagger-ui
+!charts/nginz/static/swagger-ui
deploy/services-demo/resources/templates/*
deploy/services-demo/conf/nginz/zwagger-ui/*
diff --git a/changelog.d/2-features/nginz-swagger-ui b/changelog.d/2-features/nginz-swagger-ui
new file mode 100644
index 0000000000..9a713df14e
--- /dev/null
+++ b/changelog.d/2-features/nginz-swagger-ui
@@ -0,0 +1 @@
+charts/nginz: Serve swagger-ui for viewing swagger-1.2 docs
\ No newline at end of file
diff --git a/charts/nginz/conf/static/zauth.acl b/charts/nginz/static/conf/zauth.acl
similarity index 100%
rename from charts/nginz/conf/static/zauth.acl
rename to charts/nginz/static/conf/zauth.acl
diff --git a/charts/nginz/static/swagger-ui/index.html b/charts/nginz/static/swagger-ui/index.html
new file mode 100644
index 0000000000..3524029f07
--- /dev/null
+++ b/charts/nginz/static/swagger-ui/index.html
@@ -0,0 +1,77 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/charts/nginz/static/swagger-ui/tab.html b/charts/nginz/static/swagger-ui/tab.html
new file mode 100644
index 0000000000..0798782592
--- /dev/null
+++ b/charts/nginz/static/swagger-ui/tab.html
@@ -0,0 +1,221 @@
+
+
+
+
+
+
+ Swagger UI
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/charts/nginz/templates/conf/_nginx.conf.tpl b/charts/nginz/templates/conf/_nginx.conf.tpl
index 02c422b727..dc93efa895 100644
--- a/charts/nginz/templates/conf/_nginx.conf.tpl
+++ b/charts/nginz/templates/conf/_nginx.conf.tpl
@@ -352,6 +352,7 @@ http {
#
location /api-docs {
+ zauth off;
default_type application/json;
root {{ $.Values.nginx_conf.swagger_root }};
index resources.json;
diff --git a/charts/nginz/templates/conf/_zwagger-config.js.tpl b/charts/nginz/templates/conf/_zwagger-config.js.tpl
deleted file mode 100644
index ded11c8c5d..0000000000
--- a/charts/nginz/templates/conf/_zwagger-config.js.tpl
+++ /dev/null
@@ -1,3 +0,0 @@
-{{ define "nginz_zwagger-config.js" }}
-var environment = '{{ .Values.nginx_conf.env }}';
-{{- end }}
diff --git a/charts/nginz/templates/configmap.yaml b/charts/nginz/templates/configmap.yaml
index cb57148817..0ddba4536b 100644
--- a/charts/nginz/templates/configmap.yaml
+++ b/charts/nginz/templates/configmap.yaml
@@ -4,13 +4,11 @@ data:
{{- include "nginz_nginx.conf" . | indent 4 }}
upstreams.txt: |2
{{- include "nginz_upstreams.txt" . | indent 4 }}
- zwagger-config.js: |2
-{{- include "nginz_zwagger-config.js" . | indent 4 }}
deeplink.json: |2
{{- include "nginz_deeplink.json" . | indent 4 }}
deeplink.html: |2
{{- include "nginz_deeplink.html" . | indent 4 }}
-{{ (.Files.Glob "conf/static/*").AsConfig | indent 2 }}
+{{ (.Files.Glob "static/conf/*").AsConfig | indent 2 }}
kind: ConfigMap
metadata:
creationTimestamp: null
diff --git a/charts/nginz/templates/deployment.yaml b/charts/nginz/templates/deployment.yaml
index 3abda67744..2454ea147c 100644
--- a/charts/nginz/templates/deployment.yaml
+++ b/charts/nginz/templates/deployment.yaml
@@ -25,6 +25,8 @@ spec:
annotations:
# An annotation of the configmap checksum ensures changes to the configmap cause a redeployment upon `helm upgrade`
checksum/configmap: {{ include (print .Template.BasePath "/configmap.yaml") . | sha256sum }}
+ checksum/swagger-ui-configmap: {{ include (print .Template.BasePath "/swagger-ui-configmap.yaml") . | sha256sum }}
+ checksum/swagger-resources-configmap: {{ include (print .Template.BasePath "/swagger-resources-configmap.yaml") . | sha256sum }}
checksum/secret: {{ include (print .Template.BasePath "/secret.yaml") . | sha256sum }}
fluentbit.io/parser-nginz: nginz
spec:
@@ -51,6 +53,11 @@ spec:
- name: upstreams
mountPath: /etc/wire/nginz/upstreams
readOnly: true
+ - name: swagger-ui
+ mountPath: /opt/zwagger-ui
+ readOnly: true
+ - name: swagger-resources
+ mountPath: {{ .Values.nginx_conf.swagger_root }}/api-docs
ports:
- name: http
containerPort: {{ .Values.config.http.httpPort }}
@@ -81,3 +88,9 @@ spec:
secretName: nginz
- name: upstreams
emptyDir: {}
+ - name: swagger-ui
+ configMap:
+ name: nginz-swagger-ui
+ - name: swagger-resources
+ configMap:
+ name: nginz-swagger-resources
diff --git a/charts/nginz/templates/swagger-resources-configmap.yaml b/charts/nginz/templates/swagger-resources-configmap.yaml
new file mode 100644
index 0000000000..a6b53022f6
--- /dev/null
+++ b/charts/nginz/templates/swagger-resources-configmap.yaml
@@ -0,0 +1,27 @@
+# Swagger-1.0 JSON to combine swagger-1.0 documents from different services
+apiVersion: v1
+data:
+ resources.json: |2
+ {
+ "apiVersion": "1.0",
+ "swaggerVersion": "1.2",
+ "apis": [
+ {
+ "path": "/users",
+ "description": "Users, Connections and Onboarding"
+ },
+ {
+ "path": "/push",
+ "description": "Push Notifications"
+ },
+ {
+ "path": "/conversations",
+ "description": "Conversations and Messaging"
+ }
+ ]
+ }
+
+kind: ConfigMap
+metadata:
+ name: nginz-swagger-resources
+
diff --git a/charts/nginz/templates/swagger-ui-configmap.yaml b/charts/nginz/templates/swagger-ui-configmap.yaml
new file mode 100644
index 0000000000..0ec5e5edc1
--- /dev/null
+++ b/charts/nginz/templates/swagger-ui-configmap.yaml
@@ -0,0 +1,6 @@
+apiVersion: v1
+data:
+{{ (.Files.Glob "static/swagger-ui/*").AsConfig | indent 2 }}
+kind: ConfigMap
+metadata:
+ name: nginz-swagger-ui
diff --git a/charts/nginz/values.yaml b/charts/nginz/values.yaml
index 981bfdbb23..e8aad9c07c 100644
--- a/charts/nginz/values.yaml
+++ b/charts/nginz/values.yaml
@@ -123,6 +123,10 @@ nginx_conf:
- all
disable_zauth: true
unlimited_requests_endpoint: true
+ - path: /users/api-docs$
+ envs:
+ - staging
+ disable_zauth: true
- path: /users
envs:
- all
@@ -357,6 +361,10 @@ nginx_conf:
disable_zauth: true
envs:
- all
+ - path: /conversations/api-docs$
+ envs:
+ - staging
+ disable_zauth: true
- path: /conversations/([^/]*)/otr/messages
envs:
- all
@@ -463,6 +471,10 @@ nginx_conf:
envs:
- all
gundeck:
+ - path: /push/api-docs$
+ envs:
+ - staging
+ disable_zauth: true
- path: /push
envs:
- all