From e40f405c649f18263b76a12fa7a302993da392de Mon Sep 17 00:00:00 2001 From: Simon Reinisch Date: Wed, 17 Apr 2024 17:08:48 +0200 Subject: [PATCH] chore: improve and simplify development setup --- .dockerignore | 1 + .env.example | 4 ++-- .env.genesis | 14 ++++++++++++++ .gitignore | 1 + README.md | 16 +++++++++++----- 5 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 .env.genesis diff --git a/.dockerignore b/.dockerignore index 080bc824..f41271d2 100644 --- a/.dockerignore +++ b/.dockerignore @@ -5,4 +5,5 @@ dist .gitignore .eslintrc .prettierrc +.data *.md diff --git a/.env.example b/.env.example index d7f49962..d337597a 100644 --- a/.env.example +++ b/.env.example @@ -3,5 +3,5 @@ OCULAR_GENESIS_HOST=/api # Optional, pre-filled login credentials for local testing -OCULAR_TEST_USERNAME= -OCULAR_TEST_PASSWORD= +OCULAR_TEST_USERNAME=admin +OCULAR_TEST_PASSWORD=hgEiPCZP diff --git a/.env.genesis b/.env.genesis new file mode 100644 index 00000000..6ea7638d --- /dev/null +++ b/.env.genesis @@ -0,0 +1,14 @@ +# Genesis configuration file +# See https://github.com/simonwep/genesis for more information +GENESIS_PORT=8080 +GENESIS_DB_PATH=.data +GENESIS_CREATE_USERS=admin!:hgEiPCZP,test:EczUR8dn +GENESIS_AUTHORIZED_URIS=localhost:3000 +GENESIS_JWT_SECRET=84d62c48dd30ca7caf6561252c5bd919} +GENESIS_JWT_TOKEN_EXPIRATION=120000 +GENESIS_USERNAME_PATTERN=^[\w]{0,32}$ +GENESIS_KEY_PATTERN=^[\w]{0,32}$ +GENESIS_DATA_MAX_SIZE=32 +GENESIS_KEYS_PER_USER=3 +GENESIS_GIN_MODE=test +GENESIS_LOG_MODE=development diff --git a/.gitignore b/.gitignore index af991da5..98e9ec9e 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,4 @@ dist-ssr # Misc .env +.data diff --git a/README.md b/README.md index 616a4bef..4c50fccc 100644 --- a/README.md +++ b/README.md @@ -46,11 +46,17 @@ Your data stays on your server and is not shared with anyone else. ### Development -This app uses [genesis](https://github.com/simonwep/genesis) as generic backend. -Go to the [genesis](https://github.com/simonwep/genesis) repository and follow the instructions to set it up first. - -To run the frontend make sure you have the latest [node LTS](https://nodejs.org/en/) installed, as well as [pnpm](https://pnpm.io/). -You can then start the frontend by running `pnpm run dev` in the root directory. +1. Make sure you have the latest [node LTS](https://nodejs.org/en/) installed. +2. Install [pnpm](https://pnpm.io/) via `npm i -g pnpm`. +3. Clone this repository. +4. Run `pnpm install` in the root directory. +5. Copy the `.env.example` to `.env`, you can leave the default values. +6. Start the backend with `docker run -p 8080:8080 -v "$(pwd)/.data:/app/.data" --env-file .env.genesis ghcr.io/simonwep/genesis:latest`. +7. Start the frontend with `pnpm run dev`. +8. Open `http://localhost:3000` in your browser. + +> [!NOTE] +> To modify the backend, head over to [genesis](https://github.com/simonwep/genesis). ### Production