Skip to content
Snippets Groups Projects
README.md 2.13 KiB
Newer Older
Stefan Freudenberg's avatar
Stefan Freudenberg committed
# StrategyTool [![CI](https://github.com/knot-dots/strategytool/actions/workflows/ci.yaml/badge.svg)](https://github.com/knot-dots/strategytool/actions/workflows/ci.yaml) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
Stefan Freudenberg's avatar
Stefan Freudenberg committed
A [SvelteKit](https://kit.svelte.dev) web application for tracing administrative measures in sustainable communities
Stefan Freudenberg's avatar
Stefan Freudenberg committed
## Get started

The development environment relies on [Docker Compose](https://docs.docker.com/compose/) so make sure it is installed on your system.

You can start the SvelteKit app in development mode with all dependant services:

```bash
docker compose up -d --build
```

Visit http://localhost:5173 to verify that it is up and running.

## Database

We use PostgreSQL with [Slonik](https://github.com/gajus/slonik). 
Please read its [about section](https://github.com/gajus/slonik#about-slonik) before writing database queries. 

Migrations are written in SQL and managed with [golang-migrate/migrate](https://github.com/golang-migrate/migrate).
The tool provides a command for creating new migrations:
Stefan Freudenberg's avatar
Stefan Freudenberg committed
docker compose run --rm migrate create -ext sql NAME
```

This will produce two empty files in the sql/migrations folder, one for upgrading the schema and one for restoring the current state.
Stefan Freudenberg's avatar
Stefan Freudenberg committed
## Tests

For end-to-end tests we use [Playwright](https://playwright.dev/).
The tests are run automatically as part of the continuous integration workflow.
To execute the tests locally run:

```bash
npx playwright install --with-deps
npx playwright test
Stefan Freudenberg's avatar
Stefan Freudenberg committed
## Deployment
Stefan Freudenberg's avatar
Stefan Freudenberg committed
The infrastructure is hosted by [Scaleway](https://www.scaleway.com) and managed with [Terraform](https://wwww.terraform.io).
Follow the instructions for [authenticating the Scaleway provider](https://registry.terraform.io/providers/scaleway/scaleway/latest/docs#authentication) and add a section to your `~/.aws/credentials` file using the same credentials:
Stefan Freudenberg's avatar
Stefan Freudenberg committed
```
[strategytool]
aws_access_key_id = <SCW_ACCESS_KEY>
aws_secret_access_key = <SCW_SECRET_KEY>
Stefan Freudenberg's avatar
Stefan Freudenberg committed
Now you are ready to modify the infrastructure and deployments with Terraform:
Stefan Freudenberg's avatar
Stefan Freudenberg committed
```bash
cd terraform/dev
terraform plan
```

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.