Skip to content

Commit 6522e0e

Browse files
authored
feat: add single lily node deployment (#1203)
1 parent 2657c6a commit 6522e0e

File tree

2 files changed

+117
-0
lines changed

2 files changed

+117
-0
lines changed

deployment/docker-compose-lily.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
version: '3.5'
2+
3+
services:
4+
lily:
5+
image: filecoin/lily:v0.15.1
6+
container_name: lily
7+
ports:
8+
# export the metrics port
9+
- 9991:9991
10+
env_file:
11+
- ./.env
12+
volumes:
13+
# holds lily datastore repo
14+
- lily_data:/var/lib/lily
15+
# persist params through restarts
16+
- lily_tmp:/var/tmp/filecoin-proof-parameters
17+
# snapshot
18+
- ./snapshot:/var/lib/lily/snapshot
19+
# lily config
20+
- ./lily/config.toml:/var/lib/lily/config.toml
21+
- ./lily/docker_init.sh:/usr/bin/docker_init.sh
22+
entrypoint: /usr/bin/docker_init.sh
23+
restart: always
24+
node-exporter:
25+
image: quay.io/prometheus/node-exporter:latest
26+
container_name: node-exporter
27+
volumes:
28+
- /proc:/host/proc:ro
29+
- /sys:/host/sys:ro
30+
- /:/rootfs:ro
31+
- /:/host:ro,rslave
32+
command:
33+
- '--path.rootfs=/host'
34+
- '--path.procfs=/host/proc'
35+
- '--path.sysfs=/host/sys'
36+
- --collector.filesystem.ignored-mount-points
37+
- "^/(sys|proc|dev|host|etc|rootfs/var/lib/docker/containers|rootfs/var/lib/docker/overlay2|rootfs/run/docker/netns|rootfs/var/lib/docker/aufs)($$|/)"
38+
ports:
39+
- 9100:9100
40+
restart: always
41+
deploy:
42+
mode: global
43+
promtail:
44+
image: grafana/promtail:2.7.0
45+
container_name: promtail
46+
env_file:
47+
- ./.env
48+
volumes:
49+
- ./promtail/config.yml:/etc/promtail/config.yml
50+
- /var/run/docker.sock:/var/run/docker.sock
51+
- /etc/hosts:/etc/hosts:ro
52+
entrypoint: [ "/bin/sh","-c" ]
53+
command:
54+
- "/usr/bin/promtail -config.file=/etc/promtail/config.yml -client.external-labels=hostname=$(tail -2 /etc/hosts | cut -d' ' -f1 | head -1) -config.expand-env"
55+
grafana-agent:
56+
image: "grafana/agent:v0.32.1"
57+
restart: always
58+
pid: "host"
59+
env_file:
60+
- ./.env
61+
volumes:
62+
- ./agent:/etc/agent
63+
entrypoint:
64+
- /bin/agent
65+
- -server.http.address=0.0.0.0:12345
66+
- -config.file=/etc/agent/config.yml
67+
- -config.expand-env
68+
- -config.enable-read-api
69+
ports:
70+
- "12345:12345"
71+
72+
volumes:
73+
lily_data: {}
74+
lily_tmp: {}

deployment/lily/docker_init.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/env bash
2+
3+
set -exo pipefail
4+
5+
mkdir -p ${LILY_REPO}/keystore
6+
7+
8+
if [[ ! -z "${LILY_DOCKER_INIT_IMPORT_MAINNET_SNAPSHOT}" ]]; then
9+
# set default snapshot path if not already defined
10+
snapshot="${LILY_DOCKER_INIT_IMPORT_SNAPSHOT_PATH:-https://snapshots.mainnet.filops.net/minimal/latest.zst}"
11+
12+
# import snapshot when LILY_DOCKER_INIT_IMPORT_MAINNET_SNAPSHOT is set
13+
if [[ -f "${LILY_REPO}/datastore/_imported" ]]; then
14+
echo "Skipping import, found ${LILY_REPO}/datastore/_imported file."
15+
else
16+
echo "Importing snapshot from ${snapshot}"
17+
lily init --import-snapshot=${snapshot}
18+
status=$?
19+
if [ $status -eq 0 ]; then
20+
touch "/var/lib/lily/datastore/_imported"
21+
fi
22+
fi
23+
else
24+
# otherwise only init
25+
lily init
26+
fi
27+
28+
chmod -R 0600 ${LILY_REPO}/keystore
29+
30+
lily --jaeger-tracing --jaeger-provider-url=http://grafana-agent:14268/api/traces daemon --repo=/var/lib/lily --config=/var/lib/lily/config.toml &
31+
32+
# wait for lily daemon
33+
sleep 10
34+
35+
lily sync wait
36+
37+
tasks="actor_state,chain_power,miner_sector_event,market_deal_state,receipt,message,actor,miner_pre_commit_info,miner_sector_infos,miner_sector_infos_v7,miner_locked_fund,miner_fee_debt,parsed_message,block_message,derived_gas_outputs,block_parent,market_deal_proposal,internal_parsed_messages,internal_messages,block_header,miner_sector_deal,chain_consensus,chain_reward,chain_economics,miner_info,power_actor_claim,message_gas_economy,multisig_approvals,id_addresses,vm_messages,actor_events,fevm_actor_stats"
38+
lily job run --tasks=${tasks} --storage="Database1" watch --confidence=5
39+
40+
lily job run --tasks="peeragents" --storage="Database1" survey --interval="24h"
41+
42+
# resume daemon stdout
43+
lily job wait --id=1

0 commit comments

Comments
 (0)