Open Closed

DevOps with Abp #2214


User avatar
0
MILLENNIUM created

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)
  • User Avatar
    0
    gterdem created
    Senior .NET Developer

    You don't need to use abp login command in pipeline, just copy NuGet.Config that contains ABP_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.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 12, 2024, 07:15