⚠️ Mercury is currently not supported.⚠️
This is a project for establishing an all-in-one ckb environment with docker-compose. It includes the following components:
- ckb
- ckb-mercury
- postgres
First, you need a environment which can run Docker properly, the Apple M1 chip probably not working.
Then, you need to install Docker Compose or Portainer to start all services in one click.
Now, clone this project with git clone https://github.com/linkdesu/ckb-env.git
.
But before you start services, you need basicly 3 step to get configs ready:
WARNING! DO NOT modify ports in configs like
ckb-node/*.toml
orckb-indexer/*.toml
, they are also hard-coded incompose.yaml
, so only modify them through the.env
file.
- Copy and paste
.env.*.example
to.env
and modify it base on your requirements, you most likely want to modify thePROJECT_DIR
to indicate where this project directory is on your system. - Copy and paste
ckb-node/ckb.*.toml
tockb-node/ckb.toml
andckb-node/ckb-miner.*.toml
tockb-node/ckb-miner.toml
base on your requirements. - Config
mercury/config.toml
base on your requirements, you most likely want to modifynetwork_config.network_type
to indicate mainnet or testnet. - Confirm the directory permissions by simply run
docker compose up ckb-node
, if this command executed sueccessfully, then everything is OK, otherwise you need to solve the permission issues following Permission Problems.
After all that preparation, you may start all services now with run docker compose up
or click Deploy this stack
.
If you know the references of compose.yaml you will find that:
ckb-node
is the core service, nothing can run without it.mercury
is depend onpostgres
.- If you do not need
mercury
you will not needpostgres
.
After start all services you may need to sync everything from ckb network in about 48 hours, faster machine and network can shrink the waiting time significantly.
Then if you do not want to sync again and again, remember to protected the following directory carefully:
./ckb-node/data
, it store the rocksdb of ckb-node service../postgres/data
, it store the postgres database which required by mercury service.
The service ckb-node will run as the user ckb(1000:1000) in container, so when the permission denied
error occurs, you have two ways to make everything works:
- The first way is run the services as user 1000:1000 which means the id and group of the user is 1000, and ensure the path to the project directory is writable by user(1000:1000), the user's name do not have to be ckb;
- The second way is run the services as root, in this way you need to uncomment the
# user: root
line incompose.yaml
;
The best practice is not to run the container as root, but it is ok to choose any of them.
You may face some failsure while deploying, network failsure, permission denied and so on. When any of these break the depolyment process, you need to clear ./postgres/data
directory, then it will be ok to redeploy as many times as possible until you solved every problems.
- Before start the service, if you run Docker with user other than 1000:1000, you will need to create a user named postgres in host, this is caused by how postgres runs the SQLs in initdb.
- Because we do not need it in production, it has been lost maintenance for too long, any PR is welcome.