前言:当数据库表发生变更的时候。
要做的事情:
一、更改数据库表
# 删除表,更改数据库表(表结构改变) drop table if exists src20_v3; drop table if exists src20_valid_v4; drop table if exists src20_tick_v4; drop table if exists src20_mint_progress_v4; drop table if exists src20_balance_v4; drop table if exists src20_checkpoint_v4; # 清空数据库表的内容(表结构不改变) truncate table src20_valid_v4; truncate table src20_tick_v4; truncate table src20_mint_progress_v4; truncate table src20_balance_v4; truncate table src20_checkpoint_v4; truncate table src20_v3;
二、编译镜像
make image
image: docker build -f Dockerfile -t brc20_node .
三、docker-compose配置文件
version: 'v3' services: brc20_resolver: container_name: brc20_resolver image: brc20_node environment: - NEXT_PUBLIC_BITCOIN_MAIN_API=http://brczero:pwd@remoteIP:8332 - NEXT_PUBLIC_BITCOIN_TEST_API=http://brczero:pwd@remoteIP:8332 - STAGE=Dev - DB_URL=postgres://oker:pwd@192.168.72.217:5432/src20 working_dir: /root command: > sh -c "npm i;npm run resolver > /data/logs/resolver.log 2>&1" volumes: - ./logs:/data/logs brc20_calculator: container_name: brc20_calculator image: brc20_node environment: - NEXT_PUBLIC_BITCOIN_MAIN_API=http://brczero:pwd@remoteIP:8332 - NEXT_PUBLIC_BITCOIN_TEST_API=http://brczero:pwd@remoteIP:8332 - STAGE=Dev - DB_URL=postgres://oker:pwd@192.168.72.217:5432/src20 working_dir: /root command: > sh -c "npm i;npm run calculator > /data/logs/calculator.log 2>&1" volumes: - ./logs:/data/logs brc20_rpc: container_name: brc20_rpc image: brc20_node environment: - STAGE=Dev - DB_URL=postgres://oker:pwd@192.168.72.217:5432/src20 working_dir: /root command: > sh -c "npm i;npm run rpc > /data/logs/rpc.log 2>&1" volumes: - ./logs:/data/logs ports: - "3000:3000"
其中:remoteIP是远程BTC节点
192.168.72.217是数据库地址。写上的本地,上线换生产环境地址。
问:为什么本地不写localhost,而写IP192.168.72.217?
答:因为在docker服务中找不到localhost,而通过IP能找到。
标签:logs,配置文件,src20,pwd,v4,清空,brc20,table,docker From: https://www.cnblogs.com/zccst/p/17928139.html