diff --git a/.gitignore b/.gitignore index 4bfb418e..7c1f3a7e 100755 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,15 @@ pytest.ini /media/ /opal/env.* + **/__pycache__/ -/build/yaml/secrets/omb_secrets.yaml -/build/yaml/secrets/dan_secrets.yaml + +/build/env_settings/* +/build/opal/omb_values.yaml +/build/opal/values.yaml +/build/helm_output.yaml +/build/opal.yaml +/build/opal-0.2.1.tgz +/build/opal-0.2.2.tgz +/build/opal-0.2.3.tgz +/build/opal-0.2.4.tgz diff --git a/build/build.sh b/build/build.sh index 270ac76e..3fa5872e 100755 --- a/build/build.sh +++ b/build/build.sh @@ -8,6 +8,7 @@ docker push 192.168.42.100:5050/opal-webapp docker build -t 192.168.42.100:5050/opal-db -f Dockerfile_db . docker push 192.168.42.100:5050/opal-db -kubectl apply -f yaml/app/ -kubectl apply -f yaml/db/ -kubectl apply -f yaml/nginx/ \ No newline at end of file +helm package ./opal/ --app-version $(cat ../version.txt) + +#helm install opal opal-$(cat opal/Chart.yaml| grep version: | cut -d' ' -f2).tgz --atomic --create-namespace --debug +helm template opal opal-$(cat opal/Chart.yaml| grep version: | cut -d' ' -f2).tgz > helm_output.yaml diff --git a/build/helm-chart/values.yaml b/build/helm-chart/values.yaml deleted file mode 100644 index 8705bef2..00000000 --- a/build/helm-chart/values.yaml +++ /dev/null @@ -1,16 +0,0 @@ -namespace: opal -env: dev -hostname: opal.domain.com -tls_secret: '**secret name for yout TLS certificate**' -version: 2.0.5 -repo: - webapp: 192.168.42.100:5050/opal-webapp:latest - db: 192.168.42.100:5050/opal-db:latest - nginx: nginx:1.25 -secret: - postgres_opal_password: use_a_secure_password - postgres_password: use_a_secure_password -proxy: - use_proxy: "True" - http_proxy: "proxy.domain.com:8888" - https_proxy: "proxy.domain.com:8888" diff --git a/build/helm-chart/yaml/secrets/opal_secrets.yaml b/build/helm-chart/yaml/secrets/opal_secrets.yaml deleted file mode 100644 index 45bf18d9..00000000 --- a/build/helm-chart/yaml/secrets/opal_secrets.yaml +++ /dev/null @@ -1,21 +0,0 @@ -apiVersion: v1 -kind: Secret -metadata: - name: opal-passwords - namespace: {{ .Values.namespace | quote }} -type: Opaque -data: - POSTGRES_PASSWORD: ROOT_DB_PASSWORD - POSTGRES_OPAL_PASSWORD: OPAL_USER_DB_PASSWORD ---- -apiVersion: v1 -kind: Secret -metadata: - name: tls-cert - namespace: {{ .Values.namespace | quote }} -type: kubernetes.io/tls -data: - tls.crt: TLS_CERT - tls.key: TLS_PRIVATE_KEY ---- - diff --git a/build/helm-chart/Chart.yaml b/build/opal/Chart.yaml similarity index 98% rename from build/helm-chart/Chart.yaml rename to build/opal/Chart.yaml index 8ec6b52b..8b1a7a8b 100644 --- a/build/helm-chart/Chart.yaml +++ b/build/opal/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.2.0 +version: 0.2.4 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/build/helm-chart/yaml/app/opal-webapp-config-map.yaml b/build/opal/omb_values.yaml similarity index 59% rename from build/helm-chart/yaml/app/opal-webapp-config-map.yaml rename to build/opal/omb_values.yaml index d24724df..206034ff 100644 --- a/build/helm-chart/yaml/app/opal-webapp-config-map.yaml +++ b/build/opal/omb_values.yaml @@ -1,7 +1,8 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: opal-webapp-config +namespace: opal +repo: + webapp: 192.168.42.100:5050/opal-webapp:latest + db: 192.168.42.100:5050/opal-db:latest + nginx: nginx:1.25 data: ENVIRONMENT: prod DEBUG: "False" @@ -24,3 +25,10 @@ data: DB_NAME: opal LOG_FILE: /usr/src/logs/debug.log ENABLE_DJANGO_AUTH: "False" +secret: + db: + POSTGRES_PASSWORD: Uk9PVF9EQl9QQVNTV09SRAo= #ROOT_DB_PASSWORD + POSTGRES_OPAL_PASSWORD: Uk9PVF9EQl9QQVNTV09SRAo= #OPAL_USER_DB_PASSWORD + #tls: + # tls.crt: TLS_CERT + # tls.key: TLS_PRIVATE_KEY \ No newline at end of file diff --git a/build/helm-chart/yaml/app/opal-webapp-service.yaml b/build/opal/templates/app-opal-service.yaml similarity index 83% rename from build/helm-chart/yaml/app/opal-webapp-service.yaml rename to build/opal/templates/app-opal-service.yaml index 3c1d46a9..15532bc7 100644 --- a/build/helm-chart/yaml/app/opal-webapp-service.yaml +++ b/build/opal/templates/app-opal-service.yaml @@ -2,7 +2,6 @@ apiVersion: v1 kind: Service metadata: name: opal-webapp-service - namespace: {{ .Values.namespace | quote }} spec: ports: - name: http diff --git a/build/helm-chart/yaml/app/opal-webapp.yaml b/build/opal/templates/app-opal.yaml similarity index 80% rename from build/helm-chart/yaml/app/opal-webapp.yaml rename to build/opal/templates/app-opal.yaml index af03e235..a2e4c11b 100644 --- a/build/helm-chart/yaml/app/opal-webapp.yaml +++ b/build/opal/templates/app-opal.yaml @@ -2,7 +2,6 @@ apiVersion: apps/v1 kind: Deployment metadata: name: opal-webapp - namespace: {{ .Values.namespace | quote }} labels: app: opal-webapp spec: @@ -23,13 +22,6 @@ spec: restartPolicy: Always imagePullSecrets: - name: harbor - affinity: - nodeAffinity: - requiredDuringSchedulingIgnoredDuringExecution: - nodeSelectorTerms: - - matchExpressions: - - key: node-role.kubernetes.io/control-plane - operator: DoesNotExist containers: - name: opal-webapp image: {{ .Values.repo.webapp }} @@ -54,7 +46,7 @@ spec: name: staticfiles envFrom: - configMapRef: - name: opal-webapp-config + name: opal-config env: - name: DB_PASSWORD valueFrom: diff --git a/build/helm-chart/yaml/app/pv-app.yaml b/build/opal/templates/app-pv.yaml similarity index 100% rename from build/helm-chart/yaml/app/pv-app.yaml rename to build/opal/templates/app-pv.yaml diff --git a/build/helm-chart/yaml/app/pvc-app.yaml b/build/opal/templates/app-pvc.yaml similarity index 82% rename from build/helm-chart/yaml/app/pvc-app.yaml rename to build/opal/templates/app-pvc.yaml index 9c845e26..6da4437d 100644 --- a/build/helm-chart/yaml/app/pvc-app.yaml +++ b/build/opal/templates/app-pvc.yaml @@ -2,7 +2,6 @@ apiVersion: v1 kind: PersistentVolumeClaim metadata: name: staticfiles-pvc - namespace: {{ .Values.namespace | quote }} spec: storageClassName: manual accessModes: diff --git a/build/helm-chart/yaml/db/opal-db-service.yaml b/build/opal/templates/db-opal-service.yaml similarity index 84% rename from build/helm-chart/yaml/db/opal-db-service.yaml rename to build/opal/templates/db-opal-service.yaml index d1b40402..b4b13b0f 100644 --- a/build/helm-chart/yaml/db/opal-db-service.yaml +++ b/build/opal/templates/db-opal-service.yaml @@ -2,7 +2,6 @@ apiVersion: v1 kind: Service metadata: name: opal-postgres-db - namespace: {{ .Values.namespace | quote }} spec: ports: - name: postgres diff --git a/build/helm-chart/yaml/db/opal-db.yaml b/build/opal/templates/db-opal.yaml similarity index 83% rename from build/helm-chart/yaml/db/opal-db.yaml rename to build/opal/templates/db-opal.yaml index be1d25da..c1740745 100644 --- a/build/helm-chart/yaml/db/opal-db.yaml +++ b/build/opal/templates/db-opal.yaml @@ -2,7 +2,6 @@ apiVersion: apps/v1 kind: Deployment metadata: name: opal-postgres-db - namespace: {{ .Values.namespace | quote }} labels: app: opal-postgres-db spec: @@ -23,13 +22,6 @@ spec: restartPolicy: Always imagePullSecrets: - name: harbor - affinity: - nodeAffinity: - requiredDuringSchedulingIgnoredDuringExecution: - nodeSelectorTerms: - - matchExpressions: - - key: node-role.kubernetes.io/control-plane - operator: DoesNotExist containers: - name: opal-postgres-db image: {{ .Values.repo.db }} diff --git a/build/helm-chart/yaml/db/pv-db.yaml b/build/opal/templates/db-pv.yaml similarity index 100% rename from build/helm-chart/yaml/db/pv-db.yaml rename to build/opal/templates/db-pv.yaml diff --git a/build/helm-chart/yaml/db/pvc-db.yaml b/build/opal/templates/db-pvc.yaml similarity index 82% rename from build/helm-chart/yaml/db/pvc-db.yaml rename to build/opal/templates/db-pvc.yaml index 2bd0bf7e..03094614 100644 --- a/build/helm-chart/yaml/db/pvc-db.yaml +++ b/build/opal/templates/db-pvc.yaml @@ -2,7 +2,6 @@ apiVersion: v1 kind: PersistentVolumeClaim metadata: name: postgres-pvc - namespace: {{ .Values.namespace | quote }} spec: storageClassName: manual accessModes: diff --git a/build/helm-chart/yaml/nginx/nginx-cm.yaml b/build/opal/templates/nginx-cm.yaml similarity index 90% rename from build/helm-chart/yaml/nginx/nginx-cm.yaml rename to build/opal/templates/nginx-cm.yaml index 16e14e19..8da89c1a 100644 --- a/build/helm-chart/yaml/nginx/nginx-cm.yaml +++ b/build/opal/templates/nginx-cm.yaml @@ -2,7 +2,6 @@ apiVersion: v1 kind: ConfigMap metadata: name: nginx-cm - namespace: {{ .Values.namespace | quote }} data: default.conf: | server { diff --git a/build/helm-chart/yaml/nginx/nginx-staticfiles-service.yaml b/build/opal/templates/nginx-staticfiles-service.yaml similarity index 82% rename from build/helm-chart/yaml/nginx/nginx-staticfiles-service.yaml rename to build/opal/templates/nginx-staticfiles-service.yaml index c95bcab6..b102c2a5 100644 --- a/build/helm-chart/yaml/nginx/nginx-staticfiles-service.yaml +++ b/build/opal/templates/nginx-staticfiles-service.yaml @@ -2,7 +2,6 @@ apiVersion: v1 kind: Service metadata: name: nginx-service - namespace: {{ .Values.namespace | quote }} spec: ports: - name: http diff --git a/build/helm-chart/yaml/nginx/nginx-staticfiles.yaml b/build/opal/templates/nginx-staticfiles.yaml similarity index 81% rename from build/helm-chart/yaml/nginx/nginx-staticfiles.yaml rename to build/opal/templates/nginx-staticfiles.yaml index 961abf8c..1913aa96 100644 --- a/build/helm-chart/yaml/nginx/nginx-staticfiles.yaml +++ b/build/opal/templates/nginx-staticfiles.yaml @@ -2,7 +2,6 @@ apiVersion: apps/v1 kind: Deployment metadata: name: nginx-static - namespace: {{ .Values.namespace | quote }} labels: app: nginx-static spec: @@ -26,13 +25,6 @@ spec: restartPolicy: Always imagePullSecrets: - name: harbor - affinity: - nodeAffinity: - requiredDuringSchedulingIgnoredDuringExecution: - nodeSelectorTerms: - - matchExpressions: - - key: node-role.kubernetes.io/control-plane - operator: DoesNotExist containers: - name: nginx-static image: {{ .Values.repo.nginx }} diff --git a/build/opal/templates/opal-cm.yaml b/build/opal/templates/opal-cm.yaml new file mode 100644 index 00000000..c9b26a7e --- /dev/null +++ b/build/opal/templates/opal-cm.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: opal-config +data: + {{- range $key, $value := .Values.data }} + {{ $key }}: {{ $value | quote }} + {{- end }} diff --git a/build/helm-chart/yaml/opal-ingress.yaml b/build/opal/templates/opal-ingress.yaml similarity index 100% rename from build/helm-chart/yaml/opal-ingress.yaml rename to build/opal/templates/opal-ingress.yaml diff --git a/build/opal/templates/opal_secrets.yaml b/build/opal/templates/opal_secrets.yaml new file mode 100644 index 00000000..ef8bedc0 --- /dev/null +++ b/build/opal/templates/opal_secrets.yaml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: Secret +metadata: + name: opal-passwords + namespace: {{ .Values.namespace | quote }} +type: Opaque +data: + POSTGRES_PASSWORD: Uk9PVF9EQl9QQVNTV09SRAo= #ROOT_DB_PASSWORD + POSTGRES_OPAL_PASSWORD: Uk9PVF9EQl9QQVNTV09SRAo= #OPAL_USER_DB_PASSWORD +--- +#apiVersion: v1 +#kind: Secret +#metadata: +# name: tls-cert +# namespace: {{ .Values.namespace | quote }} +#type: kubernetes.io/tls +#data: +# tls.crt: TLS_CERT +# tls.key: TLS_PRIVATE_KEY +#--- + diff --git a/playbook.yml b/playbook.yml index 6b4257c2..10731331 100644 --- a/playbook.yml +++ b/playbook.yml @@ -68,7 +68,7 @@ - name: chmod startup script file: path: /usr/src/app/startup.sh - mode: '0550' + mode: '0555' owner: opal_deploy group: opal