diff --git a/services/cert-manager/01-cluster-issuer.yaml b/services/cert-manager/01-cluster-issuer.yaml index a7a2605..254fd36 100644 --- a/services/cert-manager/01-cluster-issuer.yaml +++ b/services/cert-manager/01-cluster-issuer.yaml @@ -72,3 +72,34 @@ spec: apiTokenSecretRef: name: cloudflare-api-token-secret key: api-token +--- +apiVersion: cert-manager.io/v1 +kind: ClusterIssuer +metadata: + name: letsencrypt-teup +spec: + acme: + email: ni@aefeup.pt + privateKeySecretRef: + name: letsencrypt-teup + server: https://acme-v02.api.letsencrypt.org/directory + solvers: + - selector: + dnsZones: + - teup.pt + dns01: + cnameStrategy: Follow + cloudflare: + email: ni@aefeup.pt + apiTokenSecretRef: + name: cloudflare-api-token-secret + key: api-token + - selector: + dnsZones: + - niaefeup.pt + dns01: + cloudflare: + email: ni@aefeup.pt + apiTokenSecretRef: + name: cloudflare-api-token-secret + key: api-token diff --git a/services/cluster-secret/01-harbor-pull-secret.yaml b/services/cluster-secret/01-harbor-pull-secret.yaml index 5b2e3ad..da1ffe0 100644 --- a/services/cluster-secret/01-harbor-pull-secret.yaml +++ b/services/cluster-secret/01-harbor-pull-secret.yaml @@ -13,7 +13,10 @@ matchNamespace: - sinf-website - tts - tts-staging + - website-ae - inicio - inicio-staging + - niddle-staging + - teup-website data: .dockerconfigjson: diff --git a/services/databases/postgresql/cnpg-cluster.yaml b/services/databases/postgresql/cnpg-cluster.yaml index 642db1f..ae59025 100644 --- a/services/databases/postgresql/cnpg-cluster.yaml +++ b/services/databases/postgresql/cnpg-cluster.yaml @@ -45,6 +45,12 @@ spec: login: true passwordSecret: name: website-ae-secret + - name: teup + ensure: present + createdb: false + login: true + passwordSecret: + name: teup-secret - name: inicio ensure: present createdb: false @@ -59,7 +65,7 @@ spec: name: inicio-staging-secret storage: - size: 20Gi + size: 40Gi #backups are handled by cloudnative postgres storageClass: longhorn-strict-local-no-backup diff --git a/services/databases/postgresql/cnpg-secrets.yaml b/services/databases/postgresql/cnpg-secrets.yaml index d018304..0458bc5 100644 --- a/services/databases/postgresql/cnpg-secrets.yaml +++ b/services/databases/postgresql/cnpg-secrets.yaml @@ -49,6 +49,16 @@ metadata: type: kubernetes.io/basic-auth --- apiVersion: v1 +stringData: + password: + username: teup +kind: Secret +metadata: + name: teup-secret + namespace: pg +type: kubernetes.io/basic-auth +--- +apiVersion: v1 stringData: password: username: website-ae diff --git a/services/teup/website/00-namespace.yaml b/services/teup/website/00-namespace.yaml new file mode 100644 index 0000000..62b1b5d --- /dev/null +++ b/services/teup/website/00-namespace.yaml @@ -0,0 +1,5 @@ +--- +apiVersion: v1 +kind: Namespace +metadata: + name: teup-website diff --git a/services/teup/website/01-volume-claims.yaml b/services/teup/website/01-volume-claims.yaml new file mode 100644 index 0000000..a9ac72b --- /dev/null +++ b/services/teup/website/01-volume-claims.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: teup-images-pvc + namespace: teup-website +spec: + storageClassName: longhorn-locality-no-backup-retain + resources: + requests: + storage: 5Gi + accessModes: + - ReadWriteOnce \ No newline at end of file diff --git a/services/teup/website/02-secrets.yaml b/services/teup/website/02-secrets.yaml new file mode 100644 index 0000000..834bb7b --- /dev/null +++ b/services/teup/website/02-secrets.yaml @@ -0,0 +1,9 @@ +--- +apiVersion: v1 +kind: Secret +metadata: + name: teup-website-env + namespace: teup-website +type: Opaque +stringData: + env: diff --git a/services/teup/website/03-deployment.yaml b/services/teup/website/03-deployment.yaml new file mode 100644 index 0000000..e288032 --- /dev/null +++ b/services/teup/website/03-deployment.yaml @@ -0,0 +1,71 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: teup-website + namespace: teup-website + annotations: + keel.sh/policy: "force" + keel.sh/match-tag: "true" +spec: + selector: + matchLabels: + app: teup-website + strategy: + type: Recreate + template: + metadata: + labels: + app: teup-website + spec: + containers: + - name: teup-website-frontend + image: registry.niaefeup.pt/teup/website-frontend:main + resources: + limits: + memory: "256Mi" + cpu: "500m" + ports: + - containerPort: 80 + imagePullPolicy: Always + volumeMounts: + - name: teup-images + mountPath: /usr/share/nginx/html/imagens + - name: teup-website-api + image: registry.niaefeup.pt/teup/website-api:master + resources: + limits: + memory: "256Mi" + cpu: "500m" + ports: + - containerPort: 8000 + imagePullPolicy: Always + volumeMounts: + - name: teup-images + mountPath: /app/images + - name: teup-env + mountPath: /app/.env + subPath: env + readOnly: true + volumes: + - name: teup-images + persistentVolumeClaim: + claimName: teup-images-pvc + - name: teup-env + secret: + secretName: teup-website-env + imagePullSecrets: + - name: harbor-pull-secret +--- +apiVersion: v1 +kind: Service +metadata: + name: teup-website-service + namespace: teup-website +spec: + selector: + app: teup-website + ports: + - port: 80 + targetPort: 80 + type: "ClusterIP" diff --git a/services/teup/website/04-certificates.yaml b/services/teup/website/04-certificates.yaml new file mode 100644 index 0000000..6a9f887 --- /dev/null +++ b/services/teup/website/04-certificates.yaml @@ -0,0 +1,15 @@ +apiVersion: cert-manager.io/v1 +kind: Certificate +metadata: + name: teup-website-cert + namespace: teup-website +spec: + secretName: teup-website-cert + issuerRef: + name: letsencrypt-teup + kind: ClusterIssuer + commonName: teup.pt + dnsNames: + - teup.pt + - www.teup.pt + - teup.niaefeup.pt diff --git a/services/teup/website/05-ingress-routes.yaml b/services/teup/website/05-ingress-routes.yaml new file mode 100644 index 0000000..b1cd22c --- /dev/null +++ b/services/teup/website/05-ingress-routes.yaml @@ -0,0 +1,16 @@ +apiVersion: traefik.io/v1alpha1 +kind: IngressRoute +metadata: + name: teup-website-https + namespace: teup-website +spec: + entryPoints: + - websecure + routes: + - match: Host(`teup.pt`) || Host(`www.teup.pt`) || Host(`teup.niaefeup.pt`) + kind: Rule + services: + - name: teup-website-service + port: 80 + tls: + secretName: teup-website-cert