-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
39d1204
commit 0511522
Showing
1 changed file
with
53 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,64 @@ | ||
# README | ||
![Sconet](https://user-images.githubusercontent.com/1077405/211963456-00d8ccd9-f635-48e1-8a44-1ad125594481.png) | ||
|
||
This README would normally document whatever steps are necessary to get the | ||
application up and running. | ||
**Sconet** (our "*scon*es and tea budg*et*") is a simple little personal finance app that lets you record your income and expenses, | ||
setup categories and budgets, and break down your spending, all in multiple currencies. | ||
|
||
Things you may want to cover: | ||
It's 🚧 **super WIP and incomplete** 🚧 so expect to find broken things everywhere - at the moment this is more of a testing ground for me to experiment with using [Bun](https://bun.sh/) and [SolidJS](https://www.solidjs.com/), creating a semi-custom GraphQL client and server, etc rather than something I recommend actually using! | ||
|
||
* Ruby version | ||
![CI](https://github.com/binary-koan/sconet/actions/workflows/playwright.yml/badge.svg?branch=main) | ||
![Lint](https://github.com/binary-koan/sconet/actions/workflows/lint.yml/badge.svg?branch=main) | ||
|
||
* System dependencies | ||
## Local development | ||
|
||
* Configuration | ||
Requirements | ||
|
||
* Database creation | ||
- [Bun](https://bun.sh/) 0.4.0 or higher | ||
- [Node.js](https://nodejs.org/en/) | ||
- A [PostgreSQL](https://www.postgresql.org) database with `pg_stat_statements` and `uuid-ossp` extensions enabled | ||
|
||
* Database initialization | ||
1. Clone the repo | ||
2. Run `bun install` in the root | ||
3. Set up a [CloudFlare Turnstile](https://www.cloudflare.com/products/turnstile/) site and set the domain to `localhost`. This is required for login to work | ||
4. Create a `api/.env` file with the following content: | ||
|
||
* How to run the test suite | ||
``` | ||
JWT_SECRET=<some random string to use for signing auth tokens> | ||
USER_EMAILS=<your email, to create an initial user> | ||
TURNSTILE_SECRET_KEY=<your turnstile secret key> | ||
``` | ||
|
||
* Services (job queues, cache servers, search engines, etc.) | ||
5. Create a `web/.env` file with the following content: | ||
|
||
* Deployment instructions | ||
``` | ||
VITE_TURNSTILE_SITEKEY=<your turnstile site key> | ||
``` | ||
|
||
* ... | ||
6. In the `api` directory: | ||
- Run `bun migrate` to apply database migrations | ||
- Run `bun seed` to populate some initial data along with the user(s) in `USER_EMAILS` above | ||
7. Run `bun dev` to start a dev server | ||
- Visit `http://localhost:1235` for the app itself | ||
- Visit `http://localhost:4444/graphql` to browse the API in GraphiQL | ||
8. Log in with the email you added in `USER_EMAILS` and the password `changeme` | ||
|
||
## Deployment | ||
|
||
Sconet can be built as a single Docker image. The included `fly.toml` can be used for easy deployment to [Fly.io](https://fly.io/). | ||
|
||
To build the Docker image you will need to specify `VITE_TURNSTILE_SITEKEY` as a build arg, e.g. | ||
|
||
``` | ||
docker build -t sconet --build-arg VITE_TURNSTILE_SITEKEY=<your site key> . | ||
``` | ||
|
||
When running the image you should | ||
|
||
- Specify the `JWT_SECRET` and `TURNSTILE_SECRET_KEY` environment variables just like in local development | ||
- Mount a persistent storage volume to the `/app/data` path so that the database will be persisted between restarts | ||
|
||
## Backing up the database | ||
|
||
The app will optionally back up the database to S3-compatible storage if you specify the | ||
`BUCKET_ENDPOINT`, `BUCKET_NAME`, `ACCESS_KEY_ID` and `SECRET_KEY_ID` environment variables. | ||
|
||
Snapshots will be taken every 5 minutes if the database has changed, and only the last 3 snapshots will be stored (configure in `api/src/db/backup.ts`). |