mirror of
https://github.com/DeBrosOfficial/orama.git
synced 2026-03-27 15:04:12 +00:00
commit
1ca779880b
91
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
91
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
name: Bug Report
|
||||||
|
description: Report a bug in Orama Network
|
||||||
|
labels: ["bug"]
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
Thanks for reporting a bug! Please fill out the sections below.
|
||||||
|
|
||||||
|
**Security issues:** If this is a security vulnerability, do NOT open an issue. Email security@orama.io instead.
|
||||||
|
|
||||||
|
- type: input
|
||||||
|
id: version
|
||||||
|
attributes:
|
||||||
|
label: Orama version
|
||||||
|
description: "Run `orama version` to find this"
|
||||||
|
placeholder: "v0.18.0-beta"
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: dropdown
|
||||||
|
id: component
|
||||||
|
attributes:
|
||||||
|
label: Component
|
||||||
|
options:
|
||||||
|
- Gateway / API
|
||||||
|
- CLI (orama command)
|
||||||
|
- WireGuard / Networking
|
||||||
|
- RQLite / Storage
|
||||||
|
- Olric / Caching
|
||||||
|
- IPFS / Pinning
|
||||||
|
- CoreDNS
|
||||||
|
- OramaOS
|
||||||
|
- Other
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: description
|
||||||
|
attributes:
|
||||||
|
label: Description
|
||||||
|
description: A clear description of the bug
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: steps
|
||||||
|
attributes:
|
||||||
|
label: Steps to reproduce
|
||||||
|
description: Minimal steps to reproduce the behavior
|
||||||
|
placeholder: |
|
||||||
|
1. Run `orama ...`
|
||||||
|
2. See error
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: expected
|
||||||
|
attributes:
|
||||||
|
label: Expected behavior
|
||||||
|
description: What you expected to happen
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: actual
|
||||||
|
attributes:
|
||||||
|
label: Actual behavior
|
||||||
|
description: What actually happened (include error messages and logs if any)
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: environment
|
||||||
|
attributes:
|
||||||
|
label: Environment
|
||||||
|
description: OS, Go version, deployment environment, etc.
|
||||||
|
placeholder: |
|
||||||
|
- OS: Ubuntu 22.04
|
||||||
|
- Go: 1.23
|
||||||
|
- Environment: sandbox
|
||||||
|
validations:
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: context
|
||||||
|
attributes:
|
||||||
|
label: Additional context
|
||||||
|
description: Logs, screenshots, monitor reports, or anything else that might help
|
||||||
|
validations:
|
||||||
|
required: false
|
||||||
49
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
Normal file
49
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
name: Feature Request
|
||||||
|
description: Suggest a new feature or improvement
|
||||||
|
labels: ["enhancement"]
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
Thanks for the suggestion! Please describe what you'd like to see.
|
||||||
|
|
||||||
|
- type: dropdown
|
||||||
|
id: component
|
||||||
|
attributes:
|
||||||
|
label: Component
|
||||||
|
options:
|
||||||
|
- Gateway / API
|
||||||
|
- CLI (orama command)
|
||||||
|
- WireGuard / Networking
|
||||||
|
- RQLite / Storage
|
||||||
|
- Olric / Caching
|
||||||
|
- IPFS / Pinning
|
||||||
|
- CoreDNS
|
||||||
|
- OramaOS
|
||||||
|
- Other
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: problem
|
||||||
|
attributes:
|
||||||
|
label: Problem
|
||||||
|
description: What problem does this solve? Why do you need it?
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: solution
|
||||||
|
attributes:
|
||||||
|
label: Proposed solution
|
||||||
|
description: How do you think this should work?
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: alternatives
|
||||||
|
attributes:
|
||||||
|
label: Alternatives considered
|
||||||
|
description: Any workarounds or alternative approaches you've thought of
|
||||||
|
validations:
|
||||||
|
required: false
|
||||||
31
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
31
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
## Summary
|
||||||
|
|
||||||
|
<!-- What does this PR do? Keep it to 1-3 bullet points. -->
|
||||||
|
|
||||||
|
## Motivation
|
||||||
|
|
||||||
|
<!-- Why is this change needed? Link to an issue if applicable. -->
|
||||||
|
|
||||||
|
## Test plan
|
||||||
|
|
||||||
|
<!-- How did you verify this works? -->
|
||||||
|
|
||||||
|
- [ ] `make test` passes
|
||||||
|
- [ ] Tested on sandbox/staging environment
|
||||||
|
|
||||||
|
## Distributed system impact
|
||||||
|
|
||||||
|
<!-- Does this change affect any of the following? If yes, explain. -->
|
||||||
|
|
||||||
|
- [ ] Raft quorum / RQLite
|
||||||
|
- [ ] WireGuard mesh / networking
|
||||||
|
- [ ] Olric gossip / caching
|
||||||
|
- [ ] Service startup ordering
|
||||||
|
- [ ] Rolling upgrade compatibility
|
||||||
|
|
||||||
|
## Checklist
|
||||||
|
|
||||||
|
- [ ] Tests added for new functionality or bug fix
|
||||||
|
- [ ] No debug code (`fmt.Println`, `log.Println`) left behind
|
||||||
|
- [ ] Docs updated (if user-facing behavior changed)
|
||||||
|
- [ ] Errors wrapped with context (`fmt.Errorf("...: %w", err)`)
|
||||||
3
.github/workflows/release-apt.yml
vendored
3
.github/workflows/release-apt.yml
vendored
@ -46,6 +46,7 @@ jobs:
|
|||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
- name: Build binary
|
- name: Build binary
|
||||||
|
working-directory: core
|
||||||
env:
|
env:
|
||||||
GOARCH: ${{ matrix.arch }}
|
GOARCH: ${{ matrix.arch }}
|
||||||
CGO_ENABLED: 0
|
CGO_ENABLED: 0
|
||||||
@ -71,7 +72,7 @@ jobs:
|
|||||||
mkdir -p ${PKG_NAME}/usr/local/bin
|
mkdir -p ${PKG_NAME}/usr/local/bin
|
||||||
|
|
||||||
# Copy binaries
|
# Copy binaries
|
||||||
cp build/usr/local/bin/* ${PKG_NAME}/usr/local/bin/
|
cp core/build/usr/local/bin/* ${PKG_NAME}/usr/local/bin/
|
||||||
chmod 755 ${PKG_NAME}/usr/local/bin/*
|
chmod 755 ${PKG_NAME}/usr/local/bin/*
|
||||||
|
|
||||||
# Create control file
|
# Create control file
|
||||||
|
|||||||
2
.github/workflows/release.yaml
vendored
2
.github/workflows/release.yaml
vendored
@ -23,7 +23,7 @@ jobs:
|
|||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v4
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: '1.21'
|
go-version: '1.24'
|
||||||
cache: true
|
cache: true
|
||||||
|
|
||||||
- name: Run GoReleaser
|
- name: Run GoReleaser
|
||||||
|
|||||||
149
.gitignore
vendored
149
.gitignore
vendored
@ -1,56 +1,4 @@
|
|||||||
# Binaries
|
# === Global ===
|
||||||
*.exe
|
|
||||||
*.exe~
|
|
||||||
*.dll
|
|
||||||
*.so
|
|
||||||
*.dylib
|
|
||||||
*.test
|
|
||||||
*.out
|
|
||||||
bin/
|
|
||||||
bin-linux/
|
|
||||||
dist/
|
|
||||||
orama-cli-linux
|
|
||||||
|
|
||||||
# Build artifacts
|
|
||||||
*.deb
|
|
||||||
*.rpm
|
|
||||||
*.tar.gz
|
|
||||||
*.zip
|
|
||||||
|
|
||||||
# Go
|
|
||||||
go.work
|
|
||||||
.gocache/
|
|
||||||
|
|
||||||
# Dependencies
|
|
||||||
# vendor/
|
|
||||||
|
|
||||||
# Environment & credentials
|
|
||||||
.env
|
|
||||||
.env.*
|
|
||||||
.env.local
|
|
||||||
.env.*.local
|
|
||||||
scripts/remote-nodes.conf
|
|
||||||
keys_backup/
|
|
||||||
e2e/config.yaml
|
|
||||||
|
|
||||||
# Config (generated/local)
|
|
||||||
configs/
|
|
||||||
|
|
||||||
# Data & databases
|
|
||||||
data/*
|
|
||||||
*.db
|
|
||||||
|
|
||||||
# IDE & editor files
|
|
||||||
.vscode/
|
|
||||||
.idea/
|
|
||||||
.cursor/
|
|
||||||
.claude/
|
|
||||||
.mcp.json
|
|
||||||
*.swp
|
|
||||||
*.swo
|
|
||||||
*~
|
|
||||||
|
|
||||||
# OS generated files
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.DS_Store?
|
.DS_Store?
|
||||||
._*
|
._*
|
||||||
@ -58,39 +6,80 @@ data/*
|
|||||||
.Trashes
|
.Trashes
|
||||||
ehthumbs.db
|
ehthumbs.db
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
*~
|
||||||
|
|
||||||
|
# IDE
|
||||||
|
.vscode/
|
||||||
|
.idea/
|
||||||
|
.cursor/
|
||||||
|
|
||||||
|
# Environment & credentials
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
!.env.example
|
||||||
|
.mcp.json
|
||||||
|
.claude/
|
||||||
|
.codex/
|
||||||
|
|
||||||
|
# === Core (Go) ===
|
||||||
|
core/phantom-auth/
|
||||||
|
core/bin/
|
||||||
|
core/bin-linux/
|
||||||
|
core/dist/
|
||||||
|
core/orama-cli-linux
|
||||||
|
core/keys_backup/
|
||||||
|
core/.gocache/
|
||||||
|
core/configs/
|
||||||
|
core/data/*
|
||||||
|
core/tmp/
|
||||||
|
core/temp/
|
||||||
|
core/results/
|
||||||
|
core/rnd/
|
||||||
|
core/vps.txt
|
||||||
|
core/coverage.txt
|
||||||
|
core/coverage.html
|
||||||
|
core/profile.out
|
||||||
|
core/e2e/config.yaml
|
||||||
|
core/scripts/remote-nodes.conf
|
||||||
|
|
||||||
|
# Go build artifacts
|
||||||
|
*.exe
|
||||||
|
*.exe~
|
||||||
|
*.dll
|
||||||
|
*.so
|
||||||
|
*.dylib
|
||||||
|
*.test
|
||||||
|
*.out
|
||||||
|
*.deb
|
||||||
|
*.rpm
|
||||||
|
*.tar.gz
|
||||||
|
*.zip
|
||||||
|
go.work
|
||||||
|
|
||||||
# Logs
|
# Logs
|
||||||
*.log
|
*.log
|
||||||
|
|
||||||
# Temporary files
|
# Databases
|
||||||
tmp/
|
*.db
|
||||||
temp/
|
|
||||||
*.tmp
|
|
||||||
|
|
||||||
# Coverage & profiling
|
# === Website ===
|
||||||
coverage.txt
|
website/node_modules/
|
||||||
coverage.html
|
website/dist/
|
||||||
profile.out
|
website/invest-api/invest-api
|
||||||
|
website/invest-api/*.db
|
||||||
|
website/invest-api/*.db-shm
|
||||||
|
website/invest-api/*.db-wal
|
||||||
|
|
||||||
# Local development
|
# === Vault (Zig) ===
|
||||||
|
vault/.zig-cache/
|
||||||
|
vault/zig-out/
|
||||||
|
|
||||||
|
# === OS ===
|
||||||
|
os/output/
|
||||||
|
|
||||||
|
# === Local development ===
|
||||||
.dev/
|
.dev/
|
||||||
.local/
|
.local/
|
||||||
local/
|
local/
|
||||||
.codex/
|
|
||||||
results/
|
|
||||||
rnd/
|
|
||||||
vps.txt
|
|
||||||
|
|
||||||
# Project subdirectories (managed separately)
|
|
||||||
website/
|
|
||||||
phantom-auth/
|
|
||||||
|
|
||||||
# One-off scripts & tools
|
|
||||||
redeploy-6.sh
|
|
||||||
terms-agreement
|
|
||||||
./bootstrap
|
|
||||||
./node
|
|
||||||
./cli
|
|
||||||
./inspector
|
|
||||||
docs/later_todos/
|
|
||||||
sim/
|
|
||||||
@ -9,11 +9,13 @@ env:
|
|||||||
|
|
||||||
before:
|
before:
|
||||||
hooks:
|
hooks:
|
||||||
- go mod tidy
|
- cmd: go mod tidy
|
||||||
|
dir: core
|
||||||
|
|
||||||
builds:
|
builds:
|
||||||
# orama CLI binary
|
# orama CLI binary
|
||||||
- id: orama
|
- id: orama
|
||||||
|
dir: core
|
||||||
main: ./cmd/cli
|
main: ./cmd/cli
|
||||||
binary: orama
|
binary: orama
|
||||||
goos:
|
goos:
|
||||||
@ -31,6 +33,7 @@ builds:
|
|||||||
|
|
||||||
# orama-node binary (Linux only for apt)
|
# orama-node binary (Linux only for apt)
|
||||||
- id: orama-node
|
- id: orama-node
|
||||||
|
dir: core
|
||||||
main: ./cmd/node
|
main: ./cmd/node
|
||||||
binary: orama-node
|
binary: orama-node
|
||||||
goos:
|
goos:
|
||||||
@ -84,7 +87,7 @@ nfpms:
|
|||||||
section: utils
|
section: utils
|
||||||
priority: optional
|
priority: optional
|
||||||
contents:
|
contents:
|
||||||
- src: ./README.md
|
- src: ./core/README.md
|
||||||
dst: /usr/share/doc/orama/README.md
|
dst: /usr/share/doc/orama/README.md
|
||||||
deb:
|
deb:
|
||||||
lintian_overrides:
|
lintian_overrides:
|
||||||
@ -106,7 +109,7 @@ nfpms:
|
|||||||
section: net
|
section: net
|
||||||
priority: optional
|
priority: optional
|
||||||
contents:
|
contents:
|
||||||
- src: ./README.md
|
- src: ./core/README.md
|
||||||
dst: /usr/share/doc/orama-node/README.md
|
dst: /usr/share/doc/orama-node/README.md
|
||||||
deb:
|
deb:
|
||||||
lintian_overrides:
|
lintian_overrides:
|
||||||
|
|||||||
@ -1,47 +1,78 @@
|
|||||||
# Contributing to DeBros Network
|
# Contributing to Orama Network
|
||||||
|
|
||||||
Thanks for helping improve the network! This guide covers setup, local dev, tests, and PR guidelines.
|
Thanks for helping improve the network! This monorepo contains multiple projects — pick the one relevant to your contribution.
|
||||||
|
|
||||||
## Requirements
|
## Repository Structure
|
||||||
|
|
||||||
- Go 1.22+ (1.23 recommended)
|
| Package | Language | Build |
|
||||||
- RQLite (optional for local runs; the Makefile starts nodes with embedded setup)
|
|---------|----------|-------|
|
||||||
- Make (optional)
|
| `core/` | Go 1.24+ | `make core-build` |
|
||||||
|
| `website/` | TypeScript (pnpm) | `make website-build` |
|
||||||
|
| `vault/` | Zig 0.14+ | `make vault-build` |
|
||||||
|
| `os/` | Go + Buildroot | `make os-build` |
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/DeBrosOfficial/network.git
|
git clone https://github.com/DeBrosOfficial/network.git
|
||||||
cd network
|
cd network
|
||||||
make deps
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Build, Test, Lint
|
### Core (Go)
|
||||||
|
|
||||||
- Build: `make build`
|
|
||||||
- Test: `make test`
|
|
||||||
- Format/Vet: `make fmt vet` (or `make lint`)
|
|
||||||
|
|
||||||
````
|
|
||||||
|
|
||||||
Useful CLI commands:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./bin/orama health
|
cd core
|
||||||
./bin/orama peers
|
make deps
|
||||||
./bin/orama status
|
make build
|
||||||
````
|
make test
|
||||||
|
```
|
||||||
|
|
||||||
## Versioning
|
### Website
|
||||||
|
|
||||||
- The CLI reports its version via `orama version`.
|
```bash
|
||||||
- Releases are tagged (e.g., `v0.18.0-beta`) and published via GoReleaser.
|
cd website
|
||||||
|
pnpm install
|
||||||
|
pnpm dev
|
||||||
|
```
|
||||||
|
|
||||||
|
### Vault (Zig)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd vault
|
||||||
|
zig build
|
||||||
|
zig build test
|
||||||
|
```
|
||||||
|
|
||||||
## Pull Requests
|
## Pull Requests
|
||||||
|
|
||||||
1. Fork and create a topic branch.
|
1. Fork and create a topic branch from `main`.
|
||||||
2. Ensure `make build test` passes; include tests for new functionality.
|
2. Ensure `make test` passes for affected packages.
|
||||||
3. Keep PRs focused and well-described (motivation, approach, testing).
|
3. Include tests for new functionality or bug fixes.
|
||||||
4. Update README/docs for behavior changes.
|
4. Keep PRs focused — one concern per PR.
|
||||||
|
5. Write a clear description: motivation, approach, and how you tested it.
|
||||||
|
6. Update docs if you're changing user-facing behavior.
|
||||||
|
|
||||||
|
## Code Style
|
||||||
|
|
||||||
|
### Go (core/, os/)
|
||||||
|
|
||||||
|
- Follow standard Go conventions
|
||||||
|
- Run `make lint` before submitting
|
||||||
|
- Wrap errors with context: `fmt.Errorf("failed to X: %w", err)`
|
||||||
|
- No magic values — use named constants
|
||||||
|
|
||||||
|
### TypeScript (website/)
|
||||||
|
|
||||||
|
- TypeScript strict mode
|
||||||
|
- Follow existing patterns in the codebase
|
||||||
|
|
||||||
|
### Zig (vault/)
|
||||||
|
|
||||||
|
- Follow standard Zig conventions
|
||||||
|
- Run `zig build test` before submitting
|
||||||
|
|
||||||
|
## Security
|
||||||
|
|
||||||
|
If you find a security vulnerability, **do not open a public issue**. Email security@debros.io instead.
|
||||||
|
|
||||||
Thank you for contributing!
|
Thank you for contributing!
|
||||||
|
|||||||
200
Makefile
200
Makefile
@ -1,176 +1,56 @@
|
|||||||
TEST?=./...
|
# Orama Monorepo
|
||||||
|
# Delegates to sub-project Makefiles
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: help build test clean
|
||||||
test:
|
|
||||||
@echo Running tests...
|
|
||||||
go test -v $(TEST)
|
|
||||||
|
|
||||||
# Gateway-focused E2E tests assume gateway and nodes are already running
|
# === Core (Go network) ===
|
||||||
# Auto-discovers configuration from ~/.orama and queries database for API key
|
.PHONY: core core-build core-test core-clean core-lint
|
||||||
# No environment variables required
|
core: core-build
|
||||||
.PHONY: test-e2e test-e2e-deployments test-e2e-fullstack test-e2e-https test-e2e-quick test-e2e-prod test-e2e-shared test-e2e-cluster test-e2e-integration test-e2e-production
|
|
||||||
|
|
||||||
# Production E2E tests - includes production-only tests
|
core-build:
|
||||||
test-e2e-prod:
|
$(MAKE) -C core build
|
||||||
@if [ -z "$$ORAMA_GATEWAY_URL" ]; then \
|
|
||||||
echo "❌ ORAMA_GATEWAY_URL not set"; \
|
|
||||||
echo "Usage: ORAMA_GATEWAY_URL=https://dbrs.space make test-e2e-prod"; \
|
|
||||||
exit 1; \
|
|
||||||
fi
|
|
||||||
@echo "Running E2E tests (including production-only) against $$ORAMA_GATEWAY_URL..."
|
|
||||||
go test -v -tags "e2e production" -timeout 30m ./e2e/...
|
|
||||||
|
|
||||||
# Generic e2e target
|
core-test:
|
||||||
test-e2e:
|
$(MAKE) -C core test
|
||||||
@echo "Running comprehensive E2E tests..."
|
|
||||||
@echo "Auto-discovering configuration from ~/.orama..."
|
|
||||||
go test -v -tags e2e -timeout 30m ./e2e/...
|
|
||||||
|
|
||||||
test-e2e-deployments:
|
core-lint:
|
||||||
@echo "Running deployment E2E tests..."
|
$(MAKE) -C core lint
|
||||||
go test -v -tags e2e -timeout 15m ./e2e/deployments/...
|
|
||||||
|
|
||||||
test-e2e-fullstack:
|
core-clean:
|
||||||
@echo "Running fullstack E2E tests..."
|
$(MAKE) -C core clean
|
||||||
go test -v -tags e2e -timeout 20m -run "TestFullStack" ./e2e/...
|
|
||||||
|
|
||||||
test-e2e-https:
|
# === Website ===
|
||||||
@echo "Running HTTPS/external access E2E tests..."
|
.PHONY: website website-dev website-build
|
||||||
go test -v -tags e2e -timeout 10m -run "TestHTTPS" ./e2e/...
|
website-dev:
|
||||||
|
cd website && pnpm dev
|
||||||
|
|
||||||
test-e2e-shared:
|
website-build:
|
||||||
@echo "Running shared E2E tests..."
|
cd website && pnpm build
|
||||||
go test -v -tags e2e -timeout 10m ./e2e/shared/...
|
|
||||||
|
|
||||||
test-e2e-cluster:
|
# === Vault (Zig) ===
|
||||||
@echo "Running cluster E2E tests..."
|
.PHONY: vault vault-build vault-test
|
||||||
go test -v -tags e2e -timeout 15m ./e2e/cluster/...
|
vault-build:
|
||||||
|
cd vault && zig build
|
||||||
|
|
||||||
test-e2e-integration:
|
vault-test:
|
||||||
@echo "Running integration E2E tests..."
|
cd vault && zig build test
|
||||||
go test -v -tags e2e -timeout 20m ./e2e/integration/...
|
|
||||||
|
|
||||||
test-e2e-production:
|
# === OS ===
|
||||||
@echo "Running production-only E2E tests..."
|
.PHONY: os os-build
|
||||||
go test -v -tags "e2e production" -timeout 15m ./e2e/production/...
|
os-build:
|
||||||
|
$(MAKE) -C os
|
||||||
|
|
||||||
test-e2e-quick:
|
# === Aggregate ===
|
||||||
@echo "Running quick E2E smoke tests..."
|
build: core-build
|
||||||
go test -v -tags e2e -timeout 5m -run "TestStatic|TestHealth" ./e2e/...
|
test: core-test
|
||||||
|
clean: core-clean
|
||||||
|
|
||||||
# Network - Distributed P2P Database System
|
|
||||||
# Makefile for development and build tasks
|
|
||||||
|
|
||||||
.PHONY: build clean test deps tidy fmt vet lint install-hooks push-devnet push-testnet rollout-devnet rollout-testnet release
|
|
||||||
|
|
||||||
VERSION := 0.115.0
|
|
||||||
COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo unknown)
|
|
||||||
DATE ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
|
|
||||||
LDFLAGS := -X 'main.version=$(VERSION)' -X 'main.commit=$(COMMIT)' -X 'main.date=$(DATE)'
|
|
||||||
LDFLAGS_LINUX := -s -w $(LDFLAGS)
|
|
||||||
|
|
||||||
# Build targets
|
|
||||||
build: deps
|
|
||||||
@echo "Building network executables (version=$(VERSION))..."
|
|
||||||
@mkdir -p bin
|
|
||||||
go build -ldflags "$(LDFLAGS)" -o bin/identity ./cmd/identity
|
|
||||||
go build -ldflags "$(LDFLAGS)" -o bin/orama-node ./cmd/node
|
|
||||||
go build -ldflags "$(LDFLAGS)" -o bin/orama ./cmd/cli/
|
|
||||||
# Inject gateway build metadata via pkg path variables
|
|
||||||
go build -ldflags "$(LDFLAGS) -X 'github.com/DeBrosOfficial/network/pkg/gateway.BuildVersion=$(VERSION)' -X 'github.com/DeBrosOfficial/network/pkg/gateway.BuildCommit=$(COMMIT)' -X 'github.com/DeBrosOfficial/network/pkg/gateway.BuildTime=$(DATE)'" -o bin/gateway ./cmd/gateway
|
|
||||||
go build -ldflags "$(LDFLAGS)" -o bin/sfu ./cmd/sfu
|
|
||||||
go build -ldflags "$(LDFLAGS)" -o bin/turn ./cmd/turn
|
|
||||||
@echo "Build complete! Run ./bin/orama version"
|
|
||||||
|
|
||||||
# Cross-compile CLI for Linux (only binary needed locally; VPS builds everything else from source)
|
|
||||||
build-linux: deps
|
|
||||||
@echo "Cross-compiling CLI for linux/amd64 (version=$(VERSION))..."
|
|
||||||
@mkdir -p bin-linux
|
|
||||||
GOOS=linux GOARCH=amd64 go build -ldflags "$(LDFLAGS_LINUX)" -trimpath -o bin-linux/orama ./cmd/cli/
|
|
||||||
@echo "✓ CLI built at bin-linux/orama"
|
|
||||||
@echo ""
|
|
||||||
@echo "Prefer 'make build-archive' for full pre-built binary archive."
|
|
||||||
|
|
||||||
# Build pre-compiled binary archive for deployment (all binaries + deps)
|
|
||||||
build-archive: deps
|
|
||||||
@echo "Building binary archive (version=$(VERSION))..."
|
|
||||||
go build -ldflags "$(LDFLAGS)" -o bin/orama ./cmd/cli/
|
|
||||||
./bin/orama build --output /tmp/orama-$(VERSION)-linux-amd64.tar.gz
|
|
||||||
|
|
||||||
# Install git hooks
|
|
||||||
install-hooks:
|
|
||||||
@echo "Installing git hooks..."
|
|
||||||
@bash scripts/install-hooks.sh
|
|
||||||
|
|
||||||
# Clean build artifacts
|
|
||||||
clean:
|
|
||||||
@echo "Cleaning build artifacts..."
|
|
||||||
rm -rf bin/
|
|
||||||
rm -rf data/
|
|
||||||
@echo "Clean complete!"
|
|
||||||
|
|
||||||
# Push binary archive to devnet nodes (fanout distribution)
|
|
||||||
push-devnet:
|
|
||||||
./bin/orama node push --env devnet
|
|
||||||
|
|
||||||
# Push binary archive to testnet nodes (fanout distribution)
|
|
||||||
push-testnet:
|
|
||||||
./bin/orama node push --env testnet
|
|
||||||
|
|
||||||
# Full rollout to devnet (build + push + rolling upgrade)
|
|
||||||
rollout-devnet:
|
|
||||||
./bin/orama node rollout --env devnet --yes
|
|
||||||
|
|
||||||
# Full rollout to testnet (build + push + rolling upgrade)
|
|
||||||
rollout-testnet:
|
|
||||||
./bin/orama node rollout --env testnet --yes
|
|
||||||
|
|
||||||
# Interactive release workflow (tag + push)
|
|
||||||
release:
|
|
||||||
@bash scripts/release.sh
|
|
||||||
|
|
||||||
# Check health of all nodes in an environment
|
|
||||||
# Usage: make health ENV=devnet
|
|
||||||
health:
|
|
||||||
@if [ -z "$(ENV)" ]; then \
|
|
||||||
echo "Usage: make health ENV=devnet|testnet"; \
|
|
||||||
exit 1; \
|
|
||||||
fi
|
|
||||||
./bin/orama monitor report --env $(ENV)
|
|
||||||
|
|
||||||
# Help
|
|
||||||
help:
|
help:
|
||||||
@echo "Available targets:"
|
@echo "Orama Monorepo"
|
||||||
@echo " build - Build all executables"
|
|
||||||
@echo " clean - Clean build artifacts"
|
|
||||||
@echo " test - Run unit tests"
|
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "E2E Testing:"
|
@echo " Core (Go): make core-build | core-test | core-lint | core-clean"
|
||||||
@echo " make test-e2e-prod - Run all E2E tests incl. production-only (needs ORAMA_GATEWAY_URL)"
|
@echo " Website: make website-dev | website-build"
|
||||||
@echo " make test-e2e-shared - Run shared E2E tests (cache, storage, pubsub, auth)"
|
@echo " Vault (Zig): make vault-build | vault-test"
|
||||||
@echo " make test-e2e-cluster - Run cluster E2E tests (libp2p, olric, rqlite, namespace)"
|
@echo " OS: make os-build"
|
||||||
@echo " make test-e2e-integration - Run integration E2E tests (fullstack, persistence, concurrency)"
|
|
||||||
@echo " make test-e2e-deployments - Run deployment E2E tests"
|
|
||||||
@echo " make test-e2e-production - Run production-only E2E tests (DNS, HTTPS, cross-node)"
|
|
||||||
@echo " make test-e2e-quick - Quick smoke tests (static deploys, health checks)"
|
|
||||||
@echo " make test-e2e - Generic E2E tests (auto-discovers config)"
|
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo " Example:"
|
@echo " Aggregate: make build | test | clean (delegates to core)"
|
||||||
@echo " ORAMA_GATEWAY_URL=https://orama-devnet.network make test-e2e-prod"
|
|
||||||
@echo ""
|
|
||||||
@echo "Deployment:"
|
|
||||||
@echo " make build-archive - Build pre-compiled binary archive for deployment"
|
|
||||||
@echo " make push-devnet - Push binary archive to devnet nodes"
|
|
||||||
@echo " make push-testnet - Push binary archive to testnet nodes"
|
|
||||||
@echo " make rollout-devnet - Full rollout: build + push + rolling upgrade (devnet)"
|
|
||||||
@echo " make rollout-testnet - Full rollout: build + push + rolling upgrade (testnet)"
|
|
||||||
@echo " make health ENV=devnet - Check health of all nodes in an environment"
|
|
||||||
@echo " make release - Interactive release workflow (tag + push)"
|
|
||||||
@echo ""
|
|
||||||
@echo "Maintenance:"
|
|
||||||
@echo " deps - Download dependencies"
|
|
||||||
@echo " tidy - Tidy dependencies"
|
|
||||||
@echo " fmt - Format code"
|
|
||||||
@echo " vet - Vet code"
|
|
||||||
@echo " lint - Lint code (fmt + vet)"
|
|
||||||
@echo " help - Show this help"
|
|
||||||
|
|||||||
484
README.md
484
README.md
@ -1,465 +1,49 @@
|
|||||||
# Orama Network - Distributed P2P Platform
|
# Orama Network
|
||||||
|
|
||||||
A high-performance API Gateway and distributed platform built in Go. Provides a unified HTTP/HTTPS API for distributed SQL (RQLite), distributed caching (Olric), decentralized storage (IPFS), pub/sub messaging, and serverless WebAssembly execution.
|
A decentralized infrastructure platform combining distributed SQL, IPFS storage, caching, serverless WASM execution, and privacy relay — all managed through a unified API gateway.
|
||||||
|
|
||||||
**Architecture:** Modular Gateway / Edge Proxy following SOLID principles
|
## Packages
|
||||||
|
|
||||||
## Features
|
| Package | Language | Description |
|
||||||
|
|---------|----------|-------------|
|
||||||
- **🔐 Authentication** - Wallet signatures, API keys, JWT tokens
|
| [core/](core/) | Go | API gateway, distributed node, CLI, and client SDK |
|
||||||
- **💾 Storage** - IPFS-based decentralized file storage with encryption
|
| [website/](website/) | TypeScript | Marketing website and invest portal |
|
||||||
- **⚡ Cache** - Distributed cache with Olric (in-memory key-value)
|
| [vault/](vault/) | Zig | Distributed secrets vault (Shamir's Secret Sharing) |
|
||||||
- **🗄️ Database** - RQLite distributed SQL with Raft consensus + Per-namespace SQLite databases
|
| [os/](os/) | Go + Buildroot | OramaOS — hardened minimal Linux for network nodes |
|
||||||
- **📡 Pub/Sub** - Real-time messaging via LibP2P and WebSocket
|
|
||||||
- **⚙️ Serverless** - WebAssembly function execution with host functions
|
|
||||||
- **🌐 HTTP Gateway** - Unified REST API with automatic HTTPS (Let's Encrypt)
|
|
||||||
- **📦 Client SDK** - Type-safe Go SDK for all services
|
|
||||||
- **🚀 App Deployments** - Deploy React, Next.js, Go, Node.js apps with automatic domains
|
|
||||||
- **🗄️ SQLite Databases** - Per-namespace isolated databases with IPFS backups
|
|
||||||
|
|
||||||
## Application Deployments
|
|
||||||
|
|
||||||
Deploy full-stack applications with automatic domain assignment and namespace isolation.
|
|
||||||
|
|
||||||
### Deploy a React App
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Build your app
|
|
||||||
cd my-react-app
|
|
||||||
npm run build
|
|
||||||
|
|
||||||
# Deploy to Orama Network
|
|
||||||
orama deploy static ./dist --name my-app
|
|
||||||
|
|
||||||
# Your app is now live at: https://my-app.orama.network
|
|
||||||
```
|
|
||||||
|
|
||||||
### Deploy Next.js with SSR
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd my-nextjs-app
|
|
||||||
|
|
||||||
# Ensure next.config.js has: output: 'standalone'
|
|
||||||
npm run build
|
|
||||||
orama deploy nextjs . --name my-nextjs --ssr
|
|
||||||
|
|
||||||
# Live at: https://my-nextjs.orama.network
|
|
||||||
```
|
|
||||||
|
|
||||||
### Deploy Go Backend
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Build for Linux (name binary 'app' for auto-detection)
|
|
||||||
GOOS=linux GOARCH=amd64 go build -o app main.go
|
|
||||||
|
|
||||||
# Deploy (must implement /health endpoint)
|
|
||||||
orama deploy go ./app --name my-api
|
|
||||||
|
|
||||||
# API live at: https://my-api.orama.network
|
|
||||||
```
|
|
||||||
|
|
||||||
### Create SQLite Database
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Create database
|
|
||||||
orama db create my-database
|
|
||||||
|
|
||||||
# Create schema
|
|
||||||
orama db query my-database "CREATE TABLE users (id INT, name TEXT)"
|
|
||||||
|
|
||||||
# Insert data
|
|
||||||
orama db query my-database "INSERT INTO users VALUES (1, 'Alice')"
|
|
||||||
|
|
||||||
# Query data
|
|
||||||
orama db query my-database "SELECT * FROM users"
|
|
||||||
|
|
||||||
# Backup to IPFS
|
|
||||||
orama db backup my-database
|
|
||||||
```
|
|
||||||
|
|
||||||
### Full-Stack Example
|
|
||||||
|
|
||||||
Deploy a complete app with React frontend, Go backend, and SQLite database:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# 1. Create database
|
|
||||||
orama db create myapp-db
|
|
||||||
orama db query myapp-db "CREATE TABLE users (id INT PRIMARY KEY, name TEXT)"
|
|
||||||
|
|
||||||
# 2. Deploy Go backend (connects to database)
|
|
||||||
GOOS=linux GOARCH=amd64 go build -o api main.go
|
|
||||||
orama deploy go ./api --name myapp-api
|
|
||||||
|
|
||||||
# 3. Deploy React frontend (calls backend API)
|
|
||||||
cd frontend && npm run build
|
|
||||||
orama deploy static ./dist --name myapp
|
|
||||||
|
|
||||||
# Access:
|
|
||||||
# Frontend: https://myapp.orama.network
|
|
||||||
# Backend: https://myapp-api.orama.network
|
|
||||||
```
|
|
||||||
|
|
||||||
**📖 Full Guide**: See [Deployment Guide](docs/DEPLOYMENT_GUIDE.md) for complete documentation, examples, and best practices.
|
|
||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
### Building
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Build all binaries
|
# Build the core network binaries
|
||||||
make build
|
make core-build
|
||||||
|
|
||||||
|
# Run tests
|
||||||
|
make core-test
|
||||||
|
|
||||||
|
# Start website dev server
|
||||||
|
make website-dev
|
||||||
|
|
||||||
|
# Build vault
|
||||||
|
make vault-build
|
||||||
```
|
```
|
||||||
|
|
||||||
## CLI Commands
|
|
||||||
|
|
||||||
### Authentication
|
|
||||||
|
|
||||||
```bash
|
|
||||||
orama auth login # Authenticate with wallet
|
|
||||||
orama auth status # Check authentication
|
|
||||||
orama auth logout # Clear credentials
|
|
||||||
```
|
|
||||||
|
|
||||||
### Application Deployments
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Deploy applications
|
|
||||||
orama deploy static <path> --name myapp # React, Vue, static sites
|
|
||||||
orama deploy nextjs <path> --name myapp --ssr # Next.js with SSR (requires output: 'standalone')
|
|
||||||
orama deploy go <path> --name myapp # Go binaries (must have /health endpoint)
|
|
||||||
orama deploy nodejs <path> --name myapp # Node.js apps (must have /health endpoint)
|
|
||||||
|
|
||||||
# Manage deployments
|
|
||||||
orama app list # List all deployments
|
|
||||||
orama app get <name> # Get deployment details
|
|
||||||
orama app logs <name> --follow # View logs
|
|
||||||
orama app delete <name> # Delete deployment
|
|
||||||
orama app rollback <name> --version 1 # Rollback to version
|
|
||||||
```
|
|
||||||
|
|
||||||
### SQLite Databases
|
|
||||||
|
|
||||||
```bash
|
|
||||||
orama db create <name> # Create database
|
|
||||||
orama db query <name> "SELECT * FROM t" # Execute SQL query
|
|
||||||
orama db list # List all databases
|
|
||||||
orama db backup <name> # Backup to IPFS
|
|
||||||
orama db backups <name> # List backups
|
|
||||||
```
|
|
||||||
|
|
||||||
### Environment Management
|
|
||||||
|
|
||||||
```bash
|
|
||||||
orama env list # List available environments
|
|
||||||
orama env current # Show active environment
|
|
||||||
orama env use <name> # Switch environment
|
|
||||||
```
|
|
||||||
|
|
||||||
## Serverless Functions (WASM)
|
|
||||||
|
|
||||||
Orama supports high-performance serverless function execution using WebAssembly (WASM). Functions are isolated, secure, and can interact with network services like the distributed cache.
|
|
||||||
|
|
||||||
> **Full guide:** See [docs/SERVERLESS.md](docs/SERVERLESS.md) for host functions API, secrets management, PubSub triggers, and examples.
|
|
||||||
|
|
||||||
### 1. Build Functions
|
|
||||||
|
|
||||||
Functions must be compiled to WASM. We recommend using [TinyGo](https://tinygo.org/).
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Build example functions to examples/functions/bin/
|
|
||||||
./examples/functions/build.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
### 2. Deployment
|
|
||||||
|
|
||||||
Deploy your compiled `.wasm` file to the network via the Gateway.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Deploy a function
|
|
||||||
curl -X POST https://your-node.example.com/v1/functions \
|
|
||||||
-H "Authorization: Bearer <your_api_key>" \
|
|
||||||
-F "name=hello-world" \
|
|
||||||
-F "namespace=default" \
|
|
||||||
-F "wasm=@./examples/functions/bin/hello.wasm"
|
|
||||||
```
|
|
||||||
|
|
||||||
### 3. Invocation
|
|
||||||
|
|
||||||
Trigger your function with a JSON payload. The function receives the payload via `stdin` and returns its response via `stdout`.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Invoke via HTTP
|
|
||||||
curl -X POST https://your-node.example.com/v1/functions/hello-world/invoke \
|
|
||||||
-H "Authorization: Bearer <your_api_key>" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d '{"name": "Developer"}'
|
|
||||||
```
|
|
||||||
|
|
||||||
### 4. Management
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# List all functions in a namespace
|
|
||||||
curl https://your-node.example.com/v1/functions?namespace=default
|
|
||||||
|
|
||||||
# Delete a function
|
|
||||||
curl -X DELETE https://your-node.example.com/v1/functions/hello-world?namespace=default
|
|
||||||
```
|
|
||||||
|
|
||||||
## Production Deployment
|
|
||||||
|
|
||||||
### Prerequisites
|
|
||||||
|
|
||||||
- Ubuntu 22.04+ or Debian 12+
|
|
||||||
- `amd64` or `arm64` architecture
|
|
||||||
- 4GB RAM, 50GB SSD, 2 CPU cores
|
|
||||||
|
|
||||||
### Required Ports
|
|
||||||
|
|
||||||
**External (must be open in firewall):**
|
|
||||||
|
|
||||||
- **80** - HTTP (ACME/Let's Encrypt certificate challenges)
|
|
||||||
- **443** - HTTPS (Main gateway API endpoint)
|
|
||||||
- **4101** - IPFS Swarm (peer connections)
|
|
||||||
- **7001** - RQLite Raft (cluster consensus)
|
|
||||||
|
|
||||||
**Internal (bound to localhost, no firewall needed):**
|
|
||||||
|
|
||||||
- 4501 - IPFS API
|
|
||||||
- 5001 - RQLite HTTP API
|
|
||||||
- 6001 - Unified Gateway
|
|
||||||
- 8080 - IPFS Gateway
|
|
||||||
- 9050 - Anyone SOCKS5 proxy
|
|
||||||
- 9094 - IPFS Cluster API
|
|
||||||
- 3320/3322 - Olric Cache
|
|
||||||
|
|
||||||
**Anyone Relay Mode (optional, for earning rewards):**
|
|
||||||
|
|
||||||
- 9001 - Anyone ORPort (relay traffic, must be open externally)
|
|
||||||
|
|
||||||
### Anyone Network Integration
|
|
||||||
|
|
||||||
Orama Network integrates with the [Anyone Protocol](https://anyone.io) for anonymous routing. By default, nodes run as **clients** (consuming the network). Optionally, you can run as a **relay operator** to earn rewards.
|
|
||||||
|
|
||||||
**Client Mode (Default):**
|
|
||||||
- Routes traffic through Anyone network for anonymity
|
|
||||||
- SOCKS5 proxy on localhost:9050
|
|
||||||
- No rewards, just consumes network
|
|
||||||
|
|
||||||
**Relay Mode (Earn Rewards):**
|
|
||||||
- Provide bandwidth to the Anyone network
|
|
||||||
- Earn $ANYONE tokens as a relay operator
|
|
||||||
- Requires 100 $ANYONE tokens in your wallet
|
|
||||||
- Requires ORPort (9001) open to the internet
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Install as relay operator (earn rewards)
|
|
||||||
sudo orama node install --vps-ip <IP> --domain <domain> \
|
|
||||||
--anyone-relay \
|
|
||||||
--anyone-nickname "MyRelay" \
|
|
||||||
--anyone-contact "operator@email.com" \
|
|
||||||
--anyone-wallet "0x1234...abcd"
|
|
||||||
|
|
||||||
# With exit relay (legal implications apply)
|
|
||||||
sudo orama node install --vps-ip <IP> --domain <domain> \
|
|
||||||
--anyone-relay \
|
|
||||||
--anyone-exit \
|
|
||||||
--anyone-nickname "MyExitRelay" \
|
|
||||||
--anyone-contact "operator@email.com" \
|
|
||||||
--anyone-wallet "0x1234...abcd"
|
|
||||||
|
|
||||||
# Migrate existing Anyone installation
|
|
||||||
sudo orama node install --vps-ip <IP> --domain <domain> \
|
|
||||||
--anyone-relay \
|
|
||||||
--anyone-migrate \
|
|
||||||
--anyone-nickname "MyRelay" \
|
|
||||||
--anyone-contact "operator@email.com" \
|
|
||||||
--anyone-wallet "0x1234...abcd"
|
|
||||||
```
|
|
||||||
|
|
||||||
**Important:** After installation, register your relay at [dashboard.anyone.io](https://dashboard.anyone.io) to start earning rewards.
|
|
||||||
|
|
||||||
### Installation
|
|
||||||
|
|
||||||
**macOS (Homebrew):**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
brew install DeBrosOfficial/tap/orama
|
|
||||||
```
|
|
||||||
|
|
||||||
**Linux (Debian/Ubuntu):**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Download and install the latest .deb package
|
|
||||||
curl -sL https://github.com/DeBrosOfficial/network/releases/latest/download/orama_$(curl -s https://api.github.com/repos/DeBrosOfficial/network/releases/latest | grep tag_name | cut -d '"' -f 4 | tr -d 'v')_linux_amd64.deb -o orama.deb
|
|
||||||
sudo dpkg -i orama.deb
|
|
||||||
```
|
|
||||||
|
|
||||||
**From Source:**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
go install github.com/DeBrosOfficial/network/cmd/cli@latest
|
|
||||||
```
|
|
||||||
|
|
||||||
**Setup (after installation):**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo orama node install --interactive
|
|
||||||
```
|
|
||||||
|
|
||||||
### Service Management
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Status
|
|
||||||
sudo orama node status
|
|
||||||
|
|
||||||
# Control services
|
|
||||||
sudo orama node start
|
|
||||||
sudo orama node stop
|
|
||||||
sudo orama node restart
|
|
||||||
|
|
||||||
# Diagnose issues
|
|
||||||
sudo orama node doctor
|
|
||||||
|
|
||||||
# View logs
|
|
||||||
orama node logs node --follow
|
|
||||||
orama node logs gateway --follow
|
|
||||||
orama node logs ipfs --follow
|
|
||||||
```
|
|
||||||
|
|
||||||
### Upgrade
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Upgrade to latest version
|
|
||||||
sudo orama node upgrade --restart
|
|
||||||
```
|
|
||||||
|
|
||||||
## Configuration
|
|
||||||
|
|
||||||
All configuration lives in `~/.orama/`:
|
|
||||||
|
|
||||||
- `configs/node.yaml` - Node configuration
|
|
||||||
- `configs/gateway.yaml` - Gateway configuration
|
|
||||||
- `configs/olric.yaml` - Cache configuration
|
|
||||||
- `secrets/` - Keys and certificates
|
|
||||||
- `data/` - Service data directories
|
|
||||||
|
|
||||||
## Troubleshooting
|
|
||||||
|
|
||||||
### Services Not Starting
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Check status
|
|
||||||
sudo orama node status
|
|
||||||
|
|
||||||
# View logs
|
|
||||||
orama node logs node --follow
|
|
||||||
|
|
||||||
# Check log files
|
|
||||||
sudo orama node doctor
|
|
||||||
```
|
|
||||||
|
|
||||||
### Port Conflicts
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Check what's using specific ports
|
|
||||||
sudo lsof -i :443 # HTTPS Gateway
|
|
||||||
sudo lsof -i :7001 # TCP/SNI Gateway
|
|
||||||
sudo lsof -i :6001 # Internal Gateway
|
|
||||||
```
|
|
||||||
|
|
||||||
### RQLite Cluster Issues
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Connect to RQLite CLI
|
|
||||||
rqlite -H localhost -p 5001
|
|
||||||
|
|
||||||
# Check cluster status
|
|
||||||
.nodes
|
|
||||||
.status
|
|
||||||
.ready
|
|
||||||
|
|
||||||
# Check consistency level
|
|
||||||
.consistency
|
|
||||||
```
|
|
||||||
|
|
||||||
### Reset Installation
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Production reset (⚠️ DESTROYS DATA)
|
|
||||||
sudo orama node uninstall
|
|
||||||
sudo rm -rf /opt/orama/.orama
|
|
||||||
sudo orama node install
|
|
||||||
```
|
|
||||||
|
|
||||||
## HTTP Gateway API
|
|
||||||
|
|
||||||
### Main Gateway Endpoints
|
|
||||||
|
|
||||||
- `GET /health` - Health status
|
|
||||||
- `GET /v1/status` - Full status
|
|
||||||
- `GET /v1/version` - Version info
|
|
||||||
- `POST /v1/rqlite/exec` - Execute SQL
|
|
||||||
- `POST /v1/rqlite/query` - Query database
|
|
||||||
- `GET /v1/rqlite/schema` - Get schema
|
|
||||||
- `POST /v1/pubsub/publish` - Publish message
|
|
||||||
- `GET /v1/pubsub/topics` - List topics
|
|
||||||
- `GET /v1/pubsub/ws?topic=<name>` - WebSocket subscribe
|
|
||||||
- `POST /v1/functions` - Deploy function (multipart/form-data)
|
|
||||||
- `POST /v1/functions/{name}/invoke` - Invoke function
|
|
||||||
- `GET /v1/functions` - List functions
|
|
||||||
- `DELETE /v1/functions/{name}` - Delete function
|
|
||||||
- `GET /v1/functions/{name}/logs` - Get function logs
|
|
||||||
|
|
||||||
See `openapi/gateway.yaml` for complete API specification.
|
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
- **[Deployment Guide](docs/DEPLOYMENT_GUIDE.md)** - Deploy React, Next.js, Go apps and manage databases
|
| Document | Description |
|
||||||
- **[Architecture Guide](docs/ARCHITECTURE.md)** - System architecture and design patterns
|
|----------|-------------|
|
||||||
- **[Client SDK](docs/CLIENT_SDK.md)** - Go SDK documentation and examples
|
| [Architecture](core/docs/ARCHITECTURE.md) | System architecture and design patterns |
|
||||||
- **[Monitoring](docs/MONITORING.md)** - Cluster monitoring and health checks
|
| [Deployment Guide](core/docs/DEPLOYMENT_GUIDE.md) | Deploy apps, databases, and domains |
|
||||||
- **[Inspector](docs/INSPECTOR.md)** - Deep subsystem health inspection
|
| [Dev & Deploy](core/docs/DEV_DEPLOY.md) | Building, deploying to VPS, rolling upgrades |
|
||||||
- **[Serverless Functions](docs/SERVERLESS.md)** - WASM serverless with host functions
|
| [Security](core/docs/SECURITY.md) | Security hardening and threat model |
|
||||||
- **[WebRTC](docs/WEBRTC.md)** - Real-time communication setup
|
| [Monitoring](core/docs/MONITORING.md) | Cluster health monitoring |
|
||||||
- **[Common Problems](docs/COMMON_PROBLEMS.md)** - Troubleshooting known issues
|
| [Client SDK](core/docs/CLIENT_SDK.md) | Go SDK documentation |
|
||||||
|
| [Serverless](core/docs/SERVERLESS.md) | WASM serverless functions |
|
||||||
## Resources
|
| [Common Problems](core/docs/COMMON_PROBLEMS.md) | Troubleshooting known issues |
|
||||||
|
|
||||||
- [RQLite Documentation](https://rqlite.io/docs/)
|
|
||||||
- [IPFS Documentation](https://docs.ipfs.tech/)
|
|
||||||
- [LibP2P Documentation](https://docs.libp2p.io/)
|
|
||||||
- [WebAssembly](https://webassembly.org/)
|
|
||||||
- [GitHub Repository](https://github.com/DeBrosOfficial/network)
|
|
||||||
- [Issue Tracker](https://github.com/DeBrosOfficial/network/issues)
|
|
||||||
|
|
||||||
## Project Structure
|
|
||||||
|
|
||||||
```
|
|
||||||
network/
|
|
||||||
├── cmd/ # Binary entry points
|
|
||||||
│ ├── cli/ # CLI tool
|
|
||||||
│ ├── gateway/ # HTTP Gateway
|
|
||||||
│ ├── node/ # P2P Node
|
|
||||||
├── pkg/ # Core packages
|
|
||||||
│ ├── gateway/ # Gateway implementation
|
|
||||||
│ │ └── handlers/ # HTTP handlers by domain
|
|
||||||
│ ├── client/ # Go SDK
|
|
||||||
│ ├── serverless/ # WASM engine
|
|
||||||
│ ├── rqlite/ # Database ORM
|
|
||||||
│ ├── contracts/ # Interface definitions
|
|
||||||
│ ├── httputil/ # HTTP utilities
|
|
||||||
│ └── errors/ # Error handling
|
|
||||||
├── docs/ # Documentation
|
|
||||||
├── e2e/ # End-to-end tests
|
|
||||||
└── examples/ # Example code
|
|
||||||
```
|
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
Contributions are welcome! This project follows:
|
See [CONTRIBUTING.md](CONTRIBUTING.md) for setup, development, and PR guidelines.
|
||||||
- **SOLID Principles** - Single responsibility, open/closed, etc.
|
|
||||||
- **DRY Principle** - Don't repeat yourself
|
|
||||||
- **Clean Architecture** - Clear separation of concerns
|
|
||||||
- **Test Coverage** - Unit and E2E tests required
|
|
||||||
|
|
||||||
See our architecture docs for design patterns and guidelines.
|
## License
|
||||||
|
|
||||||
|
[AGPL-3.0](LICENSE)
|
||||||
|
|||||||
8
core/.env.example
Normal file
8
core/.env.example
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# OpenRouter API Key for changelog generation
|
||||||
|
# Get your API key from https://openrouter.ai/keys
|
||||||
|
OPENROUTER_API_KEY=your-api-key-here
|
||||||
|
|
||||||
|
# ZeroSSL API Key for TLS certificates (alternative to Let's Encrypt)
|
||||||
|
# Get your free API key from https://app.zerossl.com/developer
|
||||||
|
# If not set, Caddy will use Let's Encrypt as the default CA
|
||||||
|
ZEROSSL_API_KEY=
|
||||||
@ -8,7 +8,7 @@ NOCOLOR='\033[0m'
|
|||||||
|
|
||||||
# Run tests before push
|
# Run tests before push
|
||||||
echo -e "\n${CYAN}Running tests...${NOCOLOR}"
|
echo -e "\n${CYAN}Running tests...${NOCOLOR}"
|
||||||
go test ./... # Runs all tests in your repo
|
cd "$(git rev-parse --show-toplevel)/core" && go test ./...
|
||||||
status=$?
|
status=$?
|
||||||
if [ $status -ne 0 ]; then
|
if [ $status -ne 0 ]; then
|
||||||
echo -e "${RED}Push aborted: some tests failed.${NOCOLOR}"
|
echo -e "${RED}Push aborted: some tests failed.${NOCOLOR}"
|
||||||
181
core/Makefile
Normal file
181
core/Makefile
Normal file
@ -0,0 +1,181 @@
|
|||||||
|
TEST?=./...
|
||||||
|
|
||||||
|
.PHONY: test
|
||||||
|
test:
|
||||||
|
@echo Running tests...
|
||||||
|
go test -v $(TEST)
|
||||||
|
|
||||||
|
# Gateway-focused E2E tests assume gateway and nodes are already running
|
||||||
|
# Auto-discovers configuration from ~/.orama and queries database for API key
|
||||||
|
# No environment variables required
|
||||||
|
.PHONY: test-e2e test-e2e-deployments test-e2e-fullstack test-e2e-https test-e2e-quick test-e2e-prod test-e2e-shared test-e2e-cluster test-e2e-integration test-e2e-production
|
||||||
|
|
||||||
|
# Production E2E tests - includes production-only tests
|
||||||
|
test-e2e-prod:
|
||||||
|
@if [ -z "$$ORAMA_GATEWAY_URL" ]; then \
|
||||||
|
echo "❌ ORAMA_GATEWAY_URL not set"; \
|
||||||
|
echo "Usage: ORAMA_GATEWAY_URL=https://dbrs.space make test-e2e-prod"; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
@echo "Running E2E tests (including production-only) against $$ORAMA_GATEWAY_URL..."
|
||||||
|
go test -v -tags "e2e production" -timeout 30m ./e2e/...
|
||||||
|
|
||||||
|
# Generic e2e target
|
||||||
|
test-e2e:
|
||||||
|
@echo "Running comprehensive E2E tests..."
|
||||||
|
@echo "Auto-discovering configuration from ~/.orama..."
|
||||||
|
go test -v -tags e2e -timeout 30m ./e2e/...
|
||||||
|
|
||||||
|
test-e2e-deployments:
|
||||||
|
@echo "Running deployment E2E tests..."
|
||||||
|
go test -v -tags e2e -timeout 15m ./e2e/deployments/...
|
||||||
|
|
||||||
|
test-e2e-fullstack:
|
||||||
|
@echo "Running fullstack E2E tests..."
|
||||||
|
go test -v -tags e2e -timeout 20m -run "TestFullStack" ./e2e/...
|
||||||
|
|
||||||
|
test-e2e-https:
|
||||||
|
@echo "Running HTTPS/external access E2E tests..."
|
||||||
|
go test -v -tags e2e -timeout 10m -run "TestHTTPS" ./e2e/...
|
||||||
|
|
||||||
|
test-e2e-shared:
|
||||||
|
@echo "Running shared E2E tests..."
|
||||||
|
go test -v -tags e2e -timeout 10m ./e2e/shared/...
|
||||||
|
|
||||||
|
test-e2e-cluster:
|
||||||
|
@echo "Running cluster E2E tests..."
|
||||||
|
go test -v -tags e2e -timeout 15m ./e2e/cluster/...
|
||||||
|
|
||||||
|
test-e2e-integration:
|
||||||
|
@echo "Running integration E2E tests..."
|
||||||
|
go test -v -tags e2e -timeout 20m ./e2e/integration/...
|
||||||
|
|
||||||
|
test-e2e-production:
|
||||||
|
@echo "Running production-only E2E tests..."
|
||||||
|
go test -v -tags "e2e production" -timeout 15m ./e2e/production/...
|
||||||
|
|
||||||
|
test-e2e-quick:
|
||||||
|
@echo "Running quick E2E smoke tests..."
|
||||||
|
go test -v -tags e2e -timeout 5m -run "TestStatic|TestHealth" ./e2e/...
|
||||||
|
|
||||||
|
# Network - Distributed P2P Database System
|
||||||
|
# Makefile for development and build tasks
|
||||||
|
|
||||||
|
.PHONY: build clean test deps tidy fmt vet lint install-hooks push-devnet push-testnet rollout-devnet rollout-testnet release
|
||||||
|
|
||||||
|
VERSION := 0.120.0
|
||||||
|
COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo unknown)
|
||||||
|
DATE ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
|
||||||
|
LDFLAGS := -X 'main.version=$(VERSION)' -X 'main.commit=$(COMMIT)' -X 'main.date=$(DATE)'
|
||||||
|
LDFLAGS_LINUX := -s -w $(LDFLAGS)
|
||||||
|
|
||||||
|
# Build targets
|
||||||
|
build: deps
|
||||||
|
@echo "Building network executables (version=$(VERSION))..."
|
||||||
|
@mkdir -p bin
|
||||||
|
go build -ldflags "$(LDFLAGS)" -o bin/identity ./cmd/identity
|
||||||
|
go build -ldflags "$(LDFLAGS)" -o bin/orama-node ./cmd/node
|
||||||
|
go build -ldflags "$(LDFLAGS)" -o bin/orama ./cmd/cli/
|
||||||
|
# Inject gateway build metadata via pkg path variables
|
||||||
|
go build -ldflags "$(LDFLAGS) -X 'github.com/DeBrosOfficial/network/pkg/gateway.BuildVersion=$(VERSION)' -X 'github.com/DeBrosOfficial/network/pkg/gateway.BuildCommit=$(COMMIT)' -X 'github.com/DeBrosOfficial/network/pkg/gateway.BuildTime=$(DATE)'" -o bin/gateway ./cmd/gateway
|
||||||
|
go build -ldflags "$(LDFLAGS)" -o bin/sfu ./cmd/sfu
|
||||||
|
go build -ldflags "$(LDFLAGS)" -o bin/turn ./cmd/turn
|
||||||
|
@echo "Build complete! Run ./bin/orama version"
|
||||||
|
|
||||||
|
# Cross-compile CLI for Linux (only binary needed locally; VPS builds everything else from source)
|
||||||
|
build-linux: deps
|
||||||
|
@echo "Cross-compiling CLI for linux/amd64 (version=$(VERSION))..."
|
||||||
|
@mkdir -p bin-linux
|
||||||
|
GOOS=linux GOARCH=amd64 go build -ldflags "$(LDFLAGS_LINUX)" -trimpath -o bin-linux/orama ./cmd/cli/
|
||||||
|
@echo "✓ CLI built at bin-linux/orama"
|
||||||
|
@echo ""
|
||||||
|
@echo "Prefer 'make build-archive' for full pre-built binary archive."
|
||||||
|
|
||||||
|
# Build pre-compiled binary archive for deployment (all binaries + deps)
|
||||||
|
build-archive: deps
|
||||||
|
@echo "Building binary archive (version=$(VERSION))..."
|
||||||
|
go build -ldflags "$(LDFLAGS)" -o bin/orama ./cmd/cli/
|
||||||
|
./bin/orama build --output /tmp/orama-$(VERSION)-linux-amd64.tar.gz
|
||||||
|
|
||||||
|
# Install git hooks
|
||||||
|
install-hooks:
|
||||||
|
@echo "Installing git hooks..."
|
||||||
|
@bash scripts/install-hooks.sh
|
||||||
|
|
||||||
|
# Install orama CLI to ~/.local/bin and configure PATH
|
||||||
|
install: build
|
||||||
|
@bash scripts/install.sh
|
||||||
|
|
||||||
|
# Clean build artifacts
|
||||||
|
clean:
|
||||||
|
@echo "Cleaning build artifacts..."
|
||||||
|
rm -rf bin/
|
||||||
|
rm -rf data/
|
||||||
|
@echo "Clean complete!"
|
||||||
|
|
||||||
|
# Push binary archive to devnet nodes (fanout distribution)
|
||||||
|
push-devnet:
|
||||||
|
./bin/orama node push --env devnet
|
||||||
|
|
||||||
|
# Push binary archive to testnet nodes (fanout distribution)
|
||||||
|
push-testnet:
|
||||||
|
./bin/orama node push --env testnet
|
||||||
|
|
||||||
|
# Full rollout to devnet (build + push + rolling upgrade)
|
||||||
|
rollout-devnet:
|
||||||
|
./bin/orama node rollout --env devnet --yes
|
||||||
|
|
||||||
|
# Full rollout to testnet (build + push + rolling upgrade)
|
||||||
|
rollout-testnet:
|
||||||
|
./bin/orama node rollout --env testnet --yes
|
||||||
|
|
||||||
|
# Interactive release workflow (tag + push)
|
||||||
|
release:
|
||||||
|
@bash scripts/release.sh
|
||||||
|
|
||||||
|
# Check health of all nodes in an environment
|
||||||
|
# Usage: make health ENV=devnet
|
||||||
|
health:
|
||||||
|
@if [ -z "$(ENV)" ]; then \
|
||||||
|
echo "Usage: make health ENV=devnet|testnet"; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
./bin/orama monitor report --env $(ENV)
|
||||||
|
|
||||||
|
# Help
|
||||||
|
help:
|
||||||
|
@echo "Available targets:"
|
||||||
|
@echo " build - Build all executables"
|
||||||
|
@echo " install - Build and install 'orama' CLI to ~/.local/bin"
|
||||||
|
@echo " clean - Clean build artifacts"
|
||||||
|
@echo " test - Run unit tests"
|
||||||
|
@echo ""
|
||||||
|
@echo "E2E Testing:"
|
||||||
|
@echo " make test-e2e-prod - Run all E2E tests incl. production-only (needs ORAMA_GATEWAY_URL)"
|
||||||
|
@echo " make test-e2e-shared - Run shared E2E tests (cache, storage, pubsub, auth)"
|
||||||
|
@echo " make test-e2e-cluster - Run cluster E2E tests (libp2p, olric, rqlite, namespace)"
|
||||||
|
@echo " make test-e2e-integration - Run integration E2E tests (fullstack, persistence, concurrency)"
|
||||||
|
@echo " make test-e2e-deployments - Run deployment E2E tests"
|
||||||
|
@echo " make test-e2e-production - Run production-only E2E tests (DNS, HTTPS, cross-node)"
|
||||||
|
@echo " make test-e2e-quick - Quick smoke tests (static deploys, health checks)"
|
||||||
|
@echo " make test-e2e - Generic E2E tests (auto-discovers config)"
|
||||||
|
@echo ""
|
||||||
|
@echo " Example:"
|
||||||
|
@echo " ORAMA_GATEWAY_URL=https://orama-devnet.network make test-e2e-prod"
|
||||||
|
@echo ""
|
||||||
|
@echo "Deployment:"
|
||||||
|
@echo " make build-archive - Build pre-compiled binary archive for deployment"
|
||||||
|
@echo " make push-devnet - Push binary archive to devnet nodes"
|
||||||
|
@echo " make push-testnet - Push binary archive to testnet nodes"
|
||||||
|
@echo " make rollout-devnet - Full rollout: build + push + rolling upgrade (devnet)"
|
||||||
|
@echo " make rollout-testnet - Full rollout: build + push + rolling upgrade (testnet)"
|
||||||
|
@echo " make health ENV=devnet - Check health of all nodes in an environment"
|
||||||
|
@echo " make release - Interactive release workflow (tag + push)"
|
||||||
|
@echo ""
|
||||||
|
@echo "Maintenance:"
|
||||||
|
@echo " deps - Download dependencies"
|
||||||
|
@echo " tidy - Tidy dependencies"
|
||||||
|
@echo " fmt - Format code"
|
||||||
|
@echo " vet - Vet code"
|
||||||
|
@echo " lint - Lint code (fmt + vet)"
|
||||||
|
@echo " help - Show this help"
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user