Skip to content

Commit 6dac27d

Browse files
authored
Update installation.mdx
1 parent 71f5b96 commit 6dac27d

File tree

1 file changed

+208
-14
lines changed

1 file changed

+208
-14
lines changed

content/installation.mdx

Lines changed: 208 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,197 @@
1-
import styles from '../styles/installation.module.css'
2-
import { InstallationForm } from '../components/InstallationForm'
1+
# Installation - Using an Ansible Playbook to bootstrap ResilientDB
32

4-
# Installation Guide
5-
6-
Welcome to the installation guide for ResilientDB and its associated projects. This guide will help you set up the entire ResilientDB ecosystem on your machine using a custom-generated `INSTALL.sh` script.
3+
Docker image to provision and run ResilientDB along with supporting services (GraphQL, Crow HTTP server, Nginx) using systemd and Ansible.
74

85
---
96

10-
## 📋 **Prerequisites**
7+
## 📋 Prerequisites
118

129
Before you begin, ensure you have the following installed on your system:
10+
1311
**NOTE:** This project requires Ubuntu 20.04+
1412

15-
- **Git:** Version control system to clone repositories.
16-
- **Docker:** For containerized deployment (optional).
17-
- **cURL or Wget:** For downloading scripts.
18-
- **Bash Shell:** To run shell scripts.
13+
- **Git:** Version control system to clone repositories
14+
- **Docker:** For containerized deployment
15+
- **cURL or Wget:** For downloading scripts
16+
- **Bash Shell:** To run shell scripts
17+
18+
---
19+
20+
## 🚀 Quick Start
21+
22+
### Build the Docker Image
23+
24+
```bash
25+
docker build -t resilientdb-ansible .
26+
```
27+
28+
### Run the Container
29+
30+
```bash
31+
docker run --privileged \
32+
-v /sys/fs/cgroup:/sys/fs/cgroup:ro \
33+
-v /tmp:/tmp \
34+
-v /run:/run \
35+
-p 80:80 \
36+
-p 18000:18000 \
37+
-p 8000:8000 \
38+
resilientdb-ansible
39+
```
40+
41+
---
42+
43+
## 🔧 Alternative Installation Methods
44+
45+
### Option 1: Interactive Shell (Recommended for Troubleshooting)
46+
47+
If the container exits with error code 255, use this approach:
48+
49+
```bash
50+
docker run --privileged \
51+
-v /sys/fs/cgroup:/sys/fs/cgroup:ro \
52+
-v /tmp:/tmp \
53+
-v /run:/run \
54+
-p 80:80 \
55+
-p 18000:18000 \
56+
-p 8000:8000 \
57+
-d \
58+
--name resilientdb-container \
59+
--entrypoint /bin/bash \
60+
resilientdb-ansible \
61+
-c "while true; do sleep 30; done"
62+
```
63+
64+
Then access the container and run the manual startup script:
65+
66+
```bash
67+
# Access the container
68+
docker exec -it resilientdb-container /bin/bash
69+
70+
# Run the complete startup script
71+
cat > /opt/resilientdb-ansible/complete-startup.sh << 'EOF'
72+
#!/bin/bash
73+
echo "Killing existing processes..."
74+
75+
# Kill all existing services using pkill
76+
pkill -f kv_service 2>/dev/null || true
77+
pkill -f nginx 2>/dev/null || true
78+
pkill -f crow_service_main 2>/dev/null || true
79+
pkill -f crow-http 2>/dev/null || true
80+
pkill -f gunicorn 2>/dev/null || true
81+
pkill -f graphql 2>/dev/null || true
82+
83+
echo "Starting services fresh..."
84+
85+
# Start nginx
86+
nginx &
87+
echo "Nginx started"
88+
89+
# Start ResilientDB KV services (nodes 1-4)
90+
/opt/resilientdb/bazel-bin/service/kv/kv_service /opt/resilientdb/service/tools/config/server/server.config /opt/resilientdb/service/tools/data/cert/node1.key.pri /opt/resilientdb/service/tools/data/cert/cert_1.cert &
91+
echo "ResilientDB KV Node 1 started"
92+
93+
/opt/resilientdb/bazel-bin/service/kv/kv_service /opt/resilientdb/service/tools/config/server/server.config /opt/resilientdb/service/tools/data/cert/node2.key.pri /opt/resilientdb/service/tools/data/cert/cert_2.cert &
94+
echo "ResilientDB KV Node 2 started"
95+
96+
/opt/resilientdb/bazel-bin/service/kv/kv_service /opt/resilientdb/service/tools/config/server/server.config /opt/resilientdb/service/tools/data/cert/node3.key.pri /opt/resilientdb/service/tools/data/cert/cert_3.cert &
97+
echo "ResilientDB KV Node 3 started"
98+
99+
/opt/resilientdb/bazel-bin/service/kv/kv_service /opt/resilientdb/service/tools/config/server/server.config /opt/resilientdb/service/tools/data/cert/node4.key.pri /opt/resilientdb/service/tools/data/cert/cert_4.cert &
100+
echo "ResilientDB KV Node 4 started"
101+
102+
# Start ResilientDB Client (node 5)
103+
/opt/resilientdb/bazel-bin/service/kv/kv_service /opt/resilientdb/service/tools/config/server/server.config /opt/resilientdb/service/tools/data/cert/node5.key.pri /opt/resilientdb/service/tools/data/cert/cert_5.cert &
104+
echo "ResilientDB Client (Node 5) started"
105+
106+
# Start Crow HTTP service
107+
cd /opt/ResilientDB-GraphQL
108+
/opt/ResilientDB-GraphQL/bazel-bin/service/http_server/crow_service_main service/tools/config/interface/client.config service/http_server/server_config.config &
109+
echo "Crow HTTP service started"
110+
111+
# Start GraphQL service
112+
cd /opt/ResilientDB-GraphQL
113+
export PATH="/opt/ResilientDB-GraphQL/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
114+
/usr/bin/gunicorn -w 10 -b 0.0.0.0:8000 --pythonpath /opt/ResilientDB-GraphQL/venv/lib/python3.10/site-packages --timeout 120 app:app &
115+
echo "GraphQL service started"
116+
117+
echo "All services started. Checking status..."
118+
sleep 10
119+
ps aux | grep -E "(kv_service|nginx|crow|gunicorn)"
120+
121+
# Check if all required ports are listening
122+
echo "Checking ports..."
123+
netstat -tlnp | grep -E ":(80|8000|18000|10001|10002|10003|10004|10005)"
124+
125+
# Keep the script running
126+
tail -f /dev/null
127+
EOF
128+
129+
# Make it executable and run
130+
chmod +x /opt/resilientdb-ansible/complete-startup.sh
131+
/opt/resilientdb-ansible/complete-startup.sh
132+
```
133+
134+
### Option 2: Direct Ansible Playbook
135+
136+
For advanced users who want to run the Ansible playbook directly:
137+
138+
```bash
139+
# Clone the repository
140+
git clone https://github.com/apache/incubator-resilientdb-ansible.git
141+
cd incubator-resilientdb-ansible
142+
143+
# Install Ansible (if not already installed)
144+
sudo apt update && sudo apt install ansible
145+
146+
# Run the playbook
147+
ansible-playbook site.yml -i inventories/production/hosts
148+
```
149+
150+
---
151+
152+
## 🏗️ Service Architecture
153+
154+
The deployment includes:
155+
156+
- **ResilientDB KV Cluster**: 4 nodes (ports 10001-10004) + 1 client (port 10005)
157+
- **Crow HTTP Server**: REST API (port 18000)
158+
- **GraphQL API**: GraphQL interface (port 8000)
159+
- **Nginx**: Reverse proxy (port 80)
19160

