Unable to use external database. #650

Closed
opened 2024-05-03 12:38:42 +00:00 by M4urici0GM · 4 comments
M4urici0GM commented 2024-05-03 12:38:42 +00:00 (Migrated from gitea.com)

Hi, hope you guys are doing well
I might be a little dumb, i'm not being able to use a external database to deploy gitea instances,
i'm using the following config:

gitea:
  admin:
    # existingSecret: gitea-admin-secret
    existingSecret:
    username: gitea_admin
    password: <password>
    email: "gitea@local.domain"
  config:
    database:
      DB_TYPE: postgres
      HOST: postgres-internal.ops.svc.cluster.local:5432
      NAME: postgres
      USER: postgres
      PASSWD: <password>
      SSL_MODE: disable
...

Then i've disabled both postgres and postgres-ha:

...
postgresql:
  enabled: false

postgresql-ha:
  enabled: false 

But whever i deploy the helm, i always get CrashLoop errors with the following logs:

│ configure-gitea ==== BEGIN GITEA CONFIGURATION ====                                                                                                                     │
│ configure-gitea 2024/05/03 12:33:58 cmd/cmd.go:66:initDB() [F] Database settings are missing from the configuration file: "/data/gitea/conf/app.ini".                   │
│ configure-gitea Ensure you are running in the correct environment or set the correct configuration file with -c.                                                        │
│ configure-gitea If this is the intended configuration file complete the [database] section.                                                                             │
│ configure-gitea Gitea migrate might fail due to database connection...This init-container will try again in a few seconds                                               │
│ init-app-ini ...Initial secrets generated 

What am i doing wrong? :sad:

Hi, hope you guys are doing well I might be a little dumb, i'm not being able to use a external database to deploy gitea instances, i'm using the following config: ```yaml gitea: admin: # existingSecret: gitea-admin-secret existingSecret: username: gitea_admin password: <password> email: "gitea@local.domain" config: database: DB_TYPE: postgres HOST: postgres-internal.ops.svc.cluster.local:5432 NAME: postgres USER: postgres PASSWD: <password> SSL_MODE: disable ... ``` Then i've disabled both postgres and postgres-ha: ```yaml ... postgresql: enabled: false postgresql-ha: enabled: false ``` But whever i deploy the helm, i always get CrashLoop errors with the following logs: ``` │ configure-gitea ==== BEGIN GITEA CONFIGURATION ==== │ │ configure-gitea 2024/05/03 12:33:58 cmd/cmd.go:66:initDB() [F] Database settings are missing from the configuration file: "/data/gitea/conf/app.ini". │ │ configure-gitea Ensure you are running in the correct environment or set the correct configuration file with -c. │ │ configure-gitea If this is the intended configuration file complete the [database] section. │ │ configure-gitea Gitea migrate might fail due to database connection...This init-container will try again in a few seconds │ │ init-app-ini ...Initial secrets generated ``` What am i doing wrong? :sad:
justusbunsi commented 2024-05-03 16:23:39 +00:00 (Migrated from gitea.com)

Please share following additional information:

  • The logs from the init-app-ini initContainer
  • Which Gitea version do you use?
  • Which Helm Chart version do you use?
  • By any chance, do you have replicaCount > 1 in the omitted values? If possible, please share all your modified values (replace passwords and sensitive values!). That might help identifying the issue.

The Database settings are missing from the configuration file error seems to only occur when the DB_TYPE field is missing. Based on the values you provided, I ran a helm template to see if the database section is missing from the configuration secret. It exists and has the correct DB_TYPE value - which is a good sign.

Please share following additional information: - The logs from the `init-app-ini` initContainer - Which Gitea version do you use? - Which Helm Chart version do you use? - By any chance, do you have `replicaCount > 1` in the omitted values? If possible, please share all your modified values (replace passwords and sensitive values!). That might help identifying the issue. The `Database settings are missing from the configuration file` error seems to only occur when the `DB_TYPE` field is missing. Based on the values you provided, I ran a `helm template` to see if the database section is missing from the configuration secret. It exists and has the correct `DB_TYPE` value - which is a good sign.
M4urici0GM commented 2024-05-03 22:54:42 +00:00 (Migrated from gitea.com)

Sure, here is the logs from the init-app-ini

...Initial secrets generated

Processing inlines...
  repository
    + 'ROOT'
  cache
    + 'ADAPTER'
    + 'HOST'
  metrics
    + 'ENABLED'
  session
    + 'PROVIDER'
    + 'PROVIDER_CONFIG'
  server
    + 'APP_DATA_PATH'
    + 'DOMAIN'
    + 'ENABLE_PPROF'
    + 'HTTP_PORT'
    + 'PROTOCOL'
    + 'ROOT_URL'
    + 'SSH_DOMAIN'
    + 'SSH_LISTEN_PORT'
    + 'SSH_PORT'
    + 'START_SSH_SERVER'
  queue
    + 'CONN_STR'
    + 'TYPE'
  indexer
    + 'ISSUE_INDEXER_TYPE'
  security
    + 'INSTALL_LOCK'
  [ini root]
    + 'APP_NAME'


