mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-02 17:31:39 +00:00
chore(.gitignore): update gitignore to reflect removal of Highway and Vault components
This commit is contained in:
+16
-22
@@ -40,18 +40,16 @@ snrd
|
|||||||
!cli/join-testnet/bin/
|
!cli/join-testnet/bin/
|
||||||
!cli/install/bin/
|
!cli/install/bin/
|
||||||
|
|
||||||
# ===== Node.js & Frontend =====
|
# ===== Removed: Node.js & Frontend (no longer needed for blockchain-only repo) =====
|
||||||
node_modules/
|
# node_modules/
|
||||||
.pnpm-debug.log*
|
# .pnpm-debug.log*
|
||||||
pnpm-debug.log*
|
# pnpm-debug.log*
|
||||||
package-lock.json
|
# package-lock.json
|
||||||
yarn.lock
|
# yarn.lock
|
||||||
*.tsbuildinfo
|
# *.tsbuildinfo
|
||||||
|
# .next/
|
||||||
# Next.js
|
# .vercel/
|
||||||
.next/
|
# **/.open-next
|
||||||
.vercel/
|
|
||||||
**/.open-next
|
|
||||||
|
|
||||||
# ===== Go Development =====
|
# ===== Go Development =====
|
||||||
pkg/mod/
|
pkg/mod/
|
||||||
@@ -76,11 +74,7 @@ keyring-test/
|
|||||||
mytestnet/
|
mytestnet/
|
||||||
docker/testnet/testnet-data
|
docker/testnet/testnet-data
|
||||||
|
|
||||||
# ===== Monorepo & Build Tools =====
|
# ===== Build Tools =====
|
||||||
.turbo/
|
|
||||||
.gitwork/
|
|
||||||
.changeset/.cli-state
|
|
||||||
.biome/
|
|
||||||
.devbox/
|
.devbox/
|
||||||
.task*
|
.task*
|
||||||
Taskfile.yml
|
Taskfile.yml
|
||||||
@@ -95,7 +89,7 @@ logs/
|
|||||||
configs/logs.json
|
configs/logs.json
|
||||||
tmp/
|
tmp/
|
||||||
tmp*
|
tmp*
|
||||||
tmp-swagger-gen/
|
tmp-openapi-gen/
|
||||||
|
|
||||||
# ===== Environment & Secrets =====
|
# ===== Environment & Secrets =====
|
||||||
.env
|
.env
|
||||||
@@ -122,8 +116,8 @@ COMPLETION_SUMMARY.md
|
|||||||
data/
|
data/
|
||||||
compose/
|
compose/
|
||||||
heighliner*
|
heighliner*
|
||||||
# Ignore individual module swagger files (generated in tmp directory)
|
# Ignore individual module OpenAPI files (generated in tmp directory)
|
||||||
tmp-swagger-gen/**/*.swagger.json
|
tmp-openapi-gen/**/*.json
|
||||||
# Allow the final combined swagger.yaml
|
# Allow the final combined openapi.yml
|
||||||
!client/docs/swagger-ui/swagger.yaml
|
!docs/static/openapi.yml
|
||||||
.mcp.json
|
.mcp.json
|
||||||
|
|||||||
+1
-80
@@ -16,7 +16,7 @@ RUN apk add --no-cache \
|
|||||||
|
|
||||||
WORKDIR /code
|
WORKDIR /code
|
||||||
|
|
||||||
# Copy entire source code (including crypto module)
|
# Copy entire source code
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Fix git ownership issue
|
# Fix git ownership issue
|
||||||
@@ -67,85 +67,6 @@ RUN --mount=type=cache,target=/go/pkg/mod \
|
|||||||
echo "Ensuring binary is statically linked ..."; \
|
echo "Ensuring binary is statically linked ..."; \
|
||||||
(file /code/build/snrd | grep "statically linked")
|
(file /code/build/snrd | grep "statically linked")
|
||||||
|
|
||||||
# --------------------------------------------------------
|
|
||||||
# Highway service build stage
|
|
||||||
FROM ${BASE_IMAGE} AS highway-builder
|
|
||||||
SHELL ["/bin/sh", "-ecuxo", "pipefail"]
|
|
||||||
|
|
||||||
# Install build dependencies
|
|
||||||
RUN apk add --no-cache \
|
|
||||||
ca-certificates \
|
|
||||||
build-base \
|
|
||||||
git \
|
|
||||||
linux-headers \
|
|
||||||
bash
|
|
||||||
|
|
||||||
WORKDIR /code
|
|
||||||
|
|
||||||
# Copy entire source code
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
# Fix git ownership issue
|
|
||||||
RUN git config --global --add safe.directory /code
|
|
||||||
|
|
||||||
# Download Go modules
|
|
||||||
RUN --mount=type=cache,target=/go/pkg/mod \
|
|
||||||
--mount=type=cache,target=/root/.cache/go-build \
|
|
||||||
GOTOOLCHAIN=auto go mod download
|
|
||||||
|
|
||||||
# Build Highway binary with optimizations
|
|
||||||
RUN --mount=type=cache,target=/go/pkg/mod \
|
|
||||||
--mount=type=cache,target=/root/.cache/go-build \
|
|
||||||
set -eux; \
|
|
||||||
VERSION=$(git describe --tags --always 2>/dev/null || echo "dev"); \
|
|
||||||
COMMIT=$(git log -1 --format='%H' 2>/dev/null || echo "unknown"); \
|
|
||||||
CGO_ENABLED=1 GOOS=linux \
|
|
||||||
go build \
|
|
||||||
-mod=readonly \
|
|
||||||
-tags "netgo" \
|
|
||||||
-ldflags "-X main.Version=${VERSION} \
|
|
||||||
-X main.Commit=${COMMIT} \
|
|
||||||
-w -s -linkmode=external -extldflags '-static'" \
|
|
||||||
-buildvcs=false \
|
|
||||||
-trimpath \
|
|
||||||
-o /code/build/hway \
|
|
||||||
./cmd/hway; \
|
|
||||||
file /code/build/hway; \
|
|
||||||
echo "Ensuring binary is statically linked ..."; \
|
|
||||||
(file /code/build/hway | grep "statically linked")
|
|
||||||
|
|
||||||
# --------------------------------------------------------
|
|
||||||
# Highway runtime image
|
|
||||||
FROM alpine:3.17 AS highway
|
|
||||||
|
|
||||||
LABEL org.opencontainers.image.title="Sonr Highway Service"
|
|
||||||
LABEL org.opencontainers.image.source="https://github.com/sonr-io/sonr"
|
|
||||||
|
|
||||||
# Copy binary from builder
|
|
||||||
COPY --from=highway-builder /code/build/hway /usr/bin/hway
|
|
||||||
|
|
||||||
# Install runtime dependencies
|
|
||||||
RUN apk add --no-cache ca-certificates wget
|
|
||||||
|
|
||||||
# Create non-root user
|
|
||||||
RUN adduser -D -u 1000 highway
|
|
||||||
|
|
||||||
# Set working directory
|
|
||||||
WORKDIR /home/highway
|
|
||||||
|
|
||||||
# Switch to non-root user
|
|
||||||
USER highway
|
|
||||||
|
|
||||||
# Health check endpoint
|
|
||||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
||||||
CMD wget --spider -q http://localhost:8090/health || exit 1
|
|
||||||
|
|
||||||
# Expose Highway port
|
|
||||||
EXPOSE 8090
|
|
||||||
|
|
||||||
# Set default command
|
|
||||||
ENTRYPOINT ["/usr/bin/hway"]
|
|
||||||
|
|
||||||
# --------------------------------------------------------
|
# --------------------------------------------------------
|
||||||
# Final minimal runtime image (default target for snrd)
|
# Final minimal runtime image (default target for snrd)
|
||||||
FROM alpine:3.17
|
FROM alpine:3.17
|
||||||
|
|||||||
@@ -106,10 +106,8 @@ make testnet-stop
|
|||||||
### Building from Source
|
### Building from Source
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Build all binaries
|
# Build blockchain node
|
||||||
make build # snrd blockchain node
|
make build
|
||||||
make build-hway # Highway service
|
|
||||||
make build-vault # Vault WASM plugin
|
|
||||||
|
|
||||||
# Build Docker image
|
# Build Docker image
|
||||||
make docker
|
make docker
|
||||||
@@ -162,38 +160,11 @@ make ipfs-status # Check IPFS connectivity
|
|||||||
|
|
||||||
## 🏗️ Architecture
|
## 🏗️ Architecture
|
||||||
|
|
||||||
Sonr consists of three primary components and three custom modules:
|
Sonr is a Cosmos SDK-based blockchain with integrated IPFS storage and three custom modules:
|
||||||
|
|
||||||
### Service Architecture
|
|
||||||
|
|
||||||
```
|
|
||||||
┌─────────┐ ┌─────────┐ ┌─────────┐
|
|
||||||
│ Caddy │────▶│ snrd │ │ IPFS │
|
|
||||||
└─────────┘ └─────────┘ └─────────┘
|
|
||||||
│ │ │
|
|
||||||
│ ▼ ▼
|
|
||||||
│ ┌─────────┐ ┌─────────┐
|
|
||||||
└─────────▶│ Highway │────▶│ Redis │
|
|
||||||
└─────────┘ └─────────┘
|
|
||||||
```
|
|
||||||
|
|
||||||
- **Caddy**: Reverse proxy with gRPC-Web support (port 80)
|
|
||||||
- **Redis**: Task queue backend for Highway (port 6379)
|
|
||||||
- **Highway**: UCAN-based task processor (port 8090)
|
|
||||||
- **IPFS**: Distributed storage (API: 5001, Gateway: 8080)
|
|
||||||
- **snrd**: Blockchain node (gRPC: 9090, REST: 1317)
|
|
||||||
|
|
||||||
### Cross-Platform Support
|
|
||||||
|
|
||||||
The `localnet` target now automatically detects and uses the best available method:
|
|
||||||
1. Checks for local binary (built with `make install`)
|
|
||||||
2. Falls back to Docker if available
|
|
||||||
3. Handles permission issues on systems like Arch Linux
|
|
||||||
4. Supports systemd service installation (see `etc/systemd/`)
|
|
||||||
|
|
||||||
### Core Components
|
### Core Components
|
||||||
|
|
||||||
#### 1. **Blockchain Node (`snrd`)**
|
#### **Blockchain Node (`snrd`)**
|
||||||
|
|
||||||
The main blockchain daemon built with Cosmos SDK v0.50.14, providing:
|
The main blockchain daemon built with Cosmos SDK v0.50.14, providing:
|
||||||
|
|
||||||
@@ -201,22 +172,15 @@ The main blockchain daemon built with Cosmos SDK v0.50.14, providing:
|
|||||||
- EVM compatibility via Evmos integration
|
- EVM compatibility via Evmos integration
|
||||||
- IBC for cross-chain communication
|
- IBC for cross-chain communication
|
||||||
- CosmWasm smart contract support
|
- CosmWasm smart contract support
|
||||||
|
- IPFS integration for decentralized storage
|
||||||
|
|
||||||
#### 2. **Highway Service (`hway`)**
|
### Cross-Platform Support
|
||||||
|
|
||||||
An Asynq-based task processing service for vault operations:
|
The `localnet` target automatically detects and uses the best available method:
|
||||||
|
1. Checks for local binary (built with `make install`)
|
||||||
- Redis-backed job queue with priority levels
|
2. Falls back to Docker if available
|
||||||
- Actor-based concurrency using Proto.Actor framework
|
3. Handles permission issues on systems like Arch Linux
|
||||||
- Processes cryptographic operations through WebAssembly enclaves
|
4. Supports systemd service installation (see `etc/systemd/`)
|
||||||
|
|
||||||
#### 3. **Motor Plugin (`motr`)**
|
|
||||||
|
|
||||||
WebAssembly-based vault system providing:
|
|
||||||
|
|
||||||
- Secure execution environment for sensitive operations
|
|
||||||
- Hardware-backed key management
|
|
||||||
- Multi-party computation capabilities
|
|
||||||
|
|
||||||
## 📖 Module Documentation
|
## 📖 Module Documentation
|
||||||
|
|
||||||
@@ -301,45 +265,12 @@ export BLOCK_TIME="1000ms"
|
|||||||
# Network selection for Starship
|
# Network selection for Starship
|
||||||
export NETWORK="devnet" # or "testnet"
|
export NETWORK="devnet" # or "testnet"
|
||||||
|
|
||||||
# Redis configuration
|
|
||||||
REDIS_URL=redis://redis:6379
|
|
||||||
REDIS_DB=0
|
|
||||||
|
|
||||||
# Highway service
|
|
||||||
HIGHWAY_PORT=8090
|
|
||||||
LOG_LEVEL=debug
|
|
||||||
|
|
||||||
# IPFS configuration
|
# IPFS configuration
|
||||||
IPFS_API_URL=http://ipfs:5001
|
IPFS_API_URL=http://ipfs:5001
|
||||||
|
|
||||||
# Caddy configuration
|
|
||||||
CADDY_DOMAIN=localhost
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Environment variables can be set directly or via a `.env` file in the project root.
|
Environment variables can be set directly or via a `.env` file in the project root.
|
||||||
|
|
||||||
### Docker Compose Services
|
|
||||||
|
|
||||||
The project includes a comprehensive Docker Compose setup for running all backend services:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Start all services (Redis, Highway, Caddy, IPFS)
|
|
||||||
make docker-up
|
|
||||||
|
|
||||||
# Stop all services
|
|
||||||
make docker-down
|
|
||||||
|
|
||||||
# View service logs
|
|
||||||
make docker-logs # All services
|
|
||||||
make docker-logs-redis # Specific service
|
|
||||||
|
|
||||||
# Check service health
|
|
||||||
make docker-status
|
|
||||||
|
|
||||||
# Clean up Docker resources
|
|
||||||
make docker-clean
|
|
||||||
```
|
|
||||||
|
|
||||||
### Starship Configuration
|
### Starship Configuration
|
||||||
|
|
||||||
Edit `starship.yml` to configure multi-node testnets:
|
Edit `starship.yml` to configure multi-node testnets:
|
||||||
@@ -353,146 +284,53 @@ chains:
|
|||||||
# ... additional configuration
|
# ... additional configuration
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Troubleshooting
|
### Troubleshooting
|
||||||
|
|
||||||
**Services not starting:**
|
|
||||||
```bash
|
|
||||||
# Check service status
|
|
||||||
make docker-status
|
|
||||||
|
|
||||||
# View detailed logs
|
|
||||||
make docker-logs
|
|
||||||
|
|
||||||
# Ensure Docker network exists
|
|
||||||
docker network ls | grep sonr-network
|
|
||||||
```
|
|
||||||
|
|
||||||
**Redis connection issues:**
|
|
||||||
```bash
|
|
||||||
# Test Redis connectivity
|
|
||||||
docker exec redis redis-cli ping
|
|
||||||
|
|
||||||
# Check Redis logs
|
|
||||||
make docker-logs-redis
|
|
||||||
```
|
|
||||||
|
|
||||||
**IPFS not accessible:**
|
**IPFS not accessible:**
|
||||||
```bash
|
```bash
|
||||||
# Verify IPFS is running
|
# Verify IPFS is running
|
||||||
curl http://127.0.0.1:5001/api/v0/version
|
curl http://127.0.0.1:5001/api/v0/version
|
||||||
|
|
||||||
# Check IPFS logs
|
# Check IPFS status
|
||||||
docker compose -f etc/stack/compose.yml logs ipfs
|
make ipfs-status
|
||||||
```
|
```
|
||||||
|
|
||||||
**Port conflicts:**
|
**Port conflicts:**
|
||||||
- Caddy: 80 (HTTP)
|
|
||||||
- Redis: 6379
|
|
||||||
- Highway: 8090
|
|
||||||
- IPFS API: 5001
|
- IPFS API: 5001
|
||||||
- IPFS Gateway: 8080
|
- IPFS Gateway: 8080
|
||||||
|
- Node gRPC: 9090
|
||||||
|
- Node REST API: 1317
|
||||||
|
|
||||||
Stop conflicting services or modify ports in `etc/stack/compose.yml`.
|
Stop conflicting services or modify ports in configuration files.
|
||||||
|
|
||||||
## 🏗️ Project Structure
|
## 🏗️ Project Structure
|
||||||
|
|
||||||
Sonr uses a modern monorepo architecture with pnpm workspaces for JavaScript/TypeScript packages alongside the Go blockchain implementation:
|
Sonr is a focused Cosmos SDK blockchain implementation:
|
||||||
|
|
||||||
### Workspace Organization
|
|
||||||
|
|
||||||
```
|
```
|
||||||
sonr/
|
sonr/
|
||||||
├── app/ # Application setup and module wiring
|
├── app/ # Application setup and module wiring
|
||||||
├── cmd/ # Binary entry points
|
├── cmd/ # Binary entry points
|
||||||
│ ├── snrd/ # Blockchain node
|
│ └── snrd/ # Blockchain node daemon
|
||||||
│ ├── hway/ # Highway service
|
├── x/ # Custom Cosmos SDK modules
|
||||||
│ └── motr/ # Motor WASM plugin
|
|
||||||
├── x/ # Custom chain modules
|
|
||||||
│ ├── did/ # W3C DID implementation
|
│ ├── did/ # W3C DID implementation
|
||||||
│ ├── dwn/ # Decentralized Web Nodes
|
│ ├── dwn/ # Decentralized Web Nodes
|
||||||
│ └── svc/ # Service management
|
│ └── svc/ # Service management
|
||||||
├── types/ # Internal packages
|
├── types/ # Internal Go packages
|
||||||
│ ├── coins/ # Task processing
|
|
||||||
│ └── ipfs/ # Authorization networks
|
|
||||||
├── proto/ # Protobuf definitions
|
├── proto/ # Protobuf definitions
|
||||||
├── scripts/ # Utility scripts
|
├── scripts/ # Utility scripts
|
||||||
├── test/ # Integration tests
|
├── test/ # Integration tests
|
||||||
├── docs/ # Documentation site
|
├── docs/ # Documentation
|
||||||
│
|
└── client/ # Client libraries and tooling
|
||||||
# Monorepo Packages (pnpm workspaces)
|
|
||||||
├── packages/ # Core JavaScript/TypeScript packages
|
|
||||||
│ ├── es/ # @sonr.io/es - ES client library
|
|
||||||
│ ├── sdk/ # @sonr.io/sdk - SDK package
|
|
||||||
│ └── ui/ # @sonr.io/ui - Shared UI components
|
|
||||||
├── cli/ # CLI tools
|
|
||||||
│ ├── install/ # @sonr.io/install - Installation CLI
|
|
||||||
│ └── join-testnet/# @sonr.io/join-testnet - Testnet CLI
|
|
||||||
└── web/ # Web applications
|
|
||||||
├── auth/ # Authentication app (Next.js)
|
|
||||||
└── dash/ # Dashboard app (Next.js)
|
|
||||||
```
|
|
||||||
|
|
||||||
### Working with the Monorepo
|
|
||||||
|
|
||||||
#### Installation
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Install all dependencies for the monorepo
|
|
||||||
pnpm install
|
|
||||||
|
|
||||||
# Build all packages
|
|
||||||
pnpm build
|
|
||||||
|
|
||||||
# Run development mode for all packages
|
|
||||||
pnpm dev
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Package Management
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Run commands in specific packages
|
|
||||||
pnpm --filter @sonr.io/es build
|
|
||||||
pnpm --filter @sonr.io/sdk test
|
|
||||||
|
|
||||||
# Add dependencies to specific packages
|
|
||||||
pnpm --filter @sonr.io/ui add react
|
|
||||||
|
|
||||||
# Run commands in all packages
|
|
||||||
pnpm -r build # Build all packages
|
|
||||||
pnpm -r test # Test all packages
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Versioning & Publishing
|
|
||||||
|
|
||||||
The monorepo uses [Changesets](https://github.com/changesets/changesets) for package versioning:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Add a changeset for your changes
|
|
||||||
pnpm changeset
|
|
||||||
|
|
||||||
# Version packages based on changesets
|
|
||||||
pnpm changeset version
|
|
||||||
|
|
||||||
# Publish packages to npm
|
|
||||||
pnpm changeset publish
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Key Technologies
|
### Key Technologies
|
||||||
|
|
||||||
- **pnpm workspaces**: Efficient dependency management with single lockfile
|
- **Cosmos SDK v0.50.14**: Blockchain framework
|
||||||
- **TypeScript project references**: Incremental builds and better IDE performance
|
- **CometBFT v0.38.17**: Byzantine fault-tolerant consensus
|
||||||
- **Turbo**: Build orchestration and caching for faster builds
|
- **IBC v8.7.0**: Inter-blockchain communication
|
||||||
- **Changesets**: Automated versioning and changelog generation
|
- **CosmWasm v1.5.8**: Smart contract support
|
||||||
- **Biome**: Fast, unified linting and formatting (replaces ESLint/Prettier)
|
- **IPFS**: Decentralized storage integration
|
||||||
|
|
||||||
### Package Dependencies
|
|
||||||
|
|
||||||
- `@sonr.io/es`: Core ES client library with protobuf types
|
|
||||||
- `@sonr.io/sdk`: High-level SDK (depends on @sonr.io/es)
|
|
||||||
- `@sonr.io/ui`: Shared UI components for web applications
|
|
||||||
- `@sonr.io/install`: CLI tool for installing Sonr
|
|
||||||
- `@sonr.io/join-testnet`: CLI tool for joining testnet
|
|
||||||
- Web apps use all three core packages (@sonr.io/es, @sonr.io/sdk, @sonr.io/ui)
|
|
||||||
|
|
||||||
## 🤝 Community & Support
|
## 🤝 Community & Support
|
||||||
|
|
||||||
|
|||||||
+2
-8
@@ -62,13 +62,10 @@ ldflags := $(strip $(ldflags))
|
|||||||
|
|
||||||
BUILD_FLAGS := -tags "$(build_tags_comma_sep)" -ldflags '$(ldflags)' -trimpath
|
BUILD_FLAGS := -tags "$(build_tags_comma_sep)" -ldflags '$(ldflags)' -trimpath
|
||||||
|
|
||||||
# Build vault WASM module (required dependency)
|
|
||||||
VAULT_ROOT := $(GIT_ROOT)/cmd/vault
|
|
||||||
VAULT_OUT := $(GIT_ROOT)/x/dwn/client/plugin/vault.wasm
|
|
||||||
SNRD_OUT := $(GIT_ROOT)/build/snrd
|
SNRD_OUT := $(GIT_ROOT)/build/snrd
|
||||||
SNRD_EXE_OUT := $(GIT_ROOT)/build/snrd.exe
|
SNRD_EXE_OUT := $(GIT_ROOT)/build/snrd.exe
|
||||||
|
|
||||||
.PHONY: all build install clean vault version help docker
|
.PHONY: all build install clean version help docker
|
||||||
|
|
||||||
all: build
|
all: build
|
||||||
|
|
||||||
@@ -82,7 +79,6 @@ else
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
install:
|
install:
|
||||||
@$(MAKE) -C $(VAULT_ROOT) build
|
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
@echo "Building snrd.exe for Windows..."
|
@echo "Building snrd.exe for Windows..."
|
||||||
GOOS=windows GOARCH=amd64 go build -mod=readonly $(BUILD_FLAGS) -o $(SNRD_EXE_OUT) .
|
GOOS=windows GOARCH=amd64 go build -mod=readonly $(BUILD_FLAGS) -o $(SNRD_EXE_OUT) .
|
||||||
@@ -95,7 +91,6 @@ endif
|
|||||||
clean:
|
clean:
|
||||||
@echo "Cleaning build artifacts..."
|
@echo "Cleaning build artifacts..."
|
||||||
@rm -f $(SNRD_OUT) $(SNRD_EXE_OUT)
|
@rm -f $(SNRD_OUT) $(SNRD_EXE_OUT)
|
||||||
@$(MAKE) -C $(VAULT_ROOT) clean
|
|
||||||
@echo "Clean complete"
|
@echo "Clean complete"
|
||||||
|
|
||||||
version:
|
version:
|
||||||
@@ -150,9 +145,8 @@ help:
|
|||||||
@echo "==================="
|
@echo "==================="
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "Available targets:"
|
@echo "Available targets:"
|
||||||
@echo " build - Build snrd binary (with vault WASM)"
|
@echo " build - Build snrd binary"
|
||||||
@echo " install - Install snrd to GOPATH/bin"
|
@echo " install - Install snrd to GOPATH/bin"
|
||||||
@echo " vault - Build vault WASM module only"
|
|
||||||
@echo " docker - Build Docker image (onsonr/snrd:latest)"
|
@echo " docker - Build Docker image (onsonr/snrd:latest)"
|
||||||
@echo " clean - Remove build artifacts"
|
@echo " clean - Remove build artifacts"
|
||||||
@echo " version - Display version information"
|
@echo " version - Display version information"
|
||||||
|
|||||||
+7
-30
@@ -54,33 +54,23 @@ build_locally() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Build binaries
|
# Build binary
|
||||||
echo "Building snrd..."
|
echo "Building snrd..."
|
||||||
make build || {
|
make build || {
|
||||||
echo "Error: Failed to build snrd"
|
echo "Error: Failed to build snrd"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "Building motr..."
|
# Copy binary to install directory
|
||||||
make motr || {
|
|
||||||
echo "Error: Failed to build motr"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# Copy binaries to install directory
|
|
||||||
cp build/snrd "${INSTALL_DIR}/" || {
|
cp build/snrd "${INSTALL_DIR}/" || {
|
||||||
echo "Error: Failed to copy snrd"
|
echo "Error: Failed to copy snrd"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
cp build/motr.wasm "${INSTALL_DIR}/" || {
|
|
||||||
echo "Error: Failed to copy motr.wasm"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# Make binaries executable
|
# Make binary executable
|
||||||
chmod +x "${INSTALL_DIR}/snrd"
|
chmod +x "${INSTALL_DIR}/snrd"
|
||||||
|
|
||||||
echo "Binaries built and installed successfully to ${INSTALL_DIR}"
|
echo "Binary built and installed successfully to ${INSTALL_DIR}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to get latest release version
|
# Function to get latest release version
|
||||||
@@ -144,31 +134,18 @@ install_binaries() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Download motr.wasm (platform independent)
|
# Make binary executable
|
||||||
echo "Downloading motr.wasm..."
|
|
||||||
if ! curl -L "${BASE_URL}/motr.wasm" -o "${INSTALL_DIR}/motr.wasm" -f; then
|
|
||||||
echo "Warning: Failed to download from CDN, trying GitHub releases..."
|
|
||||||
# Fallback to GitHub releases
|
|
||||||
GITHUB_URL="https://github.com/sonr-io/sonr/releases/download/v${LATEST_VERSION}"
|
|
||||||
if ! curl -L "${GITHUB_URL}/motr.wasm" -o "${INSTALL_DIR}/motr.wasm" -f; then
|
|
||||||
echo "Error: Failed to download motr.wasm from both CDN and GitHub"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Make binaries executable
|
|
||||||
chmod +x "${INSTALL_DIR}/snrd"
|
chmod +x "${INSTALL_DIR}/snrd"
|
||||||
|
|
||||||
echo "Binaries installed successfully to ${INSTALL_DIR}"
|
echo "Binary installed successfully to ${INSTALL_DIR}"
|
||||||
else
|
else
|
||||||
# Fall back to local build
|
# Fall back to local build
|
||||||
build_locally "${INSTALL_DIR}"
|
build_locally "${INSTALL_DIR}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "Available commands:"
|
echo "Installed:"
|
||||||
echo " snrd - Blockchain daemon"
|
echo " snrd - Blockchain daemon"
|
||||||
echo " motr.wasm - WebAssembly enclave"
|
|
||||||
echo
|
echo
|
||||||
echo "Quick start:"
|
echo "Quick start:"
|
||||||
echo " snrd --help # Show available commands"
|
echo " snrd --help # Show available commands"
|
||||||
|
|||||||
+13
-10
@@ -22,7 +22,7 @@ GIT_ROOT := $(shell git rev-parse --show-toplevel)
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
.DEFAULT_GOAL := help
|
.DEFAULT_GOAL := help
|
||||||
|
|
||||||
all: build gen swagger-gen push
|
all: build gen openapi-gen push
|
||||||
|
|
||||||
proto: gen
|
proto: gen
|
||||||
generate: gen
|
generate: gen
|
||||||
@@ -53,20 +53,23 @@ test:
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
### Documentation ###
|
### Documentation ###
|
||||||
###############################################################################
|
###############################################################################
|
||||||
swagger-gen:
|
openapi-gen:
|
||||||
@gum log --level info "Generating OpenAPI documentation..."
|
@gum log --level info "Generating OpenAPI documentation..."
|
||||||
@$(protoImage) buf generate --template proto/buf.gen.openapi.yaml
|
@$(protoImage) buf generate --template proto/buf.gen.openapi.yaml
|
||||||
@gum log --level info "Combining swagger files into unified specification..."
|
@gum log --level info "Combining OpenAPI files into unified specification..."
|
||||||
@mkdir -p $(GIT_ROOT)/client/docs/swagger-ui
|
@mkdir -p $(GIT_ROOT)/docs/static
|
||||||
@npx swagger-combine $(GIT_ROOT)/client/docs/config.json \
|
@npx swagger-combine $(GIT_ROOT)/client/docs/config.json \
|
||||||
-o $(GIT_ROOT)/client/docs/swagger-ui/swagger.yaml \
|
-o $(GIT_ROOT)/docs/static/openapi.yml \
|
||||||
-f yaml \
|
-f yaml \
|
||||||
--continueOnConflictingPaths true \
|
--continueOnConflictingPaths true \
|
||||||
--includeDefinitions true
|
--includeDefinitions true
|
||||||
@gum log --level info "Cleaning up temporary files..."
|
@gum log --level info "Cleaning up temporary files..."
|
||||||
@rm -rf $(GIT_ROOT)/tmp-swagger-gen
|
@rm -rf $(GIT_ROOT)/tmp-openapi-gen
|
||||||
@gum log --level info "✅ OpenAPI documentation generated successfully"
|
@gum log --level info "✅ OpenAPI documentation generated successfully"
|
||||||
@gum log --level info "✅ Unified API specification: client/docs/swagger-ui/swagger.yaml"
|
@gum log --level info "✅ Unified API specification: docs/static/openapi.yml"
|
||||||
|
|
||||||
|
# Backwards compatibility alias
|
||||||
|
swagger-gen: openapi-gen
|
||||||
|
|
||||||
push:
|
push:
|
||||||
@npx buf push
|
@npx buf push
|
||||||
@@ -86,15 +89,15 @@ help:
|
|||||||
@gum log --level info ""
|
@gum log --level info ""
|
||||||
@gum log --level info "Available targets:"
|
@gum log --level info "Available targets:"
|
||||||
@gum log --level info ""
|
@gum log --level info ""
|
||||||
@gum log --level info " all Run lint, gen, and swagger-gen targets"
|
@gum log --level info " all Run lint, gen, and openapi-gen targets"
|
||||||
@gum log --level info " gen Generate protobuf code and stubs"
|
@gum log --level info " gen Generate protobuf code and stubs"
|
||||||
@gum log --level info " lint Lint protobuf files"
|
@gum log --level info " lint Lint protobuf files"
|
||||||
@gum log --level info " check-breaking Check for breaking changes against main branch"
|
@gum log --level info " check-breaking Check for breaking changes against main branch"
|
||||||
@gum log --level info " swagger-gen Generate OpenAPI documentation"
|
@gum log --level info " openapi-gen Generate OpenAPI documentation"
|
||||||
@gum log --level info " help Show this help message"
|
@gum log --level info " help Show this help message"
|
||||||
@gum log --level info ""
|
@gum log --level info ""
|
||||||
@gum log --level info "Environment:"
|
@gum log --level info "Environment:"
|
||||||
@gum log --level info " Proto builder: $(protoImageName)"
|
@gum log --level info " Proto builder: $(protoImageName)"
|
||||||
@gum log --level info " Spawn: onsonr/spawn:latest"
|
@gum log --level info " Spawn: onsonr/spawn:latest"
|
||||||
|
|
||||||
.PHONY: all gen lint check-breaking swagger-gen help
|
.PHONY: all gen lint check-breaking openapi-gen swagger-gen help
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
version: v1
|
version: v1
|
||||||
plugins:
|
plugins:
|
||||||
# Generate OpenAPI v2 (Swagger) documentation
|
# Generate OpenAPI v2 documentation
|
||||||
# Follows Cosmos SDK standard approach: generate to tmp directory, then combine
|
# Follows Cosmos SDK standard approach: generate to tmp directory, then combine
|
||||||
- name: openapiv2
|
- name: openapiv2
|
||||||
out: ../tmp-swagger-gen
|
out: ../tmp-openapi-gen
|
||||||
opt:
|
opt:
|
||||||
- logtostderr=true
|
- logtostderr=true
|
||||||
- fqn_for_swagger_name=true
|
- fqn_for_swagger_name=true
|
||||||
|
|||||||
@@ -153,67 +153,32 @@ devbox_run() {
|
|||||||
|
|
||||||
install() {
|
install() {
|
||||||
header "Install"
|
header "Install"
|
||||||
gum spin --show-error --spinner pulse --title "Installing pnpm..." -- pnpm install --frozen-lockfile
|
|
||||||
gum spin --show-error --spinner pulse --title "Installing Go..." -- go mod download
|
gum spin --show-error --spinner pulse --title "Installing Go..." -- go mod download
|
||||||
info "pnpm(10.14.0)"
|
|
||||||
info "go(1.24.7)"
|
info "go(1.24.7)"
|
||||||
separator
|
separator
|
||||||
}
|
}
|
||||||
|
|
||||||
build_all() {
|
build_all() {
|
||||||
header "Build"
|
header "Build"
|
||||||
devbox_run "build:auth"
|
|
||||||
devbox_run "build:dash"
|
|
||||||
devbox_run "build:core"
|
devbox_run "build:core"
|
||||||
devbox_run "build:com"
|
|
||||||
devbox_run "build:es"
|
|
||||||
devbox_run "build:hway"
|
|
||||||
devbox_run "build:motr"
|
|
||||||
devbox_run "build:pkl"
|
|
||||||
devbox_run "build:sdk"
|
|
||||||
devbox_run "build:ui"
|
|
||||||
devbox_run "build:vault"
|
|
||||||
separator
|
separator
|
||||||
}
|
}
|
||||||
|
|
||||||
test_all() {
|
test_all() {
|
||||||
header "Test"
|
header "Test"
|
||||||
devbox_run "test:auth"
|
|
||||||
devbox_run "test:dash"
|
|
||||||
devbox_run "test:core"
|
devbox_run "test:core"
|
||||||
devbox_run "test:com"
|
|
||||||
devbox_run "test:es"
|
|
||||||
devbox_run "test:hway"
|
|
||||||
devbox_run "test:motr"
|
|
||||||
devbox_run "test:pkl"
|
|
||||||
devbox_run "test:sdk"
|
|
||||||
devbox_run "test:ui"
|
|
||||||
devbox_run "test:vault"
|
|
||||||
separator
|
separator
|
||||||
}
|
}
|
||||||
|
|
||||||
release_all() {
|
release_all() {
|
||||||
header "Release"
|
header "Release"
|
||||||
# devbox_run "release:auth"
|
|
||||||
# devbox_run "release:dash"
|
|
||||||
devbox_run "release:core"
|
devbox_run "release:core"
|
||||||
devbox_run "release:com"
|
|
||||||
devbox_run "release:es"
|
|
||||||
devbox_run "release:hway"
|
|
||||||
devbox_run "release:motr"
|
|
||||||
devbox_run "release:pkl"
|
|
||||||
devbox_run "release:sdk"
|
|
||||||
devbox_run "release:ui"
|
|
||||||
devbox_run "release:vault"
|
|
||||||
separator
|
separator
|
||||||
}
|
}
|
||||||
|
|
||||||
snapshot_all() {
|
snapshot_all() {
|
||||||
header "Snapshot"
|
header "Snapshot"
|
||||||
devbox_run "snapshot:core"
|
devbox_run "snapshot:core"
|
||||||
devbox_run "snapshot:hway"
|
|
||||||
devbox_run "snapshot:motr"
|
|
||||||
devbox_run "snapshot:vault"
|
|
||||||
separator
|
separator
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -312,12 +277,6 @@ main() {
|
|||||||
"snapshot-scopes")
|
"snapshot-scopes")
|
||||||
snapshot_scopes
|
snapshot_scopes
|
||||||
;;
|
;;
|
||||||
"install-pnpm")
|
|
||||||
install_pnpm
|
|
||||||
;;
|
|
||||||
"install-go")
|
|
||||||
install_go
|
|
||||||
;;
|
|
||||||
"install")
|
"install")
|
||||||
install
|
install
|
||||||
;;
|
;;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ rm -rf github.com
|
|||||||
|
|
||||||
# Copy files over for dep injection
|
# Copy files over for dep injection
|
||||||
rm -rf api && mkdir api
|
rm -rf api && mkdir api
|
||||||
custom_modules=$(find . -name 'module' -type d -not -path "./proto/*" -not -path "./.cache/*" -not -path "./node_modules/*" -not -path "./packages/*")
|
custom_modules=$(find . -name 'module' -type d -not -path "./proto/*" -not -path "./.cache/*")
|
||||||
|
|
||||||
# get the 1 up directory (so ./cosmos/mint/module becomes ./cosmos/mint)
|
# get the 1 up directory (so ./cosmos/mint/module becomes ./cosmos/mint)
|
||||||
# remove the relative path starter from base namespaces. so ./cosmos/mint becomes cosmos/mint
|
# remove the relative path starter from base namespaces. so ./cosmos/mint becomes cosmos/mint
|
||||||
|
|||||||
Reference in New Issue
Block a user