## Optimize CI/CD Workflows ### Changes #### build.yaml - **Merge 3 cargo steps → 1 compile pass**: `cargo build`, `cargo test`, `cargo clippy` now run in single invocation, reusing compiled artifacts - **Remove `cargo clean`**: Eliminated wasteful step that deleted artifacts before Docker build - **Add secret validation**: Registry credentials checked before login (fail-fast) #### deploy.yaml - **Skip checkout**: Removed unnecessary git clone - **Fetch SHA via Gitea API**: Query latest commit directly instead of cloning - **Reuse existing token**: Use `FORGEJO_REGISTRY_TOKEN` for Gitea API auth (already has privileges) - **Validate image exists**: Check SHA image exists before tagging as latest (prevents tagging non-existent images) - **Add secret validation**: Registry credentials checked before login (fail-fast) #### migrate.yaml - **Merge schema verification**: Schema inspect result reused in both changed + manual paths - **Fix manual trigger errors**: Manual mode now fails on first migration error (was silently masking with `|| true`) - **Track failures**: Explicit FAILED flag tracks migration errors across loop ### Benefits - **Speed**: Fewer compiles, no unnecessary clones, reuse artifacts - **Reliability**: Secret validation catches configuration issues early - **Safety**: Image existence check prevents tagging phantom images - **Clarity**: Merged steps have descriptive names, explicit error handling ### Testing - Branch: `ci/optimize-workflows` - Ready to merge to `main` after review --------- Co-authored-by: rock <[email protected]> Reviewed-on: #51 Co-authored-by: poimen <[email protected]>
2.0 KiB
2.0 KiB
Local Development Setup
Running poimen-memory locally for development.
Quick Start
-
Copy env template:
cp .env.example .env -
Edit
.envwith your local endpoints:# Edit .env with your local/dev service URLs # Example: LLM service on localhost:11434, OpenSearch on localhost:9200 -
Run the service:
cargo run --release -- serve --port 8080
The application loads configuration from .env (via dotenvy or similar).
.env File
Location: Project root (.env)
Status: Gitignored - never committed
Template: .env.example (included in repo, shows all available variables)
Key Variables
# Database
DATABASE_URL=postgresql://user:pass@localhost:5432/memory
# LLM (point to your local LLM service)
LLM_ENDPOINT=http://localhost:11434/v1/chat/completions
LLM_MODEL=qwen:7b
# OpenSearch (local vector store)
OPENSEARCH_HOST=localhost:9200
# Auth (disabled for local dev)
MEM_AUTH_MODE=none
# API Key (test key for local dev)
MEM_API_KEY=test-key
Local Service Stack (Example)
# Terminal 1: OpenSearch
docker run -d -p 9200:9200 -e OPENSEARCH_JAVA_OPTS="-Xms512m -Xmx512m" \
opensearchproject/opensearch:latest
# Terminal 2: Ollama (LLM)
ollama serve
# Terminal 3: poimen-memory
cargo run --release -- serve --port 8080
Production vs Local
| Aspect | Production (K8s) | Local Dev |
|---|---|---|
| Config | k8s/app/config.yaml (SOPS-encrypted) |
.env (gitignored) |
| Injection | ConfigMap via envFrom: |
dotenv via dotenvy crate |
| Services | Cluster-internal DNS | localhost/127.0.0.1 |
| Auth | JWT (Authentik) | None (disabled) |
| Commit? | Yes (encrypted) | No (gitignored) |
Switching to Production Config
To run against production services (not recommended locally):
- Edit
.envwith production URLs - Set credentials appropriately
- Ensure network access to production services
See .env.example for all available environment variables.