lrsql
lrsql copied to clipboard
Issue on deploying through helm
Hello, we are trying to deploy lrsql in our K8 thorugh helm, but we run into issues when trying to use postgres: here the env vars:
- name: LRSQL_DB_TYPE
value: "postgres"
- name: LRSQL_DB_HOST
value: lrs.db.stage.***.com
- name: LRSQL_DB_NAME
value: lrs
- name: LRSQL_DB_PORT
value: "5432"
- name: LRSQL_DB_USER
value: ********
- name: LRSQL_POOL_INITIALIZATION_FAIL_TIMEOUT
value: "10000"
- name: LRSQL_DB_PASSWORD
value: *******
and here the log we receive on the pod (partially truncated). Could you please support in identifying the issue? Consider the db is obviously outside the cluster but still reachable by the pod We tried several routes, removing brackets, nothing worked. Using sqlite works like a charm. Thanks. Marco
at clojure.lang.AFn.applyToHelper(AFn.java:152) │
│ at clojure.lang.RestFn.applyTo(RestFn.java:132) │
│ at lrsql.sqlite.main.main(Unknown Source) │
│ Exception in thread "main" clojure.lang.ExceptionInfo: Error in component :connection in system com.stuartsierra.component.SystemMap calling #'com.stuartsierra.component/start {:reason :com.stuartsierra.component/component-function-threw-exception, :function #'com.stuartsierra.component/start, :system- │
│ at com.stuartsierra.component$try_action.invokeStatic(component.cljc:120) │
│ at com.stuartsierra.component$try_action.invoke(component.cljc:117) │
│ at com.stuartsierra.component$update_system$fn__15095.invoke(component.cljc:140) │
│ at clojure.lang.ArraySeq.reduce(ArraySeq.java:119) │
│ at clojure.core$reduce.invokeStatic(core.clj:6885) │
│ at clojure.core$reduce.invoke(core.clj:6868) │
│ at com.stuartsierra.component$update_system.invokeStatic(component.cljc:136) │
│ at com.stuartsierra.component$update_system.doInvoke(component.cljc:130) │
│ at clojure.lang.RestFn.invoke(RestFn.java:445) │
│ at com.stuartsierra.component$start_system.invokeStatic(component.cljc:164) │
│ at com.stuartsierra.component$start_system.invoke(component.cljc:156) │
│ at com.stuartsierra.component$start_system.invokeStatic(component.cljc:162) │
│ at com.stuartsierra.component$start_system.invoke(component.cljc:156) │
│ at com.stuartsierra.component.SystemMap.start(component.cljc:179) │
│ at lrsql.sqlite.main$_main.invokeStatic(main.clj:30) │
│ at lrsql.sqlite.main$_main.doInvoke(main.clj:22) │
│ at clojure.lang.RestFn.invoke(RestFn.java:397) │
│ at clojure.lang.AFn.applyToHelper(AFn.java:152) │
│ at clojure.lang.RestFn.applyTo(RestFn.java:132) │
│ at lrsql.sqlite.main.main(Unknown Source) │
│ Caused by: com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: ERROR: syntax error at or near "PRAGMA" │
│ Position: 1 │
│ at com.zaxxer.hikari.pool.HikariPool.throwPoolInitializationException(HikariPool.java:596) │
│ at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:575) │
│ at com.zaxxer.hikari.pool.HikariPool.
Hello @monkyver, can you show us how you are starting up the application, e.g. what shell commands you are using? It appears from your log that you are starting up SQL LRS in SQLite mode, but then overriding LRSQL_DB_TYPE
to be postgres
, which will cause a mismatch between the expected and actual SQL flavor the application expects.
Hello @kelvinqian00 , this is the full deploy for the lrsql part
lrsService: repository: "yetanalytics/lrsql" tag: "latest" pullPolicy: IfNotPresent replicaCount: 1 env: - name: LRSQL_API_KEY_DEFAULT value: my_default_key - name: LRSQL_API_SECRET_DEFAULT value: my_default__secret - name: LRSQL_ADMIN_USER_DEFAULT value: my_username - name: LRSQL_ADMIN_PASS_DEFAULT value: my_password - name: LRSQL_ALLOW_ALL_ORIGINS value: "true" - name: LRSQL_AUTHORITY_URL value: https://... - name: LRSQL_ENABLE_ADMIN_DELETE_ACTOR value: "true" - name: LRSQL_LOG_LEVEL value: INFO - name: LRSQL_DB_TYPE value: "postgres" - name: LRSQL_DB_HOST value: ....*** - name: LRSQL_DB_NAME value: lrs - name: LRSQL_DB_PORT value: "5432" - name: LRSQL_DB_USER value: *** - name: LRSQL_POOL_INITIALIZATION_FAIL_TIMEOUT value: "10000" - name: LRSQL_DB_PASSWORD value: ***
We run the deployment through a kubectl script like
helm upgrade vrstage vr-app/ -f vr-app/values-stage.yaml -n vrstage
No shell commands are launched after. If I remove the postres part it works smoothly, only postgres is giving me issue. Is it possible that having initially deployed with sqlite and after with postres something got wrong (even though I also tried to completely delete the pod?)
So your latest post confirms my suspicions: you are running the SQLite version of the app, even though you are intending to use the Postgres version. The SQLite version is the default version of SQL LRS, which is why you are continuing to get this error even after deleting and recreating everything. Changing LRSQL_DB_TYPE
alone will not change the version of SQL LRS you are using (in fact it is not intended to be changed in the first place).
What you will need to do is to apply /lrsql/bin/run_postgres.sh
as a custom command in order to run the Postgres version. I'm not familiar with Kubernetes/Helm so I can't tell you the exact syntax in your case, but it should be similar to what we do in our sample docker-compose.yml
file.