IntersectMBO / cardano-db-sync

A component that follows the Cardano chain and stores blocks and transactions in PostgreSQL
Apache License 2.0
290 stars 162 forks source link

Missing depoendancy "sed" from 13.2.0.2 #1712

Closed ivan-genev closed 3 months ago

ivan-genev commented 4 months ago

OS image ghcr.io/intersectmbo/cardano-db-sync:13.2.0.2 Run method
RESTORE_RECREATE_DB=Y Problem Report /nix/store/sipivivjip8mq92inydn2g95d35wn8vs-postgresql-setup.sh: line 194: sed: command not found

ps : Its already fixed for 13.2.0.2-docker but this image have different purpose

sgillespie commented 4 months ago

ps : Its already fixed for 13.2.0.2-docker but this image have different purpose

Sorry, I don't totally understand, can you elaborate a bit?

ivan-genev commented 4 months ago

@sgillespie When I try to restore/recreate the db from snapshot it fails with the flowing error /nix/store/sipivivjip8mq92inydn2g95d35wn8vs-postgresql-setup.sh: line 194: sed: command not found in version 13.2.0.2. The docker version passed that step but fails with missing schema "public" if I remember it correctly, sed is already added. Now Im not 100% sure if docker version can be used in normal deploy what I try to do is to RESTORE_RECREATE_DB from latest snapshot which currently is impossible.

sgillespie commented 4 months ago

The docker version passed that step but fails with missing schema "public" if I remember it correctly, sed is already added.

I thought we fixed that too

Now Im not 100% sure if docker version can be used in normal deploy what I try to do is to RESTORE_RECREATE_DB from latest snapshot which currently is impossible.

Are you running this from via nix or docker? If you're using docker, you can just delete the volume. If you're using nix, you should just be able to add gnused

ivan-genev commented 4 months ago

Its in kubernetes I try to delete the volume and use the docker version but it fail with missing schema. I will try again tomorrow.

sgillespie commented 4 months ago

Its in kubernetes I try to delete the volume and use the docker version but it fail with missing schema. I will try again tomorrow.

In that case, I think you'll also need to remove the persistent volumes for cardano-db-sync. In the docker compose file we call this db-sync-data. If you get this working, please tell me how you did this, so I can add it to the docs

ivan-genev commented 4 months ago

@sgillespie It didn't work. image:cardano-db-sync:13.2.0.2-docker snapshot:db-sync-snapshot-schema-13.2-block-10336847-x86_64.tgz bitnami/postgresql:15.2.0-debian-11-r2

cardano-db-sync log:

db/4103.dat.gz
db/4095.dat.gz
124588798-2a4f2a3be2-485.lstate.gz
pg_restore: while PROCESSING TOC:
pg_restore: from TOC entry 980; 1247 16411 DOMAIN addr29type cexplorer
pg_restore: error: could not execute query: ERROR:  schema "public" does not exist
Command was: CREATE DOMAIN public.addr29type AS bytea;

postgresql log

2024-05-22 21:50:15.540 GMT [118] LOG:  checkpoint complete: wrote 9 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.853 s, sync=0.012 s, total=0.933 s; sync files=9, longest=0.009 s, average=0.002 s; distance=11 kB, estimate=228 kB
2024-05-22 21:50:58.473 GMT [9307] ERROR:  schema "public" does not exist
2024-05-22 21:50:58.473 GMT [9307] STATEMENT:  CREATE DOMAIN public.addr29type AS bytea;
gabrielRx commented 4 months ago

same issue, missing sed command

alekswithakayy commented 4 months ago

Same issue here:

cardano-db-sync-1  | /nix/store/sipivivjip8mq92inydn2g95d35wn8vs-postgresql-setup.sh: line 194: sed: command not found
sgillespie commented 4 months ago

@sgillespie It didn't work. image:cardano-db-sync:13.2.0.2-docker snapshot:db-sync-snapshot-schema-13.2-block-10336847-x86_64.tgz bitnami/postgresql:15.2.0-debian-11-r2

I believe this is a consequence of using RESTORE_DB_RECREATE=Y. If you've recently recreated the postgresql volume, this is unnecessary (and doesn't work very well). My recommendation is to not use RESTORE_DB_RECREATE if you're using the PostgreSQL docker image.

nilscodes commented 4 months ago

I have the same issue, and am recreating a new instance on mainnet from scratch currently. I am not using RESTORE_DB_RECREATE=Y

Command to deploy

RESTORE_SNAPSHOT=https://update-cardano-mainnet.iohk.io/cardano-db-sync/13.2/db-sync-snapshot-schema-13.2-block-10379077-x86_64.tgz NETWORK=mainnet docker-compose up -d

The error appears after downloading and extracting the snapshot.

/nix/store/sipivivjip8mq92inydn2g95d35wn8vs-postgresql-setup.sh: line 194: sed: command not found

Exact tag I am using

cardano@Ubuntu-2204-jammy-amd64-base:~/cardano-db-sync$ git status
HEAD detached at 13.2.0.2-docker
sgillespie commented 4 months ago

I am not using RESTORE_DB_RECREATE=Y

This is generally not related to the sed issue.

I have the same issue, and am recreating a new instance on mainnet from scratch currently.

This should be resolved in 13.2.0.2-docker. I see you're using the local git tag - are you building the image yourself, or are you pulling it from ghcr.io?

EDIT: I see what's happening now. IIUC, you're checking out the tag 13.2.0.2-docker and running docker compose. The compose file still points at 13.2.0.2, so you'll need to update that entry in docker-compose.yml:

  cardano-db-sync:
    image: ghcr.io/intersectmbo/cardano-db-sync:13.2.0.2-docker
nilscodes commented 3 months ago

Hey Sean, and thanks for taking a look!

Indeed, the "bug" is that the compose file does not reference the new docker image. Changing it to 13.2.0.2-docker allowed the processing to complete AND sync to be started.

Thank you for pointing that out, I could have just given that a whirl :)

~ Nils