|
2 | 2 |
|
3 | 3 | localmart is a platform for local businesses to sell their products and services to local customers.
|
4 | 4 |
|
5 |
| -## Prerequisites |
6 | 5 |
|
7 |
| -Docker, Docker Compose |
| 6 | +## Development |
8 | 7 |
|
9 |
| -## Usage |
| 8 | +### Prerequisites |
| 9 | + |
| 10 | +For development: |
| 11 | +- Docker |
| 12 | +- Docker Compose |
| 13 | + |
| 14 | +### Usage |
10 | 15 |
|
11 | 16 | To start the next.js frontend, the Python backend, and the database, run:
|
12 | 17 | ```bash
|
13 |
| -docker compose --build up |
| 18 | +make |
14 | 19 | ```
|
15 | 20 |
|
16 |
| -To clear the database |
| 21 | +To clear the database and the frontend next.js cache: |
17 | 22 | ```bash
|
18 |
| -rm -rf ./volumes |
| 23 | +make clean-data |
19 | 24 | ```
|
20 | 25 |
|
21 |
| -## Debugging Tips |
22 |
| -If the app is not loading porperly on your machine, try clear the cache and restart. |
| 26 | +### Debugging Tips |
| 27 | +1. If the app is not loading porperly on your machine, try: |
| 28 | + - clearing the data with `make clean-data` |
| 29 | + - restarting with `make` |
23 | 30 |
|
24 |
| -To rebuild the backend: |
25 |
| -```bash |
26 |
| -make |
27 |
| -``` |
28 |
| -To rebuild the frontend, if NextJS is giving errors: |
29 |
| -```bash |
30 |
| -cd frontend/ |
31 |
| -rm -rf .next |
32 |
| -make |
33 |
| -``` |
| 31 | +## Secret Management |
| 32 | + |
| 33 | +We use GPG encryption to securely store sensitive files. The encrypted files are stored in the `gpg-secrets/` directory and can only be decrypted by authorized team members. |
| 34 | + |
| 35 | +### Prerequisites |
| 36 | + |
| 37 | +1. Install GPG on your system: |
| 38 | + ```bash |
| 39 | + # macOS |
| 40 | + brew install gnupg |
| 41 | + |
| 42 | + # Ubuntu/Debian |
| 43 | + sudo apt-get install gnupg |
| 44 | + ``` |
| 45 | + |
| 46 | +2. Have your own GPG key pair and upload the public key to your GitHub profile |
| 47 | + ([GitHub guide on adding GPG keys](https://docs.github.com/en/authentication/managing-commit-signature-verification/adding-a-gpg-key-to-your-github-account)) |
| 48 | + |
| 49 | +### Managing Secrets |
| 50 | + |
| 51 | +The following commands are available: |
| 52 | + |
| 53 | +1. Import team members' GPG keys: |
| 54 | + ```bash |
| 55 | + # Import team members' GPG keys |
| 56 | + make import-gpg-keys |
| 57 | + ``` |
| 58 | + |
| 59 | +2. Encrypt a file: |
| 60 | + ```bash |
| 61 | + # The file will be encrypted and stored in gpg-secrets/ |
| 62 | + make encrypt-file FILE=path/to/your/file |
| 63 | + |
| 64 | + # Example: Encrypt staging environment variables |
| 65 | + make encrypt-file FILE=gpg-secrets/staging.env |
| 66 | + ``` |
| 67 | + |
| 68 | +3. Decrypt a file: |
| 69 | + ```bash |
| 70 | + # Only works with files in the gpg-secrets/ directory |
| 71 | + make decrypt-file FILE=gpg-secrets/your-file.gpg |
| 72 | + |
| 73 | + # Example: Decrypt staging environment variables |
| 74 | + make decrypt-file FILE=gpg-secrets/staging.env.gpg |
| 75 | + ``` |
| 76 | + |
| 77 | +### Notes |
| 78 | + |
| 79 | +- Only files in the `gpg-secrets/` directory with the `.gpg` extension are tracked in Git |
| 80 | +- Decrypted files are automatically placed in the `gpg-secrets/` directory |
| 81 | +- You must have your private key to decrypt files |
| 82 | +- The list of team members is maintained in the Makefile's `GITHUB_USERS` variable |
0 commit comments