Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cidem/lions-backend
A Simple Haskell Project
https://github.com/cidem/lions-backend
haskell nix nix-flake
Last synced: 3 months ago
JSON representation
A Simple Haskell Project
- Host: GitHub
- URL: https://github.com/cidem/lions-backend
- Owner: cideM
- Created: 2021-03-16T11:22:00.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-04-10T07:31:51.000Z (9 months ago)
- Last Synced: 2024-04-10T08:35:55.244Z (9 months ago)
- Topics: haskell, nix, nix-flake
- Language: Haskell
- Homepage:
- Size: 749 KB
- Stars: 6
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# Website for the LIONS Club Achern, Germany
This website used to be a [playground for functional programming](https://www.fbrs.io/fp/) but I've since removed a few of the more niche technologies, such as:
* NixOS
* Nix for building the apps
* Purescript
* SOPSRight now, the technology stack includes:
* Haskell
* Tiny bit of Javascript
* Twitter Bootstrap for CSS (TODO: Replace with vanilla CSS)
* Docker
* Fly.io
* SQLite + Litestream
* `go-migrate` to generate and run migrations
* AWS SES for emails (user account creation and password retrieval)
* AWS S3 for SQLite backups
* Netlify takes care of DNS
* AWS Route53 for the domain## Quickstart
Make sure to have a `.envrc` file, like shown below. The secrets are in 1Password.
```text
use flake
PATH_add ./client/node_modules/.bin
export LITESTREAM_ACCESS_KEY_ID=
export LITESTREAM_SECRET_ACCESS_KEY=
export LITESTREAM_BUCKET=lions-achern-litestream-replica-1
export LITESTREAM_REPLICATE_PATH=local-macbook-1
export LITESTREAM_RESTORE_PATH=prodexport LIONS_SQLITE_PATH=$XDG_DATA_HOME/lions/db
export LIONS_SESSION_KEY_FILE=$XDG_DATA_HOME/lions/session.aes
export LIONS_ENV=development
export LIONS_SERVER_LISTEN_ADDR=127.0.0.1
export LIONS_SCRYPT_SIGNER_KEY=
export LIONS_SCRYPT_SALT_SEP=
export LIONS_AWS_SES_ACCESS_KEY=
export LIONS_AWS_SES_SECRET_ACCESS_KEY=export AWS_PROFILE="lions-shared-admin"
export AWS_DEFAULT_REGION="eu-central-1"
```Then you can just do `docker compose up --build` and everything should just work.
## Tips & Tricks
* You can start from a blank slate by just removing the Docker volume for SQLite. At the next start, Litestream will download the production backup.
* `$ env -C backend ghcid --no-height-limit --clear --reverse`
* `$ env -C backend ghcid --no-height-limit --clear --reverse --target=test:tests`To restore the DB from S3 to your local file system use `litestream restore -o $LIONS_SQLITE_PATH s3://$LITESTREAM_BUCKET/$LITESTREAM_RESTORE_PATH`
### Migrations
- create: `migrate -database "sqlite3://$LIONS_SQLITE_PATH" -path backend/migrations create -dir backend/migrations -ext sql -seq add_activities`
- version: `migrate -database "sqlite3://$LIONS_SQLITE_PATH" -path backend/migrations version`## Deploy
`flyctl deploy`