I am trying to create a CI/CD pipleline (with azure devops), I have a problem with using the DbMigrator project in that pipeline, I do not want to use abp credentials on the pipeline (to install abp and login with my account, and I have accounts) What are the alternative of creating the database and applying the migrations and seeding the default data.
I read the topic (https://docs.abp.io/en/abp/4.4/Data-Seeding) but I need an alternative way in production environment. (for example is there is a way that I reference the dbMigrator in the host to seed the data on startup)
1 Answer(s)
-
0
You don't need to use abp login command in pipeline, just copy
NuGet.Config
that containsABP_COMMERCIAL_NUGET_SOURCE
.About using DbMigrator in pipeline; I do not know your deployment environment but If you are using kubernes, you can use
Job
.For DbMigrator helm template, you can use something similar to:
apiVersion: batch/v1 kind: Job metadata: name: {{ .Release.Name }}-{{ .Chart.Name }} spec: activeDeadlineSeconds: 180 template: spec: containers: - image: {{ .Values.image.repository }}:{{ .Values.image.tag }} imagePullPolicy: {{ .Values.image.pullPolicy }} name: {{ .Release.Name }}-{{ .Chart.Name }} env: - name: "ConnectionStrings__Default" value: {{ .Values.config.connectionStrings.default }} - name: "DOTNET_ENVIRONMENT" value: "{{ .Values.config.dotnetEnv }}" {{- if .Values.env }} {{ toYaml .Values.env | indent 8 }} {{- end }} restartPolicy: Never backoffLimit: 10
Eventually, DbMigrator should be run as a console application.