From 03fb95557b97814220cb2e5c5ba0f69d80e0f53c Mon Sep 17 00:00:00 2001 From: Robert Zondervan Date: Thu, 5 Dec 2019 11:06:22 +0100 Subject: [PATCH 1/6] Set component.domain instead of component.environment.domain when in prod --- api/helm/templates/ingress.yaml | 45 ++++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/api/helm/templates/ingress.yaml b/api/helm/templates/ingress.yaml index 1c549535..9c651cc4 100644 --- a/api/helm/templates/ingress.yaml +++ b/api/helm/templates/ingress.yaml @@ -24,12 +24,44 @@ spec: {{- end }} {{- end }} rules: - - #host: {{ .Values.settings.name }}.{{ .Values.settings.env }}.{{ .Values.settings.domain }} - http: - paths: - - backend: - serviceName: {{ include "name" . }} - servicePort: 80 +# - host: {{ .Values.settings.name }}.{{ .Values.settings.env }}.{{ .Values.settings.domain }} +# http: +# paths: +# - backend: +# serviceName: {{ include "name" . }} +# servicePort: 80 + {{- if .Values.settings.env == 'prod' -}} + - host: {{ .Values.settings.name }}.{{ .Values.settings.domain }} + http: + paths: + - backend: + serviceName: {{ include "name" . }} + servicePort: 80 + - host: {{ .Values.settings.name }}.huwelijksplanner.online + http: + paths: + - backend: + serviceName: {{ include "name" . }} + servicePort: 80 + - host: {{ .Values.settings.name }}.trouwplanner.online + http: + paths: + - backend: + serviceName: {{ include "name" . }} + servicePort: 80 + - host: {{ .Values.settings.name }}.common-ground.nl + http: + paths: + - backend: + serviceName: {{ include "name" . }} + servicePort: 80 + - host: {{ .Values.settings.name }}.larping.eu + http: + paths: + - backend: + serviceName: {{ include "name" . }} + servicePort: 80 + {{- else -}} - host: {{ .Values.settings.name }}.{{ .Values.settings.env }}.{{ .Values.settings.domain }} http: paths: @@ -60,3 +92,4 @@ spec: - backend: serviceName: {{ include "name" . }} servicePort: 80 + {{- end }} From 366c4fe9131704ae4ef56f1adc1ba30c027b1b67 Mon Sep 17 00:00:00 2001 From: Ruben van der Linde Date: Thu, 5 Dec 2019 11:37:15 +0100 Subject: [PATCH 2/6] If then fix for ingress on prod env --- INSTALLATION.md | 12 ++++++------ api/helm/templates/ingress.yaml | 18 +++++++++++++++--- api/helm/values.yaml | 7 +++++++ 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/INSTALLATION.md b/INSTALLATION.md index 96ea76d5..2e8410d6 100644 --- a/INSTALLATION.md +++ b/INSTALLATION.md @@ -72,16 +72,16 @@ $ helm dependency update ./api/helm ``` If you want to create a new instance ```CLI -$ helm install --name pc-dev ./api/helm --kubeconfig="api/helm/kubeconfig.yaml" --namespace=dev --set settings.env=dev,settings.debug=1,settings.loadbalancerEnabled=true -$ helm install --name pc-stag ./api/helm --kubeconfig="api/helm/kubeconfig.yaml" --namespace=stag --set settings.env=stag,settings.debug=0,settings.loadbalancerEnabled=true -$ helm install --name pc-prod ./api/helm --kubeconfig="api/helm/kubeconfig.yaml" --namespace=prod --set settings.env=prod,settings.debug=0,settings.loadbalancerEnabled=true +$ helm install --name pc-dev ./api/helm --kubeconfig="api/helm/kubeconfig.yaml" --namespace=dev --set settings.env=dev,settings.debug=1 +$ helm install --name pc-stag ./api/helm --kubeconfig="api/helm/kubeconfig.yaml" --namespace=stag --set settings.env=stag,settings.debug=0 +$ helm install --name pc-prod ./api/helm --kubeconfig="api/helm/kubeconfig.yaml" --namespace=prod --set settings.env=prod,settings.debug=0 ``` Or update if you want to update an existing one ```CLI -$ helm upgrade pc-dev ./api/helm --kubeconfig="api/helm/kubeconfig.yaml" --namespace=dev --set settings.env=dev,settings.debug=1,settings.loadbalancerEnabled=true -$ helm upgrade pc-stag ./api/helm --kubeconfig="api/helm/kubeconfig.yaml" --namespace=stag --set settings.env=stag,settings.debug=0,settings.loadbalancerEnabled=true -$ helm upgrade pc-prod ./api/helm --kubeconfig="api/helm/kubeconfig.yaml" --namespace=prod --set settings.env=prod,settings.debug=0,settings.loadbalancerEnabled=true +$ helm upgrade pc-dev ./api/helm --kubeconfig="api/helm/kubeconfig.yaml" --namespace=dev --set settings.env=dev,settings.debug=1 +$ helm upgrade pc-stag ./api/helm --kubeconfig="api/helm/kubeconfig.yaml" --namespace=stag --set settings.env=stag,settings.debug=0 +$ helm upgrade pc-prod ./api/helm --kubeconfig="api/helm/kubeconfig.yaml" --namespace=prod --set settings.env=prod,settings.debug=0 ``` Or del if you want to delete an existing one diff --git a/api/helm/templates/ingress.yaml b/api/helm/templates/ingress.yaml index 9c651cc4..ad27ed07 100644 --- a/api/helm/templates/ingress.yaml +++ b/api/helm/templates/ingress.yaml @@ -30,7 +30,7 @@ spec: # - backend: # serviceName: {{ include "name" . }} # servicePort: 80 - {{- if .Values.settings.env == 'prod' -}} + {{- if eq .Values.settings.env "prod" }} - host: {{ .Values.settings.name }}.{{ .Values.settings.domain }} http: paths: @@ -60,8 +60,14 @@ spec: paths: - backend: serviceName: {{ include "name" . }} - servicePort: 80 - {{- else -}} + servicePort: 80 + - host: {{ .Values.settings.name }}.zaakonline.eu + http: + paths: + - backend: + serviceName: {{ include "name" . }} + servicePort: 80 + {{- else }} - host: {{ .Values.settings.name }}.{{ .Values.settings.env }}.{{ .Values.settings.domain }} http: paths: @@ -92,4 +98,10 @@ spec: - backend: serviceName: {{ include "name" . }} servicePort: 80 + - host: {{ .Values.settings.name }}.{{ .Values.settings.env }}.zaakonline.nl + http: + paths: + - backend: + serviceName: {{ include "name" . }} + servicePort: 80 {{- end }} diff --git a/api/helm/values.yaml b/api/helm/values.yaml index 3f474c4a..11e81898 100644 --- a/api/helm/values.yaml +++ b/api/helm/values.yaml @@ -12,6 +12,13 @@ settings: repro: https://github.com/ConductionNL/Proto-component-commonground' demo: pc.zaakonline.nl domain: conduction.nl + domains: + - conduction.nl + - larping.eu + - zaakonline.nl + - huwelijksplanner.online + - trouwplanner.online + - common-ground.dev env: dev debug: 1 replicaCount: 1 From b02a0104d8aaae1404c02940563c58032c9e33fe Mon Sep 17 00:00:00 2001 From: Ruben van der Linde Date: Thu, 5 Dec 2019 11:58:27 +0100 Subject: [PATCH 3/6] Fix in yaml template --- api/helm/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/helm/values.yaml b/api/helm/values.yaml index 11e81898..3aab74a4 100644 --- a/api/helm/values.yaml +++ b/api/helm/values.yaml @@ -9,7 +9,7 @@ settings: title: Proto Component version: V.0.1 description: ''Naast deze JSON rest API is er ook een [graphql](/graphql) interface beschikbaar.'' - repro: https://github.com/ConductionNL/Proto-component-commonground' + repro: 'https://github.com/ConductionNL/Proto-component-commonground' demo: pc.zaakonline.nl domain: conduction.nl domains: From 705da9c0d3b1b90faef9d3176837e16135edbec1 Mon Sep 17 00:00:00 2001 From: Ruben van der Linde Date: Thu, 5 Dec 2019 13:11:01 +0100 Subject: [PATCH 4/6] Update Values.yaml.twig --- api/templates/helm/Values.yaml.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/templates/helm/Values.yaml.twig b/api/templates/helm/Values.yaml.twig index 8b6ef17f..26d3ab44 100644 --- a/api/templates/helm/Values.yaml.twig +++ b/api/templates/helm/Values.yaml.twig @@ -9,7 +9,7 @@ settings: title: {{ app_title }} version: {{ app_version }} description: '{{ app_description }}' - repro: {{ app_repro }}' + repro: '{{ app_repro }}' domain: {{ app_domain }} demo: {{ app_demo }} env: {{ app_env }} From d2b9965e79789fd7dd518ccddd12c1594ebb2d41 Mon Sep 17 00:00:00 2001 From: Robert Zondervan Date: Thu, 5 Dec 2019 13:34:37 +0100 Subject: [PATCH 5/6] Trying to fix weird errors --- api/templates/helm/Values.yaml.twig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/api/templates/helm/Values.yaml.twig b/api/templates/helm/Values.yaml.twig index 26d3ab44..28b8fe07 100644 --- a/api/templates/helm/Values.yaml.twig +++ b/api/templates/helm/Values.yaml.twig @@ -16,24 +16,24 @@ settings: debug: {{ app_debug }} replicaCount: 1 corsAllowOrigin: ['*'] - trustedHosts: {{ trusted_hosts }} + trustedHosts: '^(.+\.)?conduction\.nl$|^(.+\.)?huwelijksplanner\.online$|^(.+\.)?larping\.eu$|^(.+\.)?common-ground\.nl$|^(.+\.)?trouwplanner\.online$|^(.+\.)?zaakonline\.nl$|localhost' pullPolicy: Always # You will need these proxies on kubernetes trustedProxies: - 10.0.0.0/8 - 172.16.0.0/12 - 192.168.0.0/16 - # If you are runnig a single component on a kubernetes cluster you can just easaliy enable the load balancer, if not you need to set up a multi component load balancer + # If you are runnig a single component on a kubernetes cluster you can just easaliy enable the load balancer, if not you need to set up a multi component load balancer loadbalancerEnabled: false # If you want to enable NLX you are requered to add the appropreate certificates to you nlx-settings folder (located in the /api folder) nlxInwayEnabled: {{ nlx_inway }} - # If you are runnig a single component on a kubernetes cluster you can just easaliy enable the load balancer, if not you need to set up a multi component load balancer + # If you are runnig a single component on a kubernetes cluster you can just easaliy enable the load balancer, if not you need to set up a multi component load balancer notificationEnabled: false audittrailEnabled: false authorisationEnabled: false healthEnabled: false archiveEnabled: false - + php: repository: docker.io/conduction/protocomponent-php From c74e1e4780be16fcd98c0dd987a781f67c6e7dca Mon Sep 17 00:00:00 2001 From: Robert Zondervan Date: Thu, 5 Dec 2019 14:59:29 +0100 Subject: [PATCH 6/6] Fix a bug with env vs values --- .env | 16 ++++---- api/helm/values.yaml | 22 +++++------ api/public/schema/openapi.yaml | 57 +++++++++++++++++++++++++++-- api/templates/helm/Values.yaml.twig | 2 +- 4 files changed, 74 insertions(+), 23 deletions(-) diff --git a/.env b/.env index 483e5053..4bfa0eec 100644 --- a/.env +++ b/.env @@ -1,6 +1,6 @@ ################################################## -# -# General settings for your component +# +# General settings for your component # ################################################## @@ -18,14 +18,14 @@ APP_VERSION=V.0.1 APP_DEBUG=1 # What is the enviroment type you want to use for local production? (choose between dec,stag,prod, acce or test) APP_ENV=dev -# We use a build to tag images, this is swithced to the version on master and to env on other branches +# We use a build to tag images, this is swithced to the version on master and to env on other branches APP_BUILD=dev # The description for this api APP_DESCRIPTION='Naast deze JSON rest API is er ook een [graphql](/graphql) interface beschikbaar.' # The urls on wich this api is available TRUSTED_PROXIES=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16 -TRUSTED_HOSTS='^(.+\.)?conduction\.nl$|^(.+\.)?huwelijksplanner\.online$|^(.+\.)?larping\.eu$|^(.+\.)?common-ground\.nl$|^(.+\.)?trouwplanner\.online$|^(.+\.)?zaakonline\.nl$|localhost' +TRUSTED_HOSTS=^(.+\.)?conduction\.nl$|^(.+\.)?huwelijksplanner\.online$|^(.+\.)?larping\.eu$|^(.+\.)?common-ground\.nl$|^(.+\.)?trouwplanner\.online$|^(.+\.)?zaakonline\.nl$|localhost ################################################## # Documentation settings @@ -78,17 +78,17 @@ HEALTH_ENABLED=false ARCHIVE_ENABLED=false ################################################## -# NLX Setup, read more at https://docs.nlx.io/get-started/# +# NLX Setup, read more at https://docs.nlx.io/get-started/# ################################################## # Do you want to provide an nlx outway? (option for your component to reach nlx services) -NLX_OUTWAY=true +NLX_OUTWAY=true # Do you want to provice an nlx inway (option for nlx services to reach your api) -NLX_INWAY=false +NLX_INWAY=false # NLX Certification Details -NLX_COUNTRY_NAME=Netherlands +NLX_COUNTRY_NAME=Netherlands NLX_STATE=Noord-Holland NLX_LOCALITY=Amsterdam NLX_ORGANIZATION_NAME=Conduction diff --git a/api/helm/values.yaml b/api/helm/values.yaml index 3aab74a4..7f4d3075 100644 --- a/api/helm/values.yaml +++ b/api/helm/values.yaml @@ -10,15 +10,8 @@ settings: version: V.0.1 description: ''Naast deze JSON rest API is er ook een [graphql](/graphql) interface beschikbaar.'' repro: 'https://github.com/ConductionNL/Proto-component-commonground' - demo: pc.zaakonline.nl domain: conduction.nl - domains: - - conduction.nl - - larping.eu - - zaakonline.nl - - huwelijksplanner.online - - trouwplanner.online - - common-ground.dev + demo: pc.zaakonline.nl env: dev debug: 1 replicaCount: 1 @@ -30,17 +23,17 @@ settings: - 10.0.0.0/8 - 172.16.0.0/12 - 192.168.0.0/16 - # If you are runnig a single component on a kubernetes cluster you can just easaliy enable the load balancer, if not you need to set up a multi component load balancer + # If you are runnig a single component on a kubernetes cluster you can just easaliy enable the load balancer, if not you need to set up a multi component load balancer loadbalancerEnabled: false # If you want to enable NLX you are requered to add the appropreate certificates to you nlx-settings folder (located in the /api folder) nlxInwayEnabled: false - # If you are runnig a single component on a kubernetes cluster you can just easaliy enable the load balancer, if not you need to set up a multi component load balancer + # If you are runnig a single component on a kubernetes cluster you can just easaliy enable the load balancer, if not you need to set up a multi component load balancer notificationEnabled: false audittrailEnabled: false authorisationEnabled: false healthEnabled: false archiveEnabled: false - + php: repository: docker.io/conduction/protocomponent-php @@ -102,6 +95,13 @@ ingress: # - hosts: # - example.com # - mercure.example.com + hosts: + api: + host: example.com + serviceName: varnish + mercure: + host: mercure.example.com + serviceName: mercure resources: {} # We usually recommend not to specify default resources and to leave this as a conscious diff --git a/api/public/schema/openapi.yaml b/api/public/schema/openapi.yaml index d3c1e631..3cd704c7 100644 --- a/api/public/schema/openapi.yaml +++ b/api/public/schema/openapi.yaml @@ -524,7 +524,7 @@ components: schemas: ExampleEntity-read: type: object - description: 'This is an example entity' + description: 'This is an example entity.' properties: id: readOnly: true @@ -535,11 +535,14 @@ components: description: description: 'The description of this example property' type: string + camelCase: + description: 'Proof that we camel case our api' + type: string required: - name ExampleEntity-write: type: object - description: 'This is an example entity' + description: 'This is an example entity.' required: - name properties: @@ -549,13 +552,61 @@ components: description: description: 'The description of this example property' type: string + camelCase: + description: 'Proof that we camel case our api' + type: string +definitions: + ExampleEntity-read: + properties: + id: + example: e2984465-190a-4562-829e-a8cca81aa35d + format: uuid + name: + example: 'My Group' + maxLength: 255 + description: + example: 'Is the best group ever' + maxLength: 2555 + camelCase: + example: 'Best api ever' + maxLength: 255 + required: + - name + ExampleEntity-write: + properties: + name: + example: 'My Group' + maxLength: 255 + description: + example: 'Is the best group ever' + maxLength: 2555 + camelCase: + example: 'Best api ever' + maxLength: 255 + required: + - name tags: - name: ExampleEntity description: | - This is an example entity + This is an example entity. With an adtional description, all in all its pritty nice [url](www.google.nl) +securityDefinitions: + JWT-Oauth: + type: oauth2 + authorizationUrl: 'http://petstore.swagger.io/api/oauth/dialog' + flow: implicit + scopes: + read: 'read right to the ExampleEntity resource' + write: 'write right to the ExampleEntity resource' + JWT-Token: + type: apiKey + in: header + name: Authorization + scopes: + read: 'read right to the ExampleEntity resource' + write: 'write right to the ExampleEntity resource' host: irc.zaakonline.nl servers: - diff --git a/api/templates/helm/Values.yaml.twig b/api/templates/helm/Values.yaml.twig index 28b8fe07..8a8e6ae7 100644 --- a/api/templates/helm/Values.yaml.twig +++ b/api/templates/helm/Values.yaml.twig @@ -16,7 +16,7 @@ settings: debug: {{ app_debug }} replicaCount: 1 corsAllowOrigin: ['*'] - trustedHosts: '^(.+\.)?conduction\.nl$|^(.+\.)?huwelijksplanner\.online$|^(.+\.)?larping\.eu$|^(.+\.)?common-ground\.nl$|^(.+\.)?trouwplanner\.online$|^(.+\.)?zaakonline\.nl$|localhost' + trustedHosts: '{{ trusted_hosts }}' pullPolicy: Always # You will need these proxies on kubernetes trustedProxies: