-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ec8e1c2
commit d14305e
Showing
5 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,33 @@ | ||
# Building with Docker | ||
|
||
The squid template repository comes with a `Dockerfile` included. | ||
|
||
The PostgreSQL database is already a docker-compose dependency by default, so this means that the [processor](../../key-concepts/processor.md) and the GraphQL server can be run as microservices in a container orchestration system, such as Kubernetes. | ||
|
||
In order to build an image of your customized project, provided you do have Docker installed and access to its CLI, simply launch the following command from the project's main folder, in a terminal window: | ||
|
||
```bash | ||
docker build . -t <image_name:image_version> | ||
``` | ||
|
||
Where `image_name` and `image_version` should be substituted with the values that better fit your project. | ||
|
||
Below, you can see a screenshot of the Docker image process: | ||
|
||
![Building a Docker image of the squid-template](<../../.gitbook/assets/docker build.png>) | ||
|
||
In order to run the container, simply launch `docker run <image_name>:<image_version>` (you can omit `image_version` if it was labeled `latest`). | ||
|
||
But in order to test if everything is in order, we could launch the command by mapping the container port to the host's port, and check if we have access to the GraphiQL playground: | ||
|
||
```bash | ||
docker run -d -p 4000:4000 --name sqdl squid-template:latest | ||
``` | ||
|
||
And when visiting the URL `localhost:4000/graphql` in the browser, we should see this: | ||
|
||
![Accessing the GraphiQL playground of the launched container](<../../.gitbook/assets/container graphql.png>) | ||
|
||
{% hint style="info" %} | ||
The 4000 port has been chosen, because it is explicitly exposed during the building process of the Docker image. | ||
{% endhint %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,22 @@ | ||
# Prometheus metrics | ||
|
||
The Subsquid SDK comes with [Prometheus](https://prometheus.io) metrics to monitor synchronization status. When launching the processor, it is sufficient to specify the port at which metrics should be served via the environment variable `PROCESSOR_PROMETHEUS_PORT`. | ||
|
||
If not provided, a random port will be used and communicated at launch: | ||
|
||
```bash | ||
⇒ node -r dotenv/config lib/processor.js | ||
Prometheus metrics are served at port 34491 | ||
Last block: 9422743, mapping: 33 blocks/sec, ingest: 279 blocks/sec, eta: 9h 12m, progress: 81% | ||
Last block: 9423694, mapping: 41 blocks/sec, ingest: 217 blocks/sec, eta: 8h 37m, progress: 81% | ||
Last block: 9424679, mapping: 41 blocks/sec, ingest: 195 blocks/sec, eta: 8h 16m, progress: 81% | ||
Last block: 9425591, mapping: 43 blocks/sec, ingest: 218 blocks/sec, eta: 8h 10m, progress: 81% | ||
Last block: 9426588, mapping: 44 blocks/sec, ingest: 227 blocks/sec, eta: 7h 33m, progress: 81% | ||
Last block: 9427710, mapping: 48 blocks/sec, ingest: 182 blocks/sec, eta: 6h 57m, progress: 81% | ||
``` | ||
|
||
Then, it is sufficient to visit the `localhost:PROCESSOR_PROMETHEUS_PORT/metrics` URL, in order to access Prometheus metrics: | ||
|
||
![Prometheus metrics](../../.gitbook/assets/metrics.png) | ||
|
||
These can then be regularly polled to monitor the status and, for example, used in [Grafana dashboards](https://prometheus.io/docs/visualization/grafana/). |