Skip to content

Commit 683cab5

Browse files
authored
feat: initialize documentation structure and deployment workflow (#366)
2 parents 4b5ec4b + 42680e6 commit 683cab5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+15825
-0
lines changed

.github/workflows/deploy-docs.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Deploy Docs to GitHub Pages
2+
3+
on:
4+
# Trigger on pushes to main branch
5+
push:
6+
branches: [main]
7+
paths:
8+
- "docs/**"
9+
# Allow manual triggering
10+
workflow_dispatch:
11+
12+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
13+
permissions:
14+
contents: write
15+
16+
# Allow only one concurrent deployment
17+
concurrency:
18+
group: "pages"
19+
cancel-in-progress: true
20+
21+
jobs:
22+
deploy:
23+
name: Deploy to GitHub Pages
24+
runs-on: ubuntu-latest
25+
defaults:
26+
run:
27+
working-directory: docs
28+
steps:
29+
- uses: actions/checkout@v4
30+
- uses: actions/setup-node@v4
31+
with:
32+
node-version: 18
33+
cache: yarn
34+
cache-dependency-path: docs/yarn.lock
35+
36+
- name: Install dependencies
37+
run: yarn install --frozen-lockfile
38+
39+
- name: Build website
40+
run: yarn build
41+
42+
- name: Deploy to GitHub Pages
43+
uses: peaceiris/actions-gh-pages@v3
44+
with:
45+
github_token: ${{ secrets.GITHUB_TOKEN }}
46+
publish_dir: ./docs/build
47+
# User que fez o commit ao gh-pages branch
48+
user_name: github-actions[bot]
49+
user_email: 41898282+github-actions[bot]@users.noreply.github.com

docs/.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Dependencies
2+
/node_modules
3+
4+
# Production
5+
/build
6+
7+
# Generated files
8+
.docusaurus
9+
.cache-loader
10+
11+
# Misc
12+
.DS_Store
13+
.env.local
14+
.env.development.local
15+
.env.test.local
16+
.env.production.local
17+
18+
npm-debug.log*
19+
yarn-debug.log*
20+
yarn-error.log*

docs/README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Website
2+
3+
This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.
4+
5+
### Installation
6+
7+
```
8+
$ yarn
9+
```
10+
11+
### Local Development
12+
13+
```
14+
$ yarn start
15+
```
16+
17+
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
18+
19+
### Build
20+
21+
```
22+
$ yarn build
23+
```
24+
25+
This command generates static content into the `build` directory and can be served using any static contents hosting service.
26+
27+
### Deployment
28+
29+
Using SSH:
30+
31+
```
32+
$ USE_SSH=true yarn deploy
33+
```
34+
35+
Not using SSH:
36+
37+
```
38+
$ GIT_USER=<Your GitHub username> yarn deploy
39+
```
40+
41+
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.

docs/docs/advanced/_category_.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"label": "Advanced Configuration and Performance",
3+
"position": 5,
4+
"link": {
5+
"type": "generated-index",
6+
"description": "Advanced configuration options and performance tuning for Cardano Rosetta Java."
7+
}
8+
}
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
---
2+
sidebar_position: 1
3+
title: Advanced Configuration and Performance
4+
description: Advanced configuration options and performance tuning
5+
---
6+
7+
# Advanced Configuration and Performance
8+
9+
This guide provides details on how to tune **cardano-rosetta-java** for various workloads and resource constraints. It covers:
10+
11+
1. [Pruning (Disk Usage Optimization)](#1-pruning-disk-usage-optimization)
12+
2. [Database Pool Settings (HikariCP)](#2-database-pool-settings-hikaricp)
13+
3. [Tomcat Thread Configuration](#3-tomcat-thread-configuration)
14+
4. [Example `.env` Settings](#4-example-env-settings)
15+
16+
---
17+
18+
## 1. Pruning (Disk Usage Optimization)
19+
20+
Pruning removes spent (consumed) UTXOs from local storage, keeping only unspent UTXOs. This can reduce on-disk storage from ~1TB down to ~400GB, but discards historical transaction data.
21+
22+
- Only unspent outputs are preserved.
23+
- You can still validate the chain’s current state (and spend tokens), since active UTXOs remain.
24+
- **Enable Pruning**: Set `PRUNING_ENABLED=true` in your environment (e.g., in `.env.dockerfile` or `.env.docker-compose`).
25+
- **Disable Pruning** (default): Set `PRUNING_ENABLED=false`.
26+
27+
### 1.1. When to Enable Pruning
28+
29+
- **Low Disk Environments**: If you need to minimize disk usage and only require UTXO data for current balances.
30+
- **Exploratory / Dev Environments**: If historical queries are not critical.
31+
32+
### 1.2. When to Avoid Pruning
33+
34+
- **Full Historical Data Requirements**: If you need the complete transaction history—whether for exchange operations, audit trails, or compliance mandates—do not enable pruning. Pruning discards spent UTXOs, which removes older transaction data and prevents certain types of historical lookups or reporting.
35+
36+
---
37+
38+
## 2. Database Pool Settings (HikariCP)
39+
40+
cardano-rosetta-java uses [HikariCP](https://github.com/brettwooldridge/HikariCP) as the JDBC connection pool. Tuning these values can help manage concurrency and performance.
41+
42+
| Variable | Purpose | Common Defaults | Possible Tuning |
43+
| ------------------------------------------------- | -------------------------------------------------------- | --------------- | --------------- |
44+
| `SPRING_DATASOURCE_HIKARI_MAXIMUMPOOLSIZE` | Max number of DB connections in the pool | 10 (example) | 20–100 |
45+
| `SPRING_DATASOURCE_HIKARI_LEAKDETECTIONTHRESHOLD` | Time (ms) before a connection leak warning is logged | 30,000 | 300,000 |
46+
| `SPRING_DATASOURCE_HIKARI_CONNECTIONTIMEOUT` | Max time (ms) to wait for a free connection before error | 30,000 | 300,000 |
47+
48+
### 2.1. Example
49+
50+
If you’re dealing with high API request volume, consider:
51+
52+
```bash
53+
SPRING_DATASOURCE_HIKARI_MAXIMUMPOOLSIZE=50
54+
SPRING_DATASOURCE_HIKARI_LEAKDETECTIONTHRESHOLD=300000
55+
SPRING_DATASOURCE_HIKARI_CONNECTIONTIMEOUT=300000
56+
```
57+
58+
- This allows up to 50 connections in the pool.
59+
- The large leak detection threshold (5 minutes) can help in debugging slow queries.
60+
61+
### 2.2 When to Increase Pool Size
62+
63+
- If your logs show “connection timeout” or “pool is exhausted,” your current pool size may be insufficient.
64+
- Only increase `SPRING_DATASOURCE_HIKARI_MAXIMUMPOOLSIZE` if your database has the resources (CPU, RAM, I/O) to handle additional connections.
65+
66+
---
67+
68+
## 3. Tomcat Thread Configuration
69+
70+
By default, Spring Boot (Tomcat) handles incoming HTTP requests with a thread pool. If you anticipate **very high** concurrency, you might adjust:
71+
72+
- **`SERVER_TOMCAT_THREADS_MAX`**: Maximum number of threads Tomcat uses to handle requests.
73+
- Start with the default (`200`).
74+
- Increasing this limit can help in high-concurrency scenarios, but if your system’s bottleneck is elsewhere (e.g., database, network, or CPU), you may see limited performance gains.
75+
- **Only** increase if profiling shows that Tomcat threads are maxed out and your DB can keep up.
76+
- Check CPU/memory usage carefully; going too high can lead to contention and slowdowns.
77+
78+
---
79+
80+
## 4. Example `.env` Settings
81+
82+
Below is a snippet of how you might configure `.env.dockerfile` or `.env.docker-compose` for higher throughput:
83+
84+
```bash
85+
# --- Pruning Toggle ---
86+
PRUNING_ENABLED=false
87+
# Keep full history, requires ~1TB of disk space
88+
89+
# --- HikariCP Database Pool ---
90+
SPRING_DATASOURCE_HIKARI_MAXIMUMPOOLSIZE=50
91+
SPRING_DATASOURCE_HIKARI_LEAKDETECTIONTHRESHOLD=300000
92+
SPRING_DATASOURCE_HIKARI_CONNECTIONTIMEOUT=300000
93+
94+
# --- Tomcat Thread Pool ---
95+
# SERVER_TOMCAT_THREADS_MAX=200
96+
# Uncomment and set a higher value if needed:
97+
# SERVER_TOMCAT_THREADS_MAX=400
98+
```
99+
100+
---
101+
102+
## Further Reading
103+
104+
- [Rosetta API Reference](https://docs.cdp.coinbase.com/mesh/docs/api-reference/)
105+
- [Yaci-Store Repository](https://github.com/bloxbean/yaci-store)
106+
- [Spring Boot Docs](https://docs.spring.io/spring-boot/index.html) (for more advanced server and DB config)

docs/docs/api/_category_.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"label": "Cardano Specific API Additions",
3+
"position": 3,
4+
"link": {
5+
"type": "generated-index",
6+
"description": "Documentation for Cardano-specific API extensions and features in the Rosetta implementation."
7+
}
8+
}

0 commit comments

Comments
 (0)