Skip to content

Commit

Permalink
add info about clickhouse in the tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
sduchesneau committed Dec 5, 2023
1 parent 53bc17c commit 33b7039
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions docs/tutorials/substreams-sql.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ substreams alpha service deploy substreams.sql.yaml
**Tip:** A new PostgreSQL container will be created at port `5432`. The deployment will fail if there is another Docker container using that port.
{% endhint %}

{% hint style="info" %}
**Tip:** You can also use `substreams service deploy substreams.clickhouse.yaml` to use the Clickhouse engine instead of PostgreSQL. There is no postgraphile or pgweb in that case, you will need a tool like DataGrip to see the data.
{% endhint %}

You should see:

```bash
Expand Down Expand Up @@ -215,6 +219,10 @@ Deployments of type "dev" gives you full read/write access to the database and a
substreams alpha service deploy substreams.sql.yaml -e https://deploy.streamingfast.io
```

{% hint style="info" %}
**Tip:** Here again, you can use the `substreams.clickhouse.yaml` manifest to use a Clickhouse engine.
{% endhint %}

You should see this output:

```bash
Expand Down Expand Up @@ -270,7 +278,7 @@ cryptopunks:

When your dbt models are ready, you can pack everything (Substreams, [dbt project](https://docs.getdbt.com/docs/build/projects), etc.) inside an `.spkg` file and deploy it as production:

* Add a `dbt_config` section to the `substreams.sql.yaml` file:
* Add a `dbt_config` section to the `substreams.sql.yaml` (or `substreams.clickhouse.yaml`) file:

```yaml
dbt_config:
Expand All @@ -294,15 +302,19 @@ substreams alpha service stop
* Test your deployment locally, in production mode:

```bash
substreams alpha service deploy substreams.sql.yaml --prod
substreams alpha service deploy substreams.sql.yaml --prod # or substreams.clickhouse.yaml
```

{% hint style="success" %}
**Tip:** If using Clickhouse, you will need to set `sink.config.rest_frontend.enabled` to `true`: it is currently the only way to consume data in a 'production' deployment.
{% endhint %}

* See that the database starts correctly and that the tables defined in `dbt` are being created correctly

* When you are happy with the results, verify or bump the `version` field in `substreams.sql.yaml`, you can generate the `cryptopunks-v0.1.0.spkg` file.

```bash
substreams pack substreams.sql.yaml
substreams pack substreams.sql.yaml # or substreams.clickhouse.yaml
```

## Deploy your production package to the "hosted prod" environment
Expand All @@ -311,4 +323,4 @@ substreams pack substreams.sql.yaml
substreams alpha service deploy cryptopunks-v0.1.0.spkg -e https://deploy.streamingfast.io --prod
```

The production environment does not allow direct SQL access at the moment, so your apps will need to access the data to either the `rest` frontend or the `postgraphile` frontend.
The production environment does not allow direct SQL access at the moment, so your apps will need to access the data to either the `postgraphile` frontend (or the `rest` frontend when using Clickhouse)

0 comments on commit 33b7039

Please sign in to comment.