Open sacha-l opened 2 years ago
Docs are pretty out of date. I suggest just using the included docker-compose to get a db up and running
docker-compose up -d
to start postgres and pgadminDATABASE_URL=postgres://postgres:123@localhost:6432/local_chain_db sqlx database create
in substrate-archive/src
to create the database.DATABASE_URL=postgres://postgres:123@localhost:6432/local_chain_db sqlx migrate run in
substrate-archive/src` to create the tables.cargo run --release -- -c archive.toml
in bin/node-template-archive/
to start indexing. Keep in mind to modify the archive.toml configs.Yeah the docs can be confusing here, I think
This example: https://github.com/paritytech/substrate-archive/wiki/1).-Requirements#example-setting-up-the-database seems to be the right place to provide steps on how to do this. Perhaps we could add instructions for different OS users. For me on macos when I run createuser -s postgres, I get: createuser: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory Is the server running locally and accepting connections on that socket?
I haven't had trouble with this on MacOS, this error generally occurs if the postgres server isn't running. how did you install postgres? (Postgres.app/homebrew/etc?)
This example: https://github.com/paritytech/substrate-archive/wiki/1.)-Requirements#compiling-without-a-database alludes to the fact that you can still run the substrate-archive CLI without a database. But it's not so clear how. Where do I set SQLX_OFFLINE=true for example?
Yeah I think this should have been more clear. SQLX_OFFLINE
is not meant to enable archive to run without postgres/rocksdb but just to compile it for use in the context of something like CI. I.E SQLX_OFFLINE=true cargo check
What issue are you running into with node-template? It should just run along node-template-archive
. It's easiest to bring up postgres/rabbitmq with docker-compose and then run node-template/archive combo after creating postgres user/database in docker-postgres. Thing to remember there would be to change the postgres port in archive.toml
if you are running with a non-standard port in docker
In the Quick start section, it says to run:
source ./substrate-archive/scripts/up.sh
, however the script no longer exists there. Is this still relevant? It seemed like a nice feature!In general, it's unclear how to get the SQL database up and running:
createuser -s postgres
, I get:substrate-archive
CLI without a database. But it's not so clear how. Where do I setSQLX_OFFLINE=true
for example?node-template-archive
using the CLI ?If you can help me answer these questions I'll make a follow-up PR with the clarifications I think are needed. Thanks! 😃