Skip to content

Commit bdeb1ed

Browse files
authored
Merge pull request #36 from CommandOSSLabs:feat/walrus
Feat/walrus
2 parents 4e06a88 + 0480611 commit bdeb1ed

2 files changed

Lines changed: 121 additions & 23 deletions

File tree

apps/walrus/Dockerfile

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28,29 +28,29 @@ ENV WALRUS_NETWORK=testnet
2828
# Determine binary architecture and download/install binaries
2929
RUN set -eux; \
3030
case "$TARGETARCH" in \
31-
amd64) BIN_ARCH="x86_64" ;; \
32-
arm64) BIN_ARCH="aarch64" ;; \
33-
*) echo "Unsupported architecture: $TARGETARCH"; exit 1 ;; \
31+
amd64) BIN_ARCH="x86_64" ;; \
32+
arm64) BIN_ARCH="aarch64" ;; \
33+
*) echo "Unsupported architecture: $TARGETARCH"; exit 1 ;; \
3434
esac; \
3535
BINARIES="sui walrus"; \
3636
for BIN in $BINARIES; do \
37-
case "$BIN" in \
38-
sui) \
39-
URL="https://github.com/MystenLabs/sui/releases/download/${SUI_NETWORK}-${SUI_VERSION}/sui-${SUI_NETWORK}-${SUI_VERSION}-ubuntu-${BIN_ARCH}.tgz"; \
40-
OUT="/tmp/sui.tar.gz"; \
41-
EXE="sui" \
42-
;; \
43-
walrus) \
44-
URL="https://github.com/MystenLabs/walrus/releases/download/${WALRUS_NETWORK}-${WALRUS_VERSION}/walrus-${WALRUS_NETWORK}-${WALRUS_VERSION}-ubuntu-${BIN_ARCH}.tgz"; \
45-
OUT="/tmp/walrus.tar.gz"; \
46-
EXE="walrus" \
47-
;; \
48-
esac; \
49-
wget -O "$OUT" "$URL"; \
50-
tar -xzf "$OUT" -C /tmp; \
51-
mv "/tmp/$EXE" "/usr/local/bin/$EXE"; \
52-
chmod +x "/usr/local/bin/$EXE"; \
53-
rm "$OUT"; \
37+
case "$BIN" in \
38+
sui) \
39+
URL="https://github.com/MystenLabs/sui/releases/download/${SUI_NETWORK}-${SUI_VERSION}/sui-${SUI_NETWORK}-${SUI_VERSION}-ubuntu-${BIN_ARCH}.tgz"; \
40+
OUT="/tmp/sui.tar.gz"; \
41+
EXE="sui" \
42+
;; \
43+
walrus) \
44+
URL="https://github.com/MystenLabs/walrus/releases/download/${WALRUS_NETWORK}-${WALRUS_VERSION}/walrus-${WALRUS_NETWORK}-${WALRUS_VERSION}-ubuntu-${BIN_ARCH}.tgz"; \
45+
OUT="/tmp/walrus.tar.gz"; \
46+
EXE="walrus" \
47+
;; \
48+
esac; \
49+
wget -O "$OUT" "$URL"; \
50+
tar -xzf "$OUT" -C /tmp; \
51+
mv "/tmp/$EXE" "/usr/local/bin/$EXE"; \
52+
chmod +x "/usr/local/bin/$EXE"; \
53+
rm "$OUT"; \
5454
done
5555

5656
# Use Ubuntu 24.04 as runtime, since it's the only one that has glibc 2.39
@@ -76,7 +76,10 @@ COPY --chmod=755 ./scripts/entrypoint.sh /entrypoint.sh
7676
ARG BUILD_DATE
7777
LABEL build-date=$BUILD_DATE
7878

79-
ENTRYPOINT ["/entrypoint.sh"]
79+
# Walrus default port for publisher/daemon modes
80+
EXPOSE 31415
81+
# Walrus Metrics default port
82+
EXPOSE 27182
8083

81-
# Expose port 8080 for the HTTP server
82-
EXPOSE 8080
84+
# Set entrypoint
85+
ENTRYPOINT ["/entrypoint.sh"]

