-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
112 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
fW3MgE9f_hLd6_4rHGrDorLqVJ2tkXZjItJIfEGPZBg | ||
fW3MgE9f_hLd6_4rHGrDorLqVJ2tkXZjItJIfEGPZBg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: Role | ||
metadata: | ||
name: {{ .Release.Name }}-pre-install | ||
annotations: | ||
helm.sh/hook: pre-install | ||
helm.sh/hook-weight: "-2" | ||
rules: | ||
- apiGroups: [""] | ||
resources: ["secrets"] | ||
verbs: ["create"] | ||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ .Release.Name }}-pre-install | ||
annotations: | ||
helm.sh/hook: pre-install | ||
helm.sh/hook-weight: "-2" | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: RoleBinding | ||
metadata: | ||
name: {{ .Release.Name }}-pre-install | ||
annotations: | ||
helm.sh/hook: pre-install | ||
helm.sh/hook-weight: "-1" | ||
subjects: | ||
- kind: ServiceAccount | ||
namespace: {{ .Release.Namespace }} | ||
name: {{ .Release.Name }}-pre-install | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: Role | ||
name: {{ .Release.Name }}-pre-install | ||
--- | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: {{ .Release.Name }}-generate-cookie-secret | ||
labels: | ||
app.kubernetes.io/managed-by: {{ .Release.Service | quote }} | ||
app.kubernetes.io/instance: {{ .Release.Name | quote }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion }} | ||
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" | ||
annotations: | ||
helm.sh/hook: pre-install | ||
helm.sh/hook-weight: "1" | ||
spec: | ||
template: | ||
metadata: | ||
name: "{{ .Release.Name }}" | ||
labels: | ||
app.kubernetes.io/managed-by: {{ .Release.Service | quote }} | ||
app.kubernetes.io/instance: {{ .Release.Name | quote }} | ||
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" | ||
spec: | ||
serviceAccountName: {{ .Release.Name }}-pre-install | ||
restartPolicy: Never | ||
containers: | ||
- name: generate-secret | ||
image: ghcr.io/ontopic-vkg/ontopic-helm/identity-service:helm-{{ .Chart.AppVersion }} | ||
command: ["/usr/bin/entrypoint", "generate", "cookie"] | ||
args: [ ">", "/mnt/secret/cookie-secret && cat /mnt/secret/cookie-secret" ] | ||
volumeMounts: | ||
- name: secret | ||
mountPath: /mnt/secret | ||
- name: create-secret | ||
image: bitnami/kubectl:latest | ||
command: ["sh", "-c", "while [ ! -f /mnt/data/output.txt ]; do sleep 1; done; cat /mnt/secret/cookie-secret && kubectl create secret generic cookie-secret --from-file=password=/mnt/secret/cookie-secret"] | ||
volumeMounts: | ||
- name: secret | ||
mountPath: /mnt/secret | ||
restartPolicy: Never | ||
volumes: | ||
- name: secret | ||
emptyDir: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,3 @@ | ||
-- create database gitea; | ||
-- create user gitea with encrypted password 'Phei8Vai'; | ||
-- grant all privileges on database gitea to gitea; | ||
-- alter database gitea OWNER TO gitea; | ||
--- | ||
create database internal; | ||
grant all privileges on database internal to postgres; | ||
alter database internal OWNER TO postgres; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Deploy a PostgreSQL database | ||
============================ | ||
|
||
Here is the command to deploy a PostgreSQL database using the [Bitnami Helm Chart](https://artifacthub.io/packages/helm/bitnami/postgresql). | ||
|
||
```sh | ||
helm repo add bitnami https://charts.bitnami.com/bitnami | ||
helm install store-server-db bitnami/postgresql --wait | ||
``` | ||
|
||
Wait for the DB to be ready. | ||
|
||
Create the database and users | ||
----------------------------- | ||
|
||
```bash | ||
kubectl exec -i store-server-db-postgresql-0 -- /opt/bitnami/scripts/postgresql/entrypoint.sh /bin/bash -c 'PGPASSWORD=$POSTGRES_PASSWORD psql' < create-db-and-users.sql | ||
``` | ||
|
||
Create the database secret file | ||
------------------------------- | ||
|
||
```bash | ||
# Create the new secret | ||
kubectl create secret generic database-password-file \ | ||
--from-literal=database-password-file="$(kubectl get secret store-server-db-postgresql -o jsonpath="{.data.postgres-password}" | base64 -d)" | ||
``` |
File renamed without changes.