Unable to install Grafana helm chart, facing issue 'no ssl' - postgresql

I am trying to install the Grafana helm chart, with the Postgres database, I have created a database as "grafrana_db" with user "grafana_user" but the migration is failing and the following is the error log
logger=migrator t=2022-08-04T14:25:31.683779065Z level=error msg="alert migration failure: could not get migration log" error="failed to check table existence: pq: no pg_hba.conf entry for host \"10.244.3.26\", user \"grafana_user\", database \"grafana_db\", SSL off"
Kubernetes version
WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short. Use --output=yaml|json to get the full version.
Client Version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.24.3", GitCommit:"aef86a93758dc3cb2c658dd9657ab4ad4afc21cb", GitTreeState:"clean", BuildDate:"2022-07-13T14:30:46Z", GoVersion:"go1.18.3", Compiler:"gc", Platform:"linux/amd64"}
Kustomize Version: v4.5.4
Server Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.11", GitCommit:"6b66c9a34569cd5a6e330eda21d1d8bd792e164e", GitTreeState:"clean", BuildDate:"2022-06-21T17:14:21Z", GoVersion:"go1.16.15", Compiler:"gc", Platform:"linux/amd64"}
WARNING: version difference between client (1.24) and server (1.22) exceeds the supported minor version skew of +/-1
Grafana Chart Version
Helm Chart > grafana-6.32.11
Postgres Version
13
Any Help will be appreciated, Thank You!!!!

Related

Your database version: 6030000. Required version: 6000000. helm cetic/zabbix

Problem description:
I was following the instruction of https://github.com/cetic/helm-zabbix/tree/3.1.1#installation to install zabbix with helm in k8s with below commands but failed to visit the web page of zabbix with the error shown in the below pic
helm repo add cetic https://cetic.github.io/helm-charts
helm repo update
helm show values cetic/zabbix > /Users/xiaojueguan/code/AMD/workplace/docs/infra/zabbix/zabbix_values.yaml
helm upgrade --install zabbix cetic/zabbix \
--dependency-update \
--create-namespace \
-f /Users/xiaojueguan/code/AMD/workplace/docs/infra/zabbix/zabbix_values.yaml -n monitoring --debug
kubectl get pods -n monitoring
Things I tried
login into the postgresql server and set the mandatory db version to 6000000 but failed
k get secrets zabbixdb-pguser-zabbix --template={{.data.password}} | base64 -D
psql -h 10.244.0.151 -U zabbix
use zabbix
update dbversion set mandatory=6030000
flush privileges
change the version of postgresql from 14.4 to 13.8 but no luck
Add some update
In the logic of below, we can see that version is found in the db and the other is defined in the code. As the code side we can not change, maybe we can work on the db side.
maybe the field can be changed
maybe we need use postgresq with certain version
https://github1s.com/zabbix/zabbix/blob/release/6.2/ui/include/classes/db/DbBackend.php#L117-L139
/**
* Check if connected database version matches with frontend version.
*
* #return bool
*/
public function checkDbVersion() {
if (!$this->checkDbVersionTable()) {
return false;
}
$version = DBfetch(DBselect('SELECT dv.mandatory FROM dbversion dv'));
if ($version['mandatory'] != ZABBIX_DB_VERSION) {
$this->setError(_s('The Zabbix database version does not match current requirements. Your database version: %1$s. Required version: %2$s. Please contact your system administrator.',
$version['mandatory'], ZABBIX_DB_VERSION
));
return false;
}
return true;
}
https://github1s.com/zabbix/zabbix/blob/release/6.2/ui/include/defines.inc.php#L25
define('ZABBIX_DB_VERSION', 6020000);

Unable to execute Liquibase update commands via Docker run