Reloading preset envs...
=== All configuration sources loaded ===

I'm pretty much using the default configuration,
I didn't set the image version, so i'm assuming it's using the latest version 🤔

global:
  imageRegistry: ""
  imagePullSecrets: []
  storageClass: ""
  hostAliases: []
replicaCount: 1
strategy:
  type: "RollingUpdate"
  rollingUpdate:
    maxSurge: "100%"
    maxUnavailable: 0
clusterDomain: cluster.local
image:
  registry: ""
  repository: gitea/gitea
  tag: ""
  digest: ""
  pullPolicy: IfNotPresent
  rootless: true
  fullOverride: ""

imagePullSecrets: []
podSecurityContext:
  fsGroup: 1000

containerSecurityContext: {}
securityContext: {}
podDisruptionBudget: {}

service:
  http:
    type: ClusterIP
    port: 3000
    clusterIP: None
    loadBalancerIP:
    nodePort:
    externalTrafficPolicy:
    externalIPs:
    ipFamilyPolicy:
    ipFamilies:
    loadBalancerSourceRanges: []
    annotations: {}
    labels: {}
  ssh:
    type: ClusterIP
    port: 22
    clusterIP: None
    loadBalancerIP:
    nodePort:
    externalTrafficPolicy:
    externalIPs:
    ipFamilyPolicy:
    ipFamilies:
    hostPort:
    loadBalancerSourceRanges: []
    annotations: {}
    labels: {}

ingress:
  enabled: true
  className: nginx
  annotations:
    nginx.ingress.kubernetes.io/proxy-body-size: 10m
  hosts:
    - host: <domain>
      paths:
        - path: /
          pathType: Prefix
  tls:
    - hosts: ["<domain>"]
    - secretName: <secret>
resources:
  {}

schedulerName: ""
nodeSelector: {}
tolerations: []
affinity: {}
topologySpreadConstraints: []
dnsConfig: {}
priorityClassName: ""
deployment:
  env:
    []
    # - name: VARIABLE
    #   value: my-value
  terminationGracePeriodSeconds: 60
  labels: {}
  annotations: {}

## @section ServiceAccount

serviceAccount:
  create: false
  name: ""
  automountServiceAccountToken: false
  imagePullSecrets: []
  # - name: private-registry-access
  annotations: {}
  labels: {}

persistence:
  enabled: true
  create: true
  mount: true
  claimName: gitea-storage
  size: 50Gi
  accessModes:
    - ReadWriteOnce
  labels: {}
  storageClass: oci-expandable
  subPath:
  volumeName: ""
  annotations:
    helm.sh/resource-policy: keep

extraVolumes: []
extraContainerVolumeMounts: []
extraInitVolumeMounts: []
extraVolumeMounts: []
initPreScript: ""
initContainers:
  resources:
    limits: {}
    requests:
      cpu: 100m
      memory: 128Mi

signing:
  enabled: false
  gpgHome: /data/git/.gnupg
  privateKey: ""
  # privateKey: |-
  #   -----BEGIN PGP PRIVATE KEY BLOCK-----
  #   ...
  #   -----END PGP PRIVATE KEY BLOCK-----
  existingSecret: ""

postgresql:
  enabled: false
postgresql-ha:
  enabled: false 

gitea:
  admin:
    username: gitea_admin
    password: <pass>
    email: "gitea@local.domain"
  config:
    database:
      DB_TYPE: postgres
      HOST: postgres-internal.ops.svc.cluster.local:5432
      NAME: postgres
      USER: postgres
      PASSWD: <pass>
      SSL_MODE: disable 

  metrics:
    enabled: false
    serviceMonitor:
      enabled: false

  ldap:
    []

  oauth:
    []

  config:
    # APP_NAME: ""
    #  RUN_MODE: dev
    server:
      SSH_PORT: 22 # rootful image
      SSH_LISTEN_PORT: 2222 # rootless image

  additionalConfigSources: []
  additionalConfigFromEnvs: []
  podAnnotations: {}
  ssh:
    logLevel: "INFO"

  livenessProbe:
    enabled: true
    tcpSocket:
      port: http
    initialDelaySeconds: 200
    timeoutSeconds: 1
    periodSeconds: 10
    successThreshold: 1
    failureThreshold: 10

  readinessProbe:
    enabled: true
    tcpSocket:
      port: http
    initialDelaySeconds: 5
    timeoutSeconds: 1
    periodSeconds: 10
    successThreshold: 1
    failureThreshold: 3

  startupProbe:
    enabled: false
    tcpSocket:
      port: http
    initialDelaySeconds: 60
    timeoutSeconds: 1
    periodSeconds: 10
    successThreshold: 1
    failureThreshold: 10

checkDeprecation: true
test:
  enabled: true
  image:
    name: busybox
    tag: latest

extraDeploy: []


