33* [ Catalyst Data Gateway] ( #catalyst-data-gateway )
44 * [ Code Organization] ( #code-organization )
55 * [ ` ./bin ` ] ( #bin )
6- * [ ` ./crates ` ] ( #crates )
76 * [ ` ./event-db ` ] ( #event-db )
87 * [ Build and Run] ( #build-and-run )
98 * [ Docker images] ( #docker-images )
9+ * [ Build] ( #build )
10+ * [ Run] ( #run )
1011 * [ Rust binary] ( #rust-binary )
12+ * [ Build] ( #build-1 )
13+ * [ Run] ( #run-1 )
1114
1215The Catalyst Data Gateway is the backend of the Catalyst Voices hosted stack.
1316
@@ -20,11 +23,6 @@ In future it will also act as a gateway from Centralized catalyst infrastructure
2023
2124This is the main Catalyst Gateway Application.
2225
23- ### ` ./crates `
24-
25- These are fully re-usable generalized ` rust ` crates that the Catalyst Gateway uses and are developed with it.
26- They are also able to be used stand-alone in other projects and can be published separately.
27-
2826### ` ./event-db `
2927
3028Defines the Postgres Catalyst Event Database that the Catalyst gateway uses for running Catalyst Events.
@@ -40,30 +38,60 @@ or you can build a docker image and run everything with the `docker-compose`.
4038
4139To build and run docker images follow these steps:
4240
43- 1 . Run ` earthly +package ` to build a cat-gateway docker image.
44- 2 . Run ` earthly ./event-db+build ` to build an event-db docker image.
45- 3 . Run ` docker-compose up cat-gateway ` to spin up cat-gateway with event-db from already built images.
41+ #### Build
42+
43+ * Build ` cat-gateway ` :
44+
45+ ``` sh
46+ earthly ./catalyst-gateway+docker
47+ ```
48+
49+ * Build ` event-db ` :
4650
47- Note that every time when you are building an image it obsoletes an old image but does not remove it,
48- so don't forget to clean up dangling images of the event-db and cat-gateway in your docker environment.
51+ ``` sh
52+ earthly ./catalyst-gateway/event-db+docker
53+ ```
54+
55+ #### Run
56+
57+ ``` sh
58+ docker compose -f ./catalyst-gateway/docker-compose.yml up cat-gateway
59+ ```
4960
5061### Rust binary
5162
52- To build and run a Rust binary follow these steps:
53-
54- 1 . Run ` cargo build -p cat-gateway --release `
55- to compile a release version of the cat-gateway
56- 2 . Run ` earthly ./event-db+build ` to build an event-db docker image
57- 3 . If you need to have a ` preprod-snapshot ` unarchive snapshot data to the ` /tmp/preprod/ ` dir.
58- You can download ` preprod-snapshot ` from this
59- [ resource] ( https://mithril.network/explorer/?aggregator=https%3A%2F%2Faggregator.release-preprod.api.mithril.network%2Faggregator ) .
60- 4 . Run
61-
62- ``` sh
63- ./target/release/cat-gateway run \
64- --address " 127.0.0.1:3030" \
65- --database-url=postgres://catalyst-event-dev:CHANGE_ME@localhost/CatalystEventDev \
66- --log-level=debug \
67- --log-format=compact \
68- --metrics-address " 127.0.0.1:3032"
69- ```
63+ To build and run ` cat-gateway ` natively,
64+ as a first step it will be needed to anyway build and run ` event-db ` and ` index-db ` as docker containers
65+
66+ #### Build
67+
68+ * Build ` cat-gateway ` :
69+
70+ ``` sh
71+ cd catalyst-gateway
72+ cargo b --release
73+ ```
74+
75+ * Build ` event-db ` :
76+
77+ ``` sh
78+ earthly ./catalyst-gateway/event-db+docker
79+ ```
80+
81+ #### Run
82+
83+ * Run ` event-db ` and ` index-db ` :
84+
85+ ``` sh
86+ docker compose -f ./catalyst-gateway/docker-compose.yml up event-db index-db
87+ ```
88+
89+ * Run ` cat-gateway ` :
90+
91+ ``` sh
92+ export SIGNED_DOC_SK=" 0x6455585b5dcc565c8975bc136e215d6d4dd96540620f37783c564da3cb3686dd"
93+ export CHAIN_NETWORK=" Preprod"
94+ export INTERNAL_API_KEY=" 123"
95+ export EVENT_DB_URL=" postgres://catalyst-event-dev:CHANGE_ME@localhost:5432/CatalystEventDev"
96+ ./catalyst-gateway/target/release/cat-gateway run
97+ ```
0 commit comments