Openstatus www.openstatus.dev
at main 50 lines 1.2 kB view raw view rendered
1# DB 2 3We are using [turso](https://turso.tech) and sqlite as database to store 4user/page/monitor settings. The timeseries data is stored in a 5[tinybird](https://tinybird.co) datasource (built on top of ClickHouse). 6 7## Local Development 8 9Install the [Turso CLI](https://docs.turso.tech/reference/turso-cli). 10 11For local environment, first 12[install sqld](https://github.com/tursodatabase/libsql/blob/main/docs/BUILD-RUN.md). 13 14When installing with Homebrew, follow: 15 16```bash 17$ brew tap libsql/sqld 18$ brew install sqld-beta 19$ sqld --help 20``` 21 22If you want to keep your database locally, run: 23 24```bash 25$ turso dev --db-file openstatus.db 26``` 27 28It will create a local database in the directory you run the command. 29 30Add the environment variables to inside of the `.env` file in both projects, the 31`/apps/web` and `/packages/db`: 32 33```env 34DATABASE_URL=http://127.0.0.1:8080 35DATABASE_AUTH_TOKEN=any-token # no need to change token 36``` 37 38Start the migration script inside of `/packages/db` to have the database schema 39up to date: 40 41```bash 42$ pnpm migrate 43``` 44 45You should be ready to go! Check out the Drizzle Studio to see if your tables 46have been created: 47 48```$ 49$ pnpm studio 50```