Merge pull request 'Flake updates, dev server, and small doc improvements' (#10104) from pyrox/calckey:develop into develop

Reviewed-on: https://codeberg.org/calckey/calckey/pulls/10104
This commit is contained in:
Kainoa Kanter 2023-05-12 14:01:44 +00:00
commit 245564924c
4 changed files with 75 additions and 0 deletions

38
.config/devenv.yml Normal file
View File

@ -0,0 +1,38 @@
url: http://localhost:3000
port: 3000
db:
host: 127.0.0.1
port: 5432
db: calckey
user: calckey
pass: calckey
redis:
host: localhost
port: 6379
family: 4
#sonic:
# host: localhost
# port: 1491
# auth: SecretPassword
# collection: notes
# bucket: default
#elasticsearch:
# host: localhost
# port: 9200
# ssl: false
# user:
# pass:
id: 'aid'
reservedUsernames:
- root
- admin
- administrator
- me
- system

1
.gitignore vendored
View File

@ -22,6 +22,7 @@ coverage
# config # config
/.config/* /.config/*
!/.config/example.yml !/.config/example.yml
!/.config/devenv.yml
!/.config/docker_example.env !/.config/docker_example.env
!/.config/helm_values_example.yml !/.config/helm_values_example.yml

22
docs/development.md Normal file
View File

@ -0,0 +1,22 @@
# 🌎 Calckey Developer Docs
## Nix Dev Environment
The Calckey repo comes with a Nix-based shell environment to help make development as easy as possible!
Please note, however, that this environment will not work on Windows outside of a WSL2 environment.
### Prerequisites
- Installed the [Nix Package Manager](https://nixos.org/download.html)
- Installed [direnv](https://direnv.net/docs/installation.html) and added its hook to your shell.
Once the repo is cloned to your computer, follow these next few steps inside the Calckey folder:
- Run `direnv allow`. This will build the environment and install all needed tools.
- Run `install-deps`, then `prepare-config`, to install the node dependencies and prepare the needed config files.
- In a second terminal, run `devenv up`. This will spawn a **Redis** server, a **Postgres** server, and the **Calckey** server in dev mode.
- Once you see the Calckey banner printed in your second terminal, run `migrate` in the first.
- Once migrations finish, open http://localhost:3000 in your web browser.
- You should now see the admin user creation screen!
Note: When you want to restart a dev server, all you need to do is run `devenv up`, no other steps are necessary.

View File

@ -32,6 +32,8 @@
# Add additional packages to our environment # Add additional packages to our environment
packages = [ packages = [
pkgs.nodePackages.pnpm pkgs.nodePackages.pnpm
pkgs.python3
]; ];
# No need to warn on a new version, we'll update as needed. # No need to warn on a new version, we'll update as needed.
devenv.warnOnNewVersion = false; devenv.warnOnNewVersion = false;
@ -43,6 +45,18 @@
# Enable stable Rust for the backend # Enable stable Rust for the backend
languages.rust.enable = true; languages.rust.enable = true;
languages.rust.version = "stable"; languages.rust.version = "stable";
processes = {
dev-server.exec = "pnpm run dev";
};
scripts = {
build.exec = "pnpm run build";
clean.exec = "pnpm run clean";
clear-state.exec = "rm -rf .devenv/state/redis .devenv/state/postgres";
format.exec = "pnpm run format";
install-deps.exec = "pnpm install";
migrate.exec = "pnpm run migrate";
prepare-config.exec = "cp .config/devenv.yml .config/default.yml";
};
services = { services = {
postgres = { postgres = {
enable = true; enable = true;