Skip to content

Commit bfe1389

Browse files
Wizard1209Vladimir Bobrikovdroserasprout
authored
Warn about unusual paths in timescaledb-ha image (#858)
Co-authored-by: Vladimir Bobrikov <[email protected]> Co-authored-by: Lev Gorodetskiy <[email protected]>
1 parent 05ffa8b commit bfe1389

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ The format is based on [Keep a Changelog], and this project adheres to [Semantic
1212

1313
### Fixed
1414

15+
16+
- cli: Added warning for timescaledb-ha users
1517
- demos: Fixed decimal overflow in `demo_uniswap` project.
1618
- evm.node: Fixed incorrect log request parameters.
1719
- evm.subsquid.events: Fixed issue with determining the last level when syncing with node.

docs/6.deployment/1.database.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,30 @@ Immune tables support for SQLite is experimental and requires `advanced.unsafe_s
2424
Latest PostgreSQL and TimescaleDB versions are recommended due to significant performance improvements in recent releases (see [Feature matrix](https://www.postgresql.org/about/featurematrix/) page).
2525

2626
Usually it's okay to use different database engines for development and production, but be careful with SQL scripts and column types that can behave differently.
27+
28+
## TimescaleDB
29+
30+
TimescaleDB is a PostgreSQL extension that provides time-series data management capabilities. You can use it with DipDup as a drop-in replacement for PostgreSQL.
31+
32+
You can choose `timescale/timescaledb` or `timescale/timescaledb-ha` Docker images when initializing DipDup project.
33+
34+
::banner{type="warning"}
35+
Be careful! Unlike other PostgreSQL images `timescale/timescaledb-ha` uses `/home/postgres/pgdata/data` as a persistent volume.
36+
::
37+
38+
Use SQL scripts in `on_reindex` directory to prepare the database. First, create a hypertable replacing primary key with composite one:
39+
40+
```sql [sql/on_reindex/00_prepare_db.sql]
41+
{{ #include ../src/demo_uniswap/sql/on_reindex/00_prepare_db.sql }}
42+
```
43+
44+
Now you can create a continuous aggregate on top of the hypertable:
45+
46+
```sql [sql/on_reindex/01_create_mv_token_price.sql]
47+
{{ #include ../src/demo_uniswap/sql/on_reindex/01_create_mv_token_price.sql }}
48+
```
49+
50+
For more information visit the official TimescaleDB documentation:
51+
52+
- [Hypertables](https://docs.timescale.com/use-timescale/latest/hypertables/)
53+
- [Continuous aggregates](https://docs.timescale.com/use-timescale/continuous-aggregates/)

src/dipdup/project.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,9 @@ def answers_from_terminal() -> Answers:
214214
),
215215
default=0,
216216
)
217-
if 'timescale-ha' in answers['postgres_image']:
217+
if 'timescaledb-ha' in answers['postgres_image']:
218218
answers['postgres_data_path'] = '/home/postgres/pgdata/data'
219+
echo('`timescaledb-ha` Docker image uses `/home/postgres/pgdata/data` as a data path; generated files were updated accordingly.', fg='yellow')
219220

220221
big_yellow_echo('Miscellaneous tunables; leave default values if unsure')
221222

0 commit comments

Comments
 (0)