apps/walrus/RAILWAY.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
![Walrus](https://docs.wal.app/img/logo.svg)
2+
3+
# Deploy and Host Walrus Publisher/Aggregator on Railway
4+
5+
Walrus Publisher and Aggregator are services that enable interaction with Walrus decentralized storage on the Sui blockchain. The Publisher uploads and manages blobs, while the Aggregator retrieves and serves stored content. Run them independently or combined in Daemon mode for a complete storage solution.
6+
7+
## About Hosting Walrus Publisher/Aggregator
8+
9+
Hosting Walrus services involves running HTTP endpoints that interact with the Walrus decentralized storage network on Sui blockchain. The Publisher service accepts blob uploads via REST API, manages parallel transactions through sub-wallets, and stores data across the Walrus network with configurable redundancy. The Aggregator service retrieves and serves blobs on-demand with efficient caching and concurrent request handling. Both services support JWT authentication, metrics monitoring, and can operate on testnet or mainnet networks. The containerized deployment handles wallet management, network configuration, and resource optimization automatically.
10+
11+
## Common Use Cases
12+
13+
- **Decentralized Content Hosting**: Host websites, images, videos, and static assets on Walrus with guaranteed availability
14+
- **API Gateway for dApps**: Provide your decentralized applications with reliable blob storage and retrieval endpoints
15+
- **Multi-Tenant Storage Service**: Run a Publisher with JWT authentication to offer secure blob storage as a service
16+
- **CDN Alternative**: Deploy Aggregators globally to serve Walrus content with low latency and high throughput
17+
- **Backup and Archival**: Store application data, backups, and archives with cryptographic verification
18+
19+
## Dependencies for Walrus Publisher/Aggregator Hosting
20+
21+
- **Sui Blockchain Access**: Connection to Sui network RPC endpoints (testnet or mainnet)
22+
- **Wallet Keystore** (Publisher/Daemon only): Sui private key with sufficient SUI and WAL tokens for gas and storage fees
23+
- **Persistent Storage**: Volume mount for `/wallets` directory to persist sub-wallets across restarts
24+
25+
### ⚠️ IMPORTANT - Token Requirements for Publisher/Daemon Mode
26+
27+
The Publisher and Daemon modes create sub-wallets to handle concurrent blob uploads. Each sub-wallet requires funding with both SUI (for gas) and WAL tokens (for storage fees).
28+
29+
**Default Configuration:**
30+
- **8 sub-wallets** are created by default (configurable with `N_CLIENTS`)
31+
- Each sub-wallet maintains **0.5-1.0 SUI** and **0.5-1.0 WAL** in steady state
32+
- Automatic refill from main wallet when balance drops below threshold
33+
- **Minimum Main Wallet Balance**: Ensure your main wallet has sufficient tokens to fund all sub-wallets (e.g., 8-10+ SUI and 8-10+ WAL for default setup)
34+
35+
**Cost Implications:**
36+
- Every blob store operation consumes SUI (gas) and WAL (storage) tokens
37+
- Higher concurrency (`N_CLIENTS`) requires proportionally more tokens distributed across sub-wallets
38+
- **Secure your Publisher endpoint** - unauthorized access can rapidly drain your wallet
39+
- Consider JWT authentication (`JWT_VERIFY_UPLOAD=1`) to control access
40+
41+
For production deployments, monitor wallet balances and set up alerts to avoid service interruption due to insufficient funds.
42+
43+
### Deployment Dependencies
44+
45+
- **Docker Image**: [cmdoss/walrus](https://hub.docker.com/r/cmdoss/walrus) - Multi-architecture container with Sui and Walrus binaries
46+
- **Official Documentation**: [Walrus Sites](https://docs.wal.app/) - Learn more about the Walrus protocol
47+
- **Sui Documentation**: [Sui Docs](https://docs.sui.io/) - Understand the underlying blockchain platform
48+
- **GitHub Repository**: [CommandOSSLabs/ts-sdks](https://github.com/CommandOSSLabs/ts-sdks) - Source code and configuration templates
49+
50+
### Implementation Details
51+
52+
#### Environment Variables
53+
54+
**Required for all modes:**
55+
```bash
56+
MODE=publisher # or 'aggregator', 'daemon'
57+
NETWORK=testnet # or 'mainnet'
58+
```
59+
60+
**Required for Publisher/Daemon modes:**
61+
```bash
62+
SUI_KEYSTORE=suiprivkey... # Your Sui private key from ~/.sui/sui_config/sui.keystore
63+
```
64+
65+
**Optional JWT Authentication (Publisher/Daemon):**
66+
```bash
67+
JWT_DECODE_SECRET=your-secret-key
68+
JWT_ALGORITHM=HS256
69+
JWT_VERIFY_UPLOAD=1
70+
```
71+
72+
**Performance Tuning:**
73+
```bash
74+
N_CLIENTS=16 # Parallel Walrus clients
75+
PUBLISHER_MAX_CONCURRENT_REQUESTS=16 # Upload concurrency
76+
AGGREGATOR_MAX_CONCURRENT_REQUESTS=512 # Download concurrency
77+
MAX_BODY_SIZE=20480 # Max upload size (KB)
78+
```
79+
80+
#### Health Check Endpoints
81+
82+
- **HTTP API**: `http://localhost:31415` - Main service endpoint
83+
- **Metrics**: `http://localhost:27182/metrics` - Prometheus metrics for monitoring
84+
85+
#### Volume Mounts
86+
87+
Mount `/wallets` volume for Publisher/Daemon modes to persist sub-wallet state across container restarts.
88+
89+
## Why Deploy Walrus Publisher/Aggregator on Railway?
90+
91+
<!-- Recommended: Keep this section as shown below -->
92+
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
93+
94+
By deploying Walrus Publisher/Aggregator on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
95+
<!-- End recommended section -->

0 commit comments

Comments
 (0)