Skip to content

Commit 6a774df

Browse files
committed
Update README, use repo-local key id file
1 parent c44c9a0 commit 6a774df

File tree

4 files changed

+76
-24
lines changed

4 files changed

+76
-24
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ volumes
33
# GPG secrets directory - only track .gpg files
44
gpg-secrets/*
55
!gpg-secrets/*.gpg
6+
7+
# GPG key IDs file
8+
.localmart-github-key-ids

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ clean:
1010

1111
clean-data:
1212
rm -rf ./volumes
13+
rm -rf frontend/.next
1314

1415
deploy-frontend:
1516
cd frontend && fly deploy

README.md

Lines changed: 67 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,81 @@
22

33
localmart is a platform for local businesses to sell their products and services to local customers.
44

5-
## Prerequisites
65

7-
Docker, Docker Compose
6+
## Development
87

9-
## Usage
8+
### Prerequisites
9+
10+
For development:
11+
- Docker
12+
- Docker Compose
13+
14+
### Usage
1015

1116
To start the next.js frontend, the Python backend, and the database, run:
1217
```bash
13-
docker compose --build up
18+
make
1419
```
1520

16-
To clear the database
21+
To clear the database and the frontend next.js cache:
1722
```bash
18-
rm -rf ./volumes
23+
make clean-data
1924
```
2025

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`
2330

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

utils/gpg_manager.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,9 @@ import_keys() {
4949
fi
5050
done
5151

52-
# Store the key IDs in a more permanent location for later use
53-
mkdir -p ~/.localmart
54-
mv "$key_ids_file" ~/.localmart/github_key_ids
55-
echo "Imported keys have been stored in ~/.localmart/github_key_ids"
52+
# Store the key IDs in the repository
53+
mv "$key_ids_file" .localmart-github-key-ids
54+
echo "Imported keys have been stored in .localmart-github-key-ids"
5655
}
5756

5857
# Function to encrypt a file
@@ -64,7 +63,7 @@ encrypt_file() {
6463
fi
6564

6665
# Check if we have stored key IDs
67-
if [ ! -f ~/.localmart/github_key_ids ]; then
66+
if [ ! -f .localmart-github-key-ids ]; then
6867
echo "Error: No GitHub keys found. Please run import-keys first."
6968
exit 1
7069
fi
@@ -75,7 +74,7 @@ encrypt_file() {
7574
if [ -n "$key_id" ]; then
7675
recipient_args="$recipient_args -r $key_id"
7776
fi
78-
done < ~/.localmart/github_key_ids
77+
done < .localmart-github-key-ids
7978

8079
if [ -z "$recipient_args" ]; then
8180
echo "Error: No valid recipient keys found"

0 commit comments

Comments
 (0)