I am using docker here to build Liquibase and trying to execute Liquibase commands on fly.
Here is the Dockerfile:-
FROM liquibase/liquibase
RUN lpm add mysql --global
I am using below command on fly
docker run --rm -v ${bamboo.build.working.directory}/:/liquibase/changelog liquibase/liquibase --url="jdbc:postgresql://app-liquibase-test.us-region.rds.amazonaws.com:5432/database?currentSchema=schema" --changeLogFile=sql/changelog/db.changelog-master.xml --username=username --password=password update
I am getting below error:-
error 04-May-2022 22:08:38 Starting Liquibase at 05:08:38 (version 4.9.1 #1978 built at 2022-03-28 19:39+0000)
error 04-May-2022 22:08:38 Liquibase Version: 4.9.1
error 04-May-2022 22:08:38 Liquibase Community 4.9.1 by Liquibase
error 04-May-2022 22:08:48
error 04-May-2022 22:08:48 Unexpected error running Liquibase: Connection could not be created to jdbc:postgresql://app-liquibase-test.us-region.rds.amazonaws.com:5432/database?currentSchema=schema with driver org.postgresql.Driver. The connection attempt failed.
Please suggest
From this October 2021 GitHub issue, you need to use single quotes around your JDBC driver URL instead of double-quotes. Try entering it as edited below.
docker run --rm -v ${bamboo.build.working.directory}/:/liquibase/changelog liquibase/liquibase --url='jdbc:postgresql://app-liquibase-test.us-region.rds.amazonaws.com:5432/database?currentSchema=schema' --changeLogFile=sql/changelog/db.changelog-master.xml --username=username --password=password update

Serverless-framework postgresql version upgrading problem

We use serverless-framework and Postgresql.
Type: AWS::RDS::DBInstance
Properties:
EngineVersion: 11.8
It was 11.8 before, we successfully upgraded it from 11.8 to 11.9 by changing the version in serverless.yml in EngineVersion.
But now we need to upgrade it to 11.10 and we have the following issue:
The error message:
Cannot upgrade postgres from 11.9 to 11.1 (Service: AmazonRDS; Status Code: 400; Error Code: InvalidParameterCombination; Request ID: e0d1923a-cf98-44ea-a9e4-bc3871e33bf6; Proxy: null).
So it looks like it tries to upgrade to 11.1 rather than 11.10.
The 11.10 value you're specifying for the EngineVersion property is processed as a number by the YAML engine since you're not using quotes, so the trailing zeros are removed and the resulting value is 11.1. You need to specify the value in quotes, like this: "11.10"
It seems like Serverless ignores '0' in Engine Version that you are trying to set up.
Could you try to escape version with quotes?
It will look like this:
Type: AWS::RDS::DBInstance
Properties:
EngineVersion: '11.10'
It should help to solve the problem and upgrade version successfully

wal-g restore error - Failed to fetch backup: failed to fetch sentinel: context canceled

I am using zolando postgres-operator to setup back up and restore in Kubernetes cluster. The backups are done using wal-g and uploaded into gcp bucket. The backups are running fine
wal-g backup-list
name last_modified wal_segment_backup_start
base_000000020000000000000007 2019-12-19T03:56:22Z 000000020000000000000007
base_00000003000000000000000A 2019-12-19T04:34:41Z 00000003000000000000000A
base_000000010000000000000003 2019-12-19T04:40:01Z 000000010000000000000003
However when I try to restore, I get the below error
wal-g backup-fetch /home/postgres/pgdata/pgroot/data LATEST
INFO: 2019/12/19 10:06:24.765611 LATEST backup is: 'base_000000010000000000000003'
ERROR: 2019/12/19 10:06:25.062066 Failed to fetch backup: failed to fetch sentinel: context canceled
Patroni 1.6.0
Postgres 11
wal-g 0.2.11
This was an error in wal-g version 0.2.11. This is fixed in 0.2.14

Alembic / Flask-migrate migration on Heroku runs but does not create tables

I am attempting to deploy a Flask app to Heroku. I have pushed to Heroku and can access my login page but any call to the db gives an OperationalError:
2014-01-29T12:12:31.801772+00:00 app[web.1]: OperationalError: (OperationalError) no such table: projects_project u'SELECT
Using Flask-migrate I can successfully run local migrations and upgrades:
INFO [alembic.migration] Context impl PostgresqlImpl.
INFO [alembic.migration] Will assume transactional DDL.
INFO [alembic.migration] Running upgrade None -> 4b56d58e1d4c, empty message
When I try to upgrade on Heroku using heroku run python manage.py db upgrade the upgrade appears to happen, but the Context impl. is now SQLite?:
(dev01)Toms-MacBook-Pro:dev01 kt$ heroku run python manage.py db upgrade
Running `python manage.py db upgrade` attached to terminal... up, run.9069
INFO [alembic.migration] Context impl SQLiteImpl.
INFO [alembic.migration] Will assume non-transactional DDL.
INFO [alembic.migration] Running upgrade None -> 4b56d58e1d4c, empty message
Running Heroku pg:info gives:
=== HEROKU_POSTGRESQL_PINK_URL (DATABASE_URL)
Plan: Dev
Status: available
Connections: 0
PG Version: 9.3.2
Created: 2014-01-27 18:55 UTC
Data Size: 6.4 MB
Tables: 0
Rows: 0/10000 (In compliance)
Fork/Follow: Unsupported
Rollback: Unsupported
The relevant logs for the Heroku upgrade are:
2014-01-29T12:55:40.112436+00:00 heroku[api]: Starting process with command `python manage.py db upgrade` by kt#gmail.com
2014-01-29T12:55:44.638957+00:00 heroku[run.9069]: Awaiting client
2014-01-29T12:55:44.667692+00:00 heroku[run.9069]: Starting process with command `python manage.py db upgrade`
2014-01-29T12:55:44.836337+00:00 heroku[run.9069]: State changed from starting to up
2014-01-29T12:55:46.643857+00:00 heroku[run.9069]: Process exited with status 0
2014-01-29T12:55:46.656134+00:00 heroku[run.9069]: State changed from up to complete
Also, heroku config gives me:
(dev01)Toms-MacBook-Pro:dev01 kt$ heroku config
=== myapp Config Vars
DATABASE_URL: postgres://xxx.compute-1.amazonaws.com:5432/da0jtkatk6057v
HEROKU_POSTGRESQL_PINK_URL: postgres://xxx.compute-1.amazonaws.com:5432/da0jtkatk6057v
where [xxx == xxx]
How is the Context impl. set? Apart from this obvious difference between working local and heroku, I can't work out what's happening or how I should debug. Thanks.
The URL for the database is taken from the SQLALCHEMY_DATABASE_URI configuration in your Flask app instance. This happens in the env.py configuration for Alembic that was created in the migrations folder.
Are you storing the value of os.environ['DATABASE_URL'] in the configuration before you hand over control to Flask-Migrate and Alembic? It seems you have a default SQLite based database that never gets overwritten with the real one provided by Heroku.