20161
---
21162

22-
## 🔧 **Custom Installation Script Generator**
163+
## 🔗 API Endpoints
164+
165+
### REST API (Crow HTTP)
166+
- **Commit Transaction**: `POST http://localhost:18000/v1/transactions/commit`
167+
- **Get Transaction**: `GET http://localhost:18000/v1/transactions/{id}`
23168

24-
Select the components you want to install, and a custom `INSTALL.sh` script will be generated for you.
169+
### GraphQL API
170+
- **GraphQL Endpoint**: `http://localhost:8000/graphql`
25171

26-
<InstallationForm />
172+
### Via Nginx Proxy
173+
- **REST API**: `http://localhost/crow/`
174+
- **GraphQL API**: `http://localhost/graphql`
27175

28176
---
29177

30-
## **🚀 Using Each Project After Installation**
178+
## Testing the Setup
179+
180+
```bash
181+
# Test REST API
182+
curl -X POST http://localhost:18000/v1/transactions/commit \
183+
-H "Content-Type: application/json" \
184+
-d '{"id": "test", "value": "data"}'
185+
186+
# Test GraphQL API
187+
curl -X POST http://localhost:8000/graphql \
188+
-H "Content-Type: application/json" \
189+
-d '{"query": "{ __schema { types { name } } }"}'
190+
```
191+
192+
---
193+
194+
## Using Each Project After Installation
31195

32196
Once you've installed the selected projects, check out the Ecosystem and Application tabs for more information:
33197

@@ -37,3 +201,33 @@ Once you've installed the selected projects, check out the Ecosystem and Applica
37201
- [Smart-Contracts-CLI](https://resilientecosystem.github.io/resilientdb-quickstart/usage/smart-contracts-cli/)
38202
- [Smart-Contracts-GraphQL](https://resilientecosystem.github.io/resilientdb-quickstart/usage/smart-contracts-graphql/)
39203
- [ResVault](https://resilientecosystem.github.io/resilientdb-quickstart/usage/resvault/)
204+
205+
---
206+
207+
## 🐛 Common Issues
208+
209+
### "Connection refused" errors
210+
- Ensure all ResilientDB services are running (including the client on port 10005)
211+
- Check that ports are properly exposed in Docker run command
212+
213+
### "Failed to connect to bus" errors
214+
- This indicates systemd issues - use the manual startup script instead
215+
- The manual approach bypasses systemd and starts services directly
216+
217+
### Services not responding
218+
- Check if all processes are running: `ps aux | grep -E "(kv_service|nginx|crow|gunicorn)"`
219+
- Verify ports are listening: `netstat -tlnp | grep -E ":(80|8000|18000|10001|10002|10003|10004|10005)"`
220+
221+
---
222+
223+
## 📚 Additional Resources
224+
225+
- **Official Repository**: [https://github.com/apache/incubator-resilientdb-ansible](https://github.com/apache/incubator-resilientdb-ansible)
226+
- **ResilientDB Documentation**: [https://resilientdb.incubator.apache.org/](https://resilientdb.incubator.apache.org/)
227+
- **Apache Incubator**: [https://incubator.apache.org/](https://incubator.apache.org/)
228+
229+
---
230+
231+
## License
232+
233+
Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) file for details.

0 commit comments

Comments
 (0)