Make the chart work with a sqlite3 database #124

Merged
luhahn merged 1 commits from Nakrez/helm-chart:master into master 2021-03-04 08:43:53 +00:00
Contributor

There are currently 2 issues that prevent using this chart to deploy gitea with a SQLite3 database.

  1. The value from gitea.config.database.HOST is used to set db.servicename when all the databases under gitea.database.buildIn are not enabled. This causes a type error during the template processing:
    Error: UPGRADE FAILED: template: gitea/templates/gitea/init.yaml:24:20: executing "gitea/templates/gitea/init.yaml" at <include "db.servicename" .>: error calling include: template: gitea/templates/_helpers.tpl:64:31: executing "db.servicename" at <.Values.gitea.config.database.HOST>: wrong type for value; expected string; got interface {}

  2. In init_gitea.sh, we use the value db.servicename and db.port to ping the database. If this database responds to ping, we proceed with the init. The problem here is that db.port is not set when all the databases under gitea.database.buildIn are disabled. In turn, this raises an error from busybox's nc, because no parameter is passed for PORT. This causes the init container to go in CrashLoopBackOff forever.

The simple fix that is proposed in this PR is to check wether or not .Values.gitea.config.database.DB_TYPE is set to determine the value db.servicename. If DB_TYPE is 'sqlite3', leave db.servicename empty and use that to bypass the database ping.

There are currently 2 issues that prevent using this chart to deploy gitea with a SQLite3 database. 1) The value from *gitea.config.database.HOST* is used to set *db.servicename* when all the databases under *gitea.database.buildIn* are not enabled. This causes a type error during the template processing: `Error: UPGRADE FAILED: template: gitea/templates/gitea/init.yaml:24:20: executing "gitea/templates/gitea/init.yaml" at <include "db.servicename" .>: error calling include: template: gitea/templates/_helpers.tpl:64:31: executing "db.servicename" at <.Values.gitea.config.database.HOST>: wrong type for value; expected string; got interface {}` 2) In *init_gitea.sh*, we use the value *db.servicename* and *db.port* to ping the database. If this database responds to ping, we proceed with the init. The problem here is that *db.port* is not set when all the databases under *gitea.database.buildIn* are disabled. In turn, this raises an error from busybox's *nc*, because no parameter is passed for *PORT*. This causes the init container to go in *CrashLoopBackOff* forever. The simple fix that is proposed in this PR is to check wether or not *.Values.gitea.config.database.DB_TYPE* is set to determine the value *db.servicename*. If *DB_TYPE* is *'sqlite3'*, leave *db.servicename* empty and use that to bypass the database ping.
Nakrez force-pushed master from 16eac8ac7b to 5958b55d35 2021-03-02 06:03:56 +00:00 Compare
Nakrez force-pushed master from 5958b55d35 to 81a919abb4 2021-03-02 17:38:38 +00:00 Compare
zeripath approved these changes 2021-03-02 19:08:36 +00:00
Dismissed
lafriks approved these changes 2021-03-03 11:03:32 +00:00
Dismissed
luhahn approved these changes 2021-03-04 08:43:46 +00:00
Dismissed
luhahn merged commit 1eb0eee3bc into master 2021-03-04 08:43:53 +00:00
Sign in to join this conversation.
No description provided.