Skip to content

Commit 7ee825e

Browse files
committed
docs: update copilot instructions with latest repo state
1 parent 6875351 commit 7ee825e

File tree

1 file changed

+131
-31
lines changed

1 file changed

+131
-31
lines changed

.github/copilot-instructions.md

Lines changed: 131 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ Always reference these instructions first and fallback to search or bash command
55
## Working Effectively
66

77
### Bootstrap and Dependencies
8-
- Install Go 1.25+: `go version` must show go1.25 or later
8+
- Install Go 1.25.1+: `go version` must show go1.25.1 or later
99
- Install Docker: Required for Vault development server
1010
- Install CLI tools for testing:
1111
```bash
1212
# Ubuntu/Debian
1313
sudo apt-get update && sudo apt-get install -y curl jq
1414

1515
# Check installations
16-
go version # Must be 1.25+
16+
go version # Must be 1.25.1+
1717
docker --version
1818
curl --version
1919
jq --version
@@ -22,7 +22,7 @@ Always reference these instructions first and fallback to search or bash command
2222
### Download Dependencies and Build
2323
- Download Go modules: `go mod download` -- takes 1-2 minutes. NEVER CANCEL. Set timeout to 180+ seconds.
2424
- Build binary: `go build -o sup3rs3cret cmd/sup3rS3cretMes5age/main.go` -- takes <1 second after dependencies downloaded.
25-
- Install linter: `curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.64.8` -- takes 30-60 seconds.
25+
- Install linter: `curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.7.2` -- takes 30-60 seconds. Current system has v2.7.2.
2626

2727
### Testing and Validation
2828
- Run tests: `make test` -- takes 2-3 minutes. NEVER CANCEL. Set timeout to 300+ seconds.
@@ -51,17 +51,39 @@ The application will start on port 8080. Access at http://localhost:8080
5151
docker stop vault-dev && docker rm vault-dev
5252
```
5353

54-
### Docker Build Issues
55-
**IMPORTANT**: Docker builds currently fail in CI/containerized environments due to certificate verification issues with Go proxy:
56-
```
57-
go: cloud.google.com/go@v0.112.1: Get "https://proxy.golang.org/...": tls: failed to verify certificate: x509: certificate signed by unknown authority
54+
### Docker Build and Deployment
55+
The project includes comprehensive Docker support:
56+
57+
#### Local Development with Docker Compose
58+
```bash
59+
# Start full stack (Vault + App on port 8082)
60+
make run
61+
# or
62+
docker compose -f deploy/docker-compose.yml up --build -d
63+
64+
# View logs
65+
make logs
66+
67+
# Stop services
68+
make stop
69+
70+
# Clean up
71+
make clean
5872
```
5973

60-
Do NOT attempt Docker builds (`make build`, `make image`, `docker compose up --build`) in sandboxed environments. These commands will fail after 15-30 seconds. Use local Go builds instead.
74+
The default `docker-compose.yml` runs the app on port 8082 (HTTP) with Vault using token `supersecret`.
75+
76+
#### Production Docker Image
77+
```bash
78+
# Build multi-platform image with attestations
79+
make image
80+
# Builds for linux/amd64 and linux/arm64 with SBOM and provenance
6181

