|
1 | 1 | # Example
|
2 | 2 |
|
| 3 | +In order do as follows |
| 4 | + |
| 5 | +## Setup |
| 6 | + |
| 7 | +### Docker |
| 8 | + |
| 9 | +1. Copy `dbpass.txt.example` to `dbpass.txt` and set a password |
| 10 | +2. Copy `password-file.txt.example` to `password-file.txt` and set the same |
| 11 | + password |
| 12 | + |
| 13 | +Alternatively, set `POSTGRES_HOST_AUTH_METHOD=trust` and pass it to docker |
| 14 | +compose (No authentication, this is done on debug mode) |
| 15 | + |
| 16 | +### Local |
| 17 | + |
| 18 | +1. Install **node 22** |
| 19 | +2. Run `npm install` |
| 20 | + |
| 21 | +## Local Development |
| 22 | + |
| 23 | +### Build |
| 24 | + |
| 25 | +Only required for local development |
| 26 | + |
| 27 | +```bash |
| 28 | +npm run build -ws |
| 29 | +``` |
| 30 | + |
| 31 | +### Test |
| 32 | + |
| 33 | +```bash |
| 34 | +npm run test -ws |
| 35 | +``` |
| 36 | + |
| 37 | +### Prepare database for local development |
| 38 | + |
| 39 | +```bash |
| 40 | +# at a separate terminal run this and keep running |
| 41 | +docker compose -f compose.yaml -f compose.debug.yaml up db |
| 42 | +# In a separate terminal, (I believe postgresql does this automatically) |
| 43 | +# npm run db:prepare -w backend |
| 44 | +``` |
| 45 | + |
| 46 | +### Launch |
| 47 | + |
| 48 | +### Hot-reload mode |
| 49 | + |
| 50 | +In `vscode` use the task labeled `dev`. |
| 51 | + |
| 52 | +In the terminal you want to open two terminals, opening a database and the |
| 53 | +development environment |
| 54 | + |
| 55 | +```bash |
| 56 | +# Then keep this process running |
| 57 | +npm run dev |
| 58 | +``` |
| 59 | + |
| 60 | +Clean resources |
| 61 | + |
| 62 | +```bash |
| 63 | +docker compose -f compose.yaml -f compose.debug.yaml down -v db |
| 64 | +npm run clean -ws --if-present |
| 65 | +``` |
| 66 | + |
| 67 | +Access `http://localhost:3000/tasks/debug/populate` to populate a few tasks (or |
| 68 | +click the populate button) |
| 69 | + |
| 70 | +## Docker _deployment_ |
| 71 | + |
| 72 | +```bash |
| 73 | +docker compose up |
| 74 | +``` |
| 75 | + |
| 76 | +App will be accessible on port 8080 |
| 77 | + |
| 78 | +### Launch in debug mode |
| 79 | + |
| 80 | +TODO, WIP |
| 81 | + |
3 | 82 | ## Using workspaces
|
4 | 83 |
|
5 | 84 | Most commands can be launched for each workspace by using `--workspaces|-ws`
|
6 | 85 |
|
| 86 | +Examples: |
| 87 | + |
7 | 88 | ```bash
|
8 |
| -npm i -ws |
9 |
| -npm install --workspaces |
| 89 | +npm i --workspaces |
| 90 | +npm ci -ws |
| 91 | +npm run build -ws --if-present |
| 92 | +npm run test -ws --if-present |
| 93 | +npm run clean -ws --include-workspace-root --if-present |
10 | 94 | ```
|
| 95 | + |
| 96 | +Or in a specific workspace |
| 97 | + |
| 98 | +```bash |
| 99 | +npm i --workspace=backend |
| 100 | +npm ci -w=backend --omit=dev |
| 101 | +npm run start --workspace=backend |
| 102 | +``` |
| 103 | + |
| 104 | +Use auto-reload with |
0 commit comments