hyperledger-firefly / hyperledger-firefly/helm-charts

FF10163: Database migration failed: Dirty database version 1

Open
#66 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go Template
Stars
17
Forks
24
PR merge metrics
No merged PRs in 30d

Description

## Issue

The core firefly pod won't start.

I'm getting the following error when I run `kubectl logs firefly006-0`
```
[2023-02-05T22:15:10.300Z] INFO default-firefly006: Project Firefly
[2023-02-05T22:15:10.300Z] INFO default-firefly006: © Copyright 2021 Kaleido, Inc.
Error: FF10163: Database migration failed: FF10163: Database migration failed: Dirty database version 1. Fix and force version.
Usage:
firefly [flags]
firefly [command]

Available Commands:
completion Generate the autocompletion script for the specified shell
help Help about any command
showconfig List out the configuration options
version Prints the version info

Flags:
-f, --config string config file
-h, --help help for firefly

Use "firefly [command] --help" for more information about a command.

FF10163: Database migration failed: FF10163: Database migration failed: Dirty database version 1. Fix and force version.
```

## Background
The command I'm using to deploy is the following

```
helm install firefly006 -f values.yaml --version 0.5.6 oci://ghcr.io/hyperledger/helm/firefly
```
and the result is
```
Pulled: ghcr.io/hyperledger/helm/firefly:0.5.6
Digest: sha256:f81b19748d05322a16f7e996327c96bcdc3ce9dfbf1b89c9b5e1250482927f06
NAME: firefly006
LAST DEPLOYED: Sun Feb 5 17:09:07 2023
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
1. Get the FireFly URL by running these commands:
export POD_NAME=$(kubectl get pods --namespace default -l "app.kubernetes.io/name=firefly,app.kubernetes.io/instance=firefly006" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace default $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
export FF_URL="http://127.0.0.1:8080"
kubectl --namespace default port-forward $POD_NAME 8080:$CONTAINER_PORT &
echo "Visit $FF_URL/api to explore the API via Swagger"
echo "Visit $FF_URL/ui to use explorer UI"
2. Assuming the FireFly smart contracts have been properly deployed and registered on the chain, you can register your FireFly node's organization via the API:
curl -X POST -d '{}' -H 'Content-Type: application/json" $FF_URL/api/v1/network/register/node/organization
3. Wait until your organization then registered, you can confirm its registration by listing the orgs:
curl -X GET $FF_URL/api/v1/network/organizations
4. Once the org is registered, you can register the node itself:
curl -X POST -d '{}' -H 'Content-Type: application/json" $FF_URL/api/v1/network/register/node
5. Lastly, confirm the node has been registered:
curl -X GET $FF_URL/api/v1/network/nodes
```

## Configuration
In my `values.yaml` files I have
- Provided a valid `config.postgresUrl` value and I believe it is correct because the message is NOT complaining about failing to connect, it is complaining about a dirty database
- The password was provided in the following format (I'm showing this to prove that I DID include the database in URL): `postgres://REDACTEDUserName:REDACTEDPassword@redacted-server-name.postgres.database.azure.com/firefly006?sslmode=require`
- Set `config.postgresAutomigrate=true`
- Set `core.jobs.postgresMigrations.enabled=true`
- Left commented out `core.jobs.postgresMigrations.extraEnv` because this is not necessary if `config.postgresUrl` has been provided
- If both `config.postgresUrl` AND `core.jobs.postgresMigrations.extraEnv` are provided then the `helm install...` command fails with `Error: YAML parse error on firefly/templates/core/job-migrations.yaml: error converting YAML to JSON: yaml: line 84: did not find expected key`

The PostgresSQL database I'm deploying to is a complete fresh instance of **Azure Database for PostgreSQL flexible server** with PostgreSQL version 14.6 on which the only action I have taken is to add a new database named `firefly006`,

## Goal
I'm trying to use the helm charts to create my own fresh instance of Firefly.

## Questions
1. Is there a way to make these charts generate the necessary DB schema as part of the install?
2. If there isn't a way, where can I find the documentation to learn how to generate the schema so my `helm install...` command will successfully start up a Firefly instance?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the Helm values and templates/core/job-migrations.yaml, then reproduce the helm install with the reported PostgreSQL settings and inspect the migration job logs. Done means a fresh PostgreSQL database is initialized through the chart and the FireFly core pod starts successfully without the dirty database error.

Written by the indexing model from the issue text.

Assessment

Tech stack
helm, kubernetes, postgresql
Domain
databases, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.