62-
If you need to test Docker functionality, run individual commands:
63-
- `make build` -- WILL FAIL in CI. Takes 15-30 seconds to fail.
64-
- `make image` -- WILL FAIL in CI. Takes 15-30 seconds to fail.
82+
# Alternative: Build local image only
83+
docker compose -f deploy/docker-compose.yml build
84+
```
85+
86+
**Note**: In some CI/containerized environments, Docker builds may encounter certificate verification issues with Go proxy. If this occurs, use local Go builds instead.
6587

6688
## Validation
6789

@@ -100,6 +122,16 @@ Always run these commands before committing:
100122

101123
## Common Tasks
102124

125+
### Key Application Features
126+
- **Self-Destructing Messages**: Messages are automatically deleted after first read
127+
- **Vault Backend**: Uses HashiCorp Vault's cubbyhole for secure temporary storage
128+
- **TTL Support**: Configurable time-to-live (default 48h, max 168h/7 days)
129+
- **File Upload**: Support for file uploads with base64 encoding (max 50MB)
130+
- **One-Time Tokens**: Vault tokens with exactly 2 uses (1 to create, 1 to read)
131+
- **Rate Limiting**: 10 requests per second to prevent abuse
132+
- **TLS Support**: Auto TLS via Let's Encrypt or manual certificate configuration
133+
- **No External Dependencies**: All JavaScript/fonts self-hosted for privacy
134+
103135
### Configuration Environment Variables
104136
- `VAULT_ADDR`: Vault server address (e.g., `http://localhost:8200`)
105137
- `VAULT_TOKEN`: Vault authentication token (e.g., `supersecret` for dev)
@@ -114,22 +146,45 @@ Always run these commands before committing:
114146
### Repository Structure
115147
```
116148
.
117-
├── cmd/sup3rS3cretMes5age/main.go # Application entry point
149+
├── cmd/sup3rS3cretMes5age/
150+
│ └── main.go # Application entry point (23 lines)
118151
├── internal/ # Core application logic
119-
│ ├── config.go # Configuration handling
120-
│ ├── handlers.go # HTTP request handlers
121-
│ ├── server.go # Web server setup
122-
│ └── vault.go # Vault integration
152+
│ ├── config.go # Configuration handling (77 lines)
153+
│ ├── handlers.go # HTTP request handlers (88 lines)
154+
│ ├── handlers_test.go # Handler unit tests (87 lines)
155+
│ ├── server.go # Web server setup (94 lines)
156+
│ ├── vault.go # Vault integration (174 lines)
157+
│ └── vault_test.go # Vault unit tests (66 lines)
123158
├── web/static/ # Frontend assets (HTML, CSS, JS)
159+
│ ├── index.html # Main page (5KB)
160+
│ ├── getmsg.html # Message retrieval page (7.8KB)
161+
│ ├── application.css # Styling (2.3KB)
162+
│ ├── clipboard-2.0.11.min.js # Copy functionality (9KB)
163+
│ ├── montserrat.css # Font definitions
164+
│ ├── robots.txt # Search engine rules
165+
│ ├── fonts/ # Self-hosted Montserrat font files
166+
│ └── icons/ # Favicon and app icons
124167
├── deploy/ # Docker and deployment configs
125-
│ ├── Dockerfile # Container build (fails in CI)
126-
│ ├── docker-compose.yml # Local development stack
127-
│ └── charts/ # Helm charts for Kubernetes
128-
├── Makefile # Build automation
129-
├── go.mod # Go module definition
130-
└── README.md # Project documentation
131-
```
132-
168+
│ ├── Dockerfile # Multi-stage container build
169+
│ ├── docker-compose.yml # Local development stack (Vault + App)
170+
│ └── charts/supersecretmessage/ # Helm c(lint + test pipeline)
171+
.codacy.yml # Code quality config
172+
.dockerignore # Docker ignore patterns
173+
.git/ # Git repository data
174+
.github/ # GitHub configuration (copilot-instructions.md)
175+
.gitignore # Git ignore patterns
176+
CLI.md # Command-line usage guide (313 lines, Bash/Zsh/Fish examples)
177+
CODEOWNERS # GitHub code owners
178+
LICENSE # MIT license
179+
Makefile # Build targets (test, image, build, run, logs, stop, clean)
180+
Makefile.buildx # Advanced buildx targets (multi-platform, AWS ECR)
181+
README.md # Main documentation (176 lines)
182+
cmd/ # Application entry points
183+
deploy/ # Deployment configurations (Docker, Helm)
184+
go.mod # Go module file (go 1.25.1)
185+
go.sum # Go dependency checksums
186+
internal/ # Internal packages (609 lines total)
187+
web/ # Web assets (static HTML, CSS, JS, fonts, icons)
133188
### Frequently Used Commands Output
134189
135190
#### Repository Root Files
@@ -157,14 +212,14 @@ web/ # Web assets
157212
```go
158213
module github.com/algolia/sup3rS3cretMes5age
159214

160-
go 1.25
215+
go 1.25.1
161216

162217
require (
163-
github.com/hashicorp/vault v1.16.3
164-
github.com/hashicorp/vault/api v1.14.0
218+
github.com/hashicorp/vault v1.21.0
219+
github.com/hashicorp/vault/api v1.22.0
165220
github.com/labstack/echo/v4 v4.13.4
166-
github.com/stretchr/testify v1.10.0
167-
golang.org/x/crypto v0.40.0
221+
github.com/stretchr/testify v1.11.1
222+
golang.org/x/crypto v0.45.0
168223
)
169224
```
170225

@@ -195,8 +250,8 @@ o() {
195250
### Troubleshooting
196251

197252
**"go: ... tls: failed to verify certificate"**
198-
- This occurs in Docker builds in CI environments
199-
- Use local Go builds instead: `go build cmd/sup3rS3cretMes5age/main.go`
253+
- This may occur in Docker builds in some CI environments
254+
- Solution: Use local Go builds instead: `go build -o sup3rs3cret cmd/sup3rS3cretMes5age/main.go`
200255

201256
**"jq: command not found"**
202257
```bash
@@ -216,3 +271,48 @@ brew install jq
216271
- Tests create their own Vault instances
217272
- Verbose logging is normal (200+ lines per test)
218273
- NEVER CANCEL tests - they clean up automatically
274+
275+
**Port 8082 already in use**
276+
```bash
277+
# Find what's using the port
278+
sudo lsof -i :8082
279+
# or
280+
sudo netstat -tulpn | grep 8082
281+
282+
# Stop docker-compose if running
283+
make stop
284+
```
285+
286+
**Build fails with "cannot find package"**
287+
```bash
288+
# Clean Go module cache and re-download
289+
go clean -modcache
290+
go mod download
291+
```
292+
293+
### Makefile Targets Reference
294+
```bash
295+
make test # Run all unit tests (takes 2-3 min)
296+
make image # Build multi-platform Docker image with attestations
297+
make build # Build Docker image via docker-compose
298+
make run # Start docker-compose stack (Vault + App on :8082)
299+
make run-local # Clean and start docker-compose
300+
make logs # Tail docker-compose logs
301+
make stop # Stop docker-compose services
302+
make clean # Remove docker-compose containers
303+
```
304+
305+
### CircleCI Pipeline
306+
The project uses CircleCI with two jobs:
307+
1. **lint**: Format checking (gofmt), golangci-lint v2.6.0
308+
2. **test**: Unit tests via `make test`
309+
310+
Pipeline runs on Go 1.25 docker image (`cimg/go:1.25`).
311+
312+
### Helm Deployment
313+
Helm chart located in `deploy/charts/supersecretmessage/`:
314+
- Chart version: 0.1.0
315+
- App version: 0.2.5
316+
- Includes: Deployment, Service, Ingress, HPA, ServiceAccount
317+
- Configurable: Vault connection, TLS settings, resource limits
318+
- See [deploy/charts/README.md](deploy/charts/README.md) for details

0 commit comments

Comments
 (0)