-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adding migration dockerfile * Improving migration dockerfile * Using env in migration * Adding migration template * Fixing migration template * Adding migration image script * Updating helm hook * Fixing mingration version * Fixing service image script builder Co-authored-by: Horusec <horusec@zup.com.br>
- Loading branch information
1 parent
0d61c17
commit c4a75e1
Showing
7 changed files
with
141 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
alpha: 0 | ||
beta: 0 | ||
rc: 0 | ||
release: v0.0.1 |
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,8 @@ | ||
FROM migrate/migrate:v4.13.0 | ||
|
||
ADD development-kit/pkg/databases/relational/migration /horusec-migrations | ||
ADD deployments/dockerfiles/migration/migrate.sh /usr/local/bin | ||
|
||
RUN chmod +x /usr/local/bin/migrate.sh | ||
|
||
ENTRYPOINT [ "migrate.sh" ] |
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,2 @@ | ||
#!/bin/sh | ||
migrate -path "/horusec-migrations" -database "$HORUSEC_DATABASE_SQL_URI" up "$@" |
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
39 changes: 39 additions & 0 deletions
39
horusec-account/deployments/helm/horusec-account/templates/databasemigration.yaml
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,39 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: "{{ .Release.Name }}" | ||
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,pre-upgrade | ||
"helm.sh/hook-weight": "-5" | ||
"helm.sh/hook-delete-policy": hook-succeeded,hook-failed | ||
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: | ||
restartPolicy: Never | ||
containers: | ||
- name: horusec-database-migration | ||
image: "horuszup/horusec-migration" | ||
command: ["migrate.sh"] | ||
env: | ||
{{- range .Values.env }} | ||
- name: {{ .name }} | ||
value: "{{ .value }}" | ||
{{- end }} | ||
{{- range .Values.envFromSecret }} | ||
- name: {{ .name }} | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ .key }} | ||
key: {{ .key }} | ||
{{- end }} |
39 changes: 39 additions & 0 deletions
39
horusec-analytic/deployments/helm/horusec-analytic/templates/databasemigration.yaml
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,39 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: "{{ .Release.Name }}" | ||
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,pre-upgrade | ||
"helm.sh/hook-weight": "-5" | ||
"helm.sh/hook-delete-policy": hook-succeeded | ||
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: | ||
restartPolicy: Never | ||
containers: | ||
- name: horusec-database-migration | ||
image: "horuszup/horusec-migration" | ||
command: ["migrate.sh"] | ||
env: | ||
{{- range .Values.env }} | ||
- name: {{ .name }} | ||
value: "{{ .value }}" | ||
{{- end }} | ||
{{- range .Values.envFromSecret }} | ||
- name: {{ .name }} | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ .key }} | ||
key: {{ .key }} | ||
{{- end }} |
39 changes: 39 additions & 0 deletions
39
horusec-api/deployments/helm/horusec-api/templates/databasemigration.yaml
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,39 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: "{{ .Release.Name }}" | ||
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,pre-upgrade | ||
"helm.sh/hook-weight": "-5" | ||
"helm.sh/hook-delete-policy": hook-succeeded | ||
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: | ||
restartPolicy: Never | ||
containers: | ||
- name: horusec-database-migration | ||
image: "horuszup/horusec-migration" | ||
command: ["migrate.sh"] | ||
env: | ||
{{- range .Values.env }} | ||
- name: {{ .name }} | ||
value: "{{ .value }}" | ||
{{- end }} | ||
{{- range .Values.envFromSecret }} | ||
- name: {{ .name }} | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ .key }} | ||
key: {{ .key }} | ||
{{- end }} |