Sure, here is the logs from the init-app-ini ``` ...Initial secrets generated Processing inlines... repository + 'ROOT' cache + 'ADAPTER' + 'HOST' metrics + 'ENABLED' session + 'PROVIDER' + 'PROVIDER_CONFIG' server + 'APP_DATA_PATH' + 'DOMAIN' + 'ENABLE_PPROF' + 'HTTP_PORT' + 'PROTOCOL' + 'ROOT_URL' + 'SSH_DOMAIN' + 'SSH_LISTEN_PORT' + 'SSH_PORT' + 'START_SSH_SERVER' queue + 'CONN_STR' + 'TYPE' indexer + 'ISSUE_INDEXER_TYPE' security + 'INSTALL_LOCK' [ini root] + 'APP_NAME' Reloading preset envs... === All configuration sources loaded === ``` I'm pretty much using the default configuration, I didn't set the image version, so i'm assuming it's using the latest version 🤔 ```yaml global: imageRegistry: "" imagePullSecrets: [] storageClass: "" hostAliases: [] replicaCount: 1 strategy: type: "RollingUpdate" rollingUpdate: maxSurge: "100%" maxUnavailable: 0 clusterDomain: cluster.local image: registry: "" repository: gitea/gitea tag: "" digest: "" pullPolicy: IfNotPresent rootless: true fullOverride: "" imagePullSecrets: [] podSecurityContext: fsGroup: 1000 containerSecurityContext: {} securityContext: {} podDisruptionBudget: {} service: http: type: ClusterIP port: 3000 clusterIP: None loadBalancerIP: nodePort: externalTrafficPolicy: externalIPs: ipFamilyPolicy: ipFamilies: loadBalancerSourceRanges: [] annotations: {} labels: {} ssh: type: ClusterIP port: 22 clusterIP: None loadBalancerIP: nodePort: externalTrafficPolicy: externalIPs: ipFamilyPolicy: ipFamilies: hostPort: loadBalancerSourceRanges: [] annotations: {} labels: {} ingress: enabled: true className: nginx annotations: nginx.ingress.kubernetes.io/proxy-body-size: 10m hosts: - host: <domain> paths: - path: / pathType: Prefix tls: - hosts: ["<domain>"] - secretName: <secret> resources: {} schedulerName: "" nodeSelector: {} tolerations: [] affinity: {} topologySpreadConstraints: [] dnsConfig: {} priorityClassName: "" deployment: env: [] # - name: VARIABLE # value: my-value terminationGracePeriodSeconds: 60 labels: {} annotations: {} ## @section ServiceAccount serviceAccount: create: false name: "" automountServiceAccountToken: false imagePullSecrets: [] # - name: private-registry-access annotations: {} labels: {} persistence: enabled: true create: true mount: true claimName: gitea-storage size: 50Gi accessModes: - ReadWriteOnce labels: {} storageClass: oci-expandable subPath: volumeName: "" annotations: helm.sh/resource-policy: keep extraVolumes: [] extraContainerVolumeMounts: [] extraInitVolumeMounts: [] extraVolumeMounts: [] initPreScript: "" initContainers: resources: limits: {} requests: cpu: 100m memory: 128Mi signing: enabled: false gpgHome: /data/git/.gnupg privateKey: "" # privateKey: |- # -----BEGIN PGP PRIVATE KEY BLOCK----- # ... # -----END PGP PRIVATE KEY BLOCK----- existingSecret: "" postgresql: enabled: false postgresql-ha: enabled: false gitea: admin: username: gitea_admin password: <pass> email: "gitea@local.domain" config: database: DB_TYPE: postgres HOST: postgres-internal.ops.svc.cluster.local:5432 NAME: postgres USER: postgres PASSWD: <pass> SSL_MODE: disable metrics: enabled: false serviceMonitor: enabled: false ldap: [] oauth: [] config: # APP_NAME: "" # RUN_MODE: dev server: SSH_PORT: 22 # rootful image SSH_LISTEN_PORT: 2222 # rootless image additionalConfigSources: [] additionalConfigFromEnvs: [] podAnnotations: {} ssh: logLevel: "INFO" livenessProbe: enabled: true tcpSocket: port: http initialDelaySeconds: 200 timeoutSeconds: 1 periodSeconds: 10 successThreshold: 1 failureThreshold: 10 readinessProbe: enabled: true tcpSocket: port: http initialDelaySeconds: 5 timeoutSeconds: 1 periodSeconds: 10 successThreshold: 1 failureThreshold: 3 startupProbe: enabled: false tcpSocket: port: http initialDelaySeconds: 60 timeoutSeconds: 1 periodSeconds: 10 successThreshold: 1 failureThreshold: 10 checkDeprecation: true test: enabled: true image: name: busybox tag: latest extraDeploy: []
justusbunsi commented 2024-05-03 23:18:37 +00:00 (Migrated from gitea.com)

Your values contains 2 gitea.config objects. The second one (chart defaults) overrides yours with the database.

Your values contains 2 `gitea.config` objects. The second one (chart defaults) overrides yours with the database.
M4urici0GM commented 2024-05-04 00:52:13 +00:00 (Migrated from gitea.com)

That was it
It's so hard to be dumb

Thanks bud xD

That was it It's so hard to be dumb ![](https://media1.tenor.com/m/EAfL55rrL_AAAAAC/aaa.gif) Thanks bud xD
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: lunny/helm-chart#650
No description provided.