Skip to content

Commit 40889c3

Browse files
committed
improve variables and README.md
1 parent 315f24f commit 40889c3

5 files changed

Lines changed: 61 additions & 149 deletions

File tree

infra/aggregation_mode/ansible/README.md

Lines changed: 21 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -106,112 +106,37 @@ All servers are provisioned via Terraform and connected via Tailscale VPN. They
106106

107107
## Initial Setup
108108

109-
All configuration is consolidated into environment-specific files with predefined values. You only need to fill in sensitive values (passwords, certificate paths).
109+
All configuration is consolidated into environment-specific files with predefined values. You only need to fill in sensitive values at the top of each config file.
110110

111-
### 1. Configure Hoodi Environment
111+
### Configure Environment
112112

113-
Edit `playbooks/ini/config-hoodi.ini`:
113+
Edit the config file for your environment:
114+
- **Hoodi**: `playbooks/ini/config-hoodi.ini`
115+
- **Mainnet**: `playbooks/ini/config-mainnet.ini`
114116

115-
All non-sensitive values are already pre-filled. You only need to set:
117+
All non-sensitive values are already pre-filled. Fill in the required values at the top of the file:
116118

117119
```ini
118-
[DEFAULT]
119-
# ... (all values pre-filled) ...
120-
121-
# REQUIRED: Set a strong password before deploying
120+
# ============================================
121+
# REQUIRED: Sensitive Values (fill these in)
122+
# ============================================
123+
# Database password (used by postgres, gateway, and poller)
122124
db_password=your_secure_password_here
123125

124-
# REQUIRED: Same password for gateway/poller database access
125-
gateway_db_password=your_secure_password_here
126-
127-
# REQUIRED: Provide local paths to your TLS certificate files
128-
tls_cert_source_path=/path/to/your/cert.pem
129-
tls_key_source_path=/path/to/your/key.pem
130-
131-
# REQUIRED: Same password for Grafana Postgres datasource
126+
# Grafana read-only database user password
132127
grafana_postgres_password=your_secure_password_here
133128

134-
# REQUIRED: Private key for task sender (sends proofs to network)
135-
task_sender_private_key=0xYourPrivateKeyHere
136-
```
137-
138-
**⚠️ CRITICAL**: All three password fields must be set to the same value before deploying!
139-
140-
### 2. Configure Mainnet Environment (if needed)
141-
142-
Edit `playbooks/ini/config-mainnet.ini`:
143-
144-
Similar to Hoodi, fill in the required values:
145-
146-
```ini
147-
[DEFAULT]
148-
# ... (most values pre-filled) ...
149-
150-
# REQUIRED: Set passwords (same as above)
151-
db_password=your_secure_password_here
152-
gateway_db_password=your_secure_password_here
153-
grafana_postgres_password=your_secure_password_here
154-
155-
# REQUIRED: TLS certificate paths
129+
# TLS certificates (local paths to copy from)
156130
tls_cert_source_path=/path/to/your/cert.pem
157131
tls_key_source_path=/path/to/your/key.pem
158132

159-
# REQUIRED: Private key for task sender
160-
task_sender_private_key=0xYourPrivateKeyHere
133+
# Grafana admin password
134+
grafana_admin_password=your_grafana_admin_password
161135

162-
# TODO: Update these for mainnet deployment
163-
gateway_payment_service_address=0xYourMainnetPaymentServiceAddress
164-
gateway_eth_rpc_url=https://your-mainnet-rpc-url
165-
grafana_rpc_url=https://your-mainnet-rpc-url
136+
# Task sender private key (for sending proofs)
137+
task_sender_private_key=0xYourPrivateKeyHere
166138
```
167139

168-
### Configuration File Structure
169-
170-
The consolidated config files contain all settings organized by component:
171-
172-
```ini
173-
# config-hoodi.ini structure:
174-
[DEFAULT]
175-
environment=hoodi
176-
git_branch=staging
177-
178-
# PostgreSQL Configuration
179-
postgres_monitor_hostname=agg-mode-hoodi-postgres-monitor
180-
postgres_primary_hostname=agg-mode-hoodi-postgres-1
181-
postgres_secondary_hostname=agg-mode-hoodi-postgres-2
182-
db_name=agg_mode
183-
db_user=autoctl_node
184-
db_password= # ← FILL THIS IN
185-
186-
# Gateway & Poller Configuration
187-
gateway_network=Hoodi
188-
gateway_payment_service_address=0x7222E0183cE1A96619d0c883e9bfc6b76D4e780e
189-
gateway_eth_rpc_url=https://aligned-hoodi-rpc-geth.tail665ae.ts.net
190-
gateway_db_password= # ← FILL THIS IN (same as db_password)
191-
# ... other gateway settings ...
192-
193-
# TLS Certificate Management
194-
tls_cert_source_path= # ← FILL THIS IN
195-
tls_key_source_path= # ← FILL THIS IN
196-
197-
# Metrics Configuration
198-
grafana_postgres_password= # ← FILL THIS IN (same as db_password)
199-
# ... other metrics settings ...
200-
201-
# Task Sender Configuration
202-
task_sender_interval_hours=1
203-
task_sender_proof_path=scripts/test_files/sp1/sp1_fibonacci_5_0_0.proof
204-
task_sender_vk_path=scripts/test_files/sp1/sp1_fibonacci_5_0_0_vk.bin
205-
task_sender_private_key= # ← FILL THIS IN
206-
task_sender_network=hoodi
207-
```
208-
209-
The Ansible templates will automatically generate two separate database connection URLs for failover:
210-
- `postgres://autoctl_node:password@agg-mode-hoodi-postgres-1:5432/agg_mode`
211-
- `postgres://autoctl_node:password@agg-mode-hoodi-postgres-2:5432/agg_mode`
212-
213-
The sqlx driver will try them in order for automatic failover
214-
215140
## Deployment
216141

217142
### Full Stack Deployment
@@ -540,10 +465,7 @@ ssh admin@agg-mode-hoodi-postgres-1 "sudo journalctl -u pgautofailover -n 100"
540465

541466
**Problem: Password authentication fails**
542467

543-
Verify password is set correctly in your environment config file (`config-hoodi.ini` or `config-mainnet.ini`). All three password fields must match:
544-
- `db_password`
545-
- `gateway_db_password`
546-
- `grafana_postgres_password`
468+
Verify `db_password` is set correctly in your environment config file (`config-hoodi.ini` or `config-mainnet.ini`).
547469

548470
Check pg_hba.conf:
549471
```bash
@@ -566,7 +488,7 @@ ssh app@agg-mode-hoodi-gateway-1 "sudo journalctl -u gateway -n 100"
566488

567489
Common issues:
568490
- Missing TLS certificates → Check paths in `config-{{ env }}.ini` (tls_cert_source_path, tls_key_source_path)
569-
- Database connection failed → Verify password in `config-{{ env }}.ini` (gateway_db_password)
491+
- Database connection failed → Verify `db_password` in `config-{{ env }}.ini`
570492
- Port 443 already in use → Check with `sudo lsof -i :443`
571493

572494
**Problem: TLS certificate errors**
@@ -806,10 +728,9 @@ This always rebuilds binaries from the latest code, even if they already exist.
806728

807729
### Rotating Passwords
808730

809-
1. Update all three password fields in your environment config file (`config-hoodi.ini` or `config-mainnet.ini`):
810-
- `db_password`
811-
- `gateway_db_password`
812-
- `grafana_postgres_password`
731+
1. Update password fields in your environment config file (`config-hoodi.ini` or `config-mainnet.ini`):
732+
- `db_password` (used by postgres, gateway, and poller)
733+
- `grafana_postgres_password` (separate read-only user)
813734
2. Run password update on PostgreSQL:
814735
```bash
815736
ssh admin@agg-mode-hoodi-postgres-monitor "sudo -u postgres psql -d pg_auto_failover -c \"ALTER USER autoctl_node PASSWORD 'new_password'\""

infra/aggregation_mode/ansible/playbooks/gateway.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
gateway_tls_port: "{{ lookup('ini', 'gateway_tls_port', file=config_file, default='443') }}"
2727
gateway_tls_cert_path: "{{ lookup('ini', 'gateway_tls_cert_path', file=config_file) }}"
2828
gateway_tls_key_path: "{{ lookup('ini', 'gateway_tls_key_path', file=config_file) }}"
29-
gateway_db_user: "{{ lookup('ini', 'gateway_db_user', file=config_file) }}"
30-
gateway_db_password: "{{ lookup('ini', 'gateway_db_password', file=config_file) }}"
31-
gateway_db_name: "{{ lookup('ini', 'gateway_db_name', file=config_file) }}"
29+
gateway_db_user: "{{ lookup('ini', 'db_user', file=config_file) }}"
30+
gateway_db_password: "{{ lookup('ini', 'db_password', file=config_file) }}"
31+
gateway_db_name: "{{ lookup('ini', 'db_name', file=config_file) }}"
3232
gateway_postgres_primary: "{{ lookup('ini', 'gateway_postgres_primary', file=config_file) }}"
3333
gateway_postgres_secondary: "{{ lookup('ini', 'gateway_postgres_secondary', file=config_file) }}"
3434
gateway_postgres_port: "{{ lookup('ini', 'gateway_postgres_port', file=config_file, default='5432') }}"

infra/aggregation_mode/ansible/playbooks/ini/config-hoodi.ini

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,25 @@
33
# Hoodi Environment Configuration
44
# ============================================
55
# This file contains all configuration for the Hoodi environment.
6-
# Only sensitive values (passwords, certificate paths) need to be filled in.
76

7+
# ============================================
8+
# REQUIRED: Sensitive Values (fill these in)
9+
# ============================================
10+
# Database password (used by postgres, gateway, and poller)
11+
db_password=
12+
# Grafana read-only database user password
13+
grafana_postgres_password=
14+
# TLS certificates (local paths to copy from)
15+
tls_cert_source_path=
16+
tls_key_source_path=
17+
# Grafana admin password
18+
grafana_admin_password=
19+
# Task sender private key (for sending proofs)
20+
task_sender_private_key=
21+
22+
# ============================================
823
# Environment
24+
# ============================================
925
environment=hoodi
1026
git_branch=staging
1127

@@ -17,8 +33,6 @@ postgres_primary_hostname=agg-mode-hoodi-postgres-1
1733
postgres_secondary_hostname=agg-mode-hoodi-postgres-2
1834
db_name=agg_mode
1935
db_user=autoctl_node
20-
# REQUIRED: Set this password before deploying postgres
21-
db_password=
2236

2337
# PostgreSQL Monitor
2438
monitor_pgdata=/var/lib/postgresql/monitor
@@ -37,11 +51,6 @@ gateway_max_daily_proofs=100
3751
gateway_payment_service_address=0x7222E0183cE1A96619d0c883e9bfc6b76D4e780e
3852
gateway_eth_rpc_url=https://aligned-hoodi-rpc-geth.tail665ae.ts.net
3953

40-
# Database connection (uses same credentials as postgres)
41-
gateway_db_user=autoctl_node
42-
# REQUIRED: Set to same password as db_password
43-
gateway_db_password=
44-
gateway_db_name=agg_mode
4554
gateway_postgres_primary=agg-mode-hoodi-postgres-1
4655
gateway_postgres_secondary=agg-mode-hoodi-postgres-2
4756
gateway_postgres_port=5432
@@ -61,14 +70,6 @@ gateway_tls_key_path=/home/app/.ssl/key.pem
6170
poller_last_block_fetched_filepath=/home/app/config/proof-aggregator.last_block_fetched.json
6271
last_block_fetched_initial_value=0
6372

64-
# ============================================
65-
# TLS Certificate Management
66-
# ============================================
67-
# REQUIRED: Provide paths to existing certificates on your local machine
68-
# These will be copied to the gateway servers
69-
tls_cert_source_path=
70-
tls_key_source_path=
71-
7273
# ============================================
7374
# Metrics Configuration
7475
# ============================================
@@ -77,22 +78,17 @@ gateway_primary_hostname=agg-mode-hoodi-gateway-1
7778
gateway_secondary_hostname=agg-mode-hoodi-gateway-2
7879

7980
# Grafana Configuration
80-
grafana_admin_password=
8181
grafana_prometheus_url=http://localhost:9090
8282
grafana_rpc_url=https://aligned-hoodi-rpc-geth.tail665ae.ts.net
8383
grafana_postgres_host=agg-mode-hoodi-postgres-1
8484
grafana_postgres_port=5432
8585
grafana_postgres_db=agg_mode
8686
grafana_postgres_user=grafana
87-
# REQUIRED: Set to same password as db_password
88-
grafana_postgres_password=
8987

9088
# ============================================
9189
# Task Sender Configuration
9290
# ============================================
9391
task_sender_interval_hours=1
9492
task_sender_proof_path=scripts/test_files/sp1/sp1_fibonacci_5_0_0.proof
9593
task_sender_vk_path=scripts/test_files/sp1/sp1_fibonacci_5_0_0_vk.bin
96-
# REQUIRED: Set private key for sending proofs
97-
task_sender_private_key=
9894
task_sender_network=hoodi

infra/aggregation_mode/ansible/playbooks/ini/config-mainnet.ini

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,25 @@
33
# Mainnet Environment Configuration
44
# ============================================
55
# This file contains all configuration for the Mainnet environment.
6-
# Only sensitive values (passwords, certificate paths) need to be filled in.
76

7+
# ============================================
8+
# REQUIRED: Sensitive Values (fill these in)
9+
# ============================================
10+
# Database password (used by postgres, gateway, and poller)
11+
db_password=
12+
# Grafana read-only database user password
13+
grafana_postgres_password=
14+
# TLS certificates (local paths to copy from)
15+
tls_cert_source_path=
16+
tls_key_source_path=
17+
# Grafana admin password
18+
grafana_admin_password=
19+
# Task sender private key (for sending proofs)
20+
task_sender_private_key=
21+
22+
# ============================================
823
# Environment
24+
# ============================================
925
environment=mainnet
1026
git_branch=staging
1127

@@ -17,8 +33,6 @@ postgres_primary_hostname=agg-mode-mainnet-postgres-1
1733
postgres_secondary_hostname=agg-mode-mainnet-postgres-2
1834
db_name=agg_mode
1935
db_user=autoctl_node
20-
# REQUIRED: Set this password before deploying postgres
21-
db_password=
2236

2337
# PostgreSQL Monitor
2438
monitor_pgdata=/var/lib/postgresql/monitor
@@ -37,11 +51,6 @@ gateway_max_daily_proofs=100
3751
gateway_payment_service_address=0xc8631Bc1E60c20db40e474F791126212fA8255F4
3852
gateway_eth_rpc_url=https://aligned-mainnet-rpc-1.tail665ae.ts.net
3953

40-
# Database connection (uses same credentials as postgres)
41-
gateway_db_user=autoctl_node
42-
# REQUIRED: Set to same password as db_password
43-
gateway_db_password=
44-
gateway_db_name=agg_mode
4554
gateway_postgres_primary=agg-mode-mainnet-postgres-1
4655
gateway_postgres_secondary=agg-mode-mainnet-postgres-2
4756
gateway_postgres_port=5432
@@ -61,14 +70,6 @@ gateway_tls_key_path=/home/app/.ssl/key.pem
6170
poller_last_block_fetched_filepath=/home/app/config/proof-aggregator.last_block_fetched.json
6271
last_block_fetched_initial_value=24235289
6372

64-
# ============================================
65-
# TLS Certificate Management
66-
# ============================================
67-
# REQUIRED: Provide paths to existing certificates on your local machine
68-
# These will be copied to the gateway servers
69-
tls_cert_source_path=
70-
tls_key_source_path=
71-
7273
# ============================================
7374
# Metrics Configuration
7475
# ============================================
@@ -77,23 +78,17 @@ gateway_primary_hostname=agg-mode-mainnet-gateway-1
7778
gateway_secondary_hostname=agg-mode-mainnet-gateway-2
7879

7980
# Grafana Configuration
80-
grafana_admin_password=
8181
grafana_prometheus_url=http://localhost:9090
82-
# TODO: Update with mainnet RPC URL
8382
grafana_rpc_url=https://aligned-mainnet-rpc-1.tail665ae.ts.net
8483
grafana_postgres_host=agg-mode-mainnet-postgres-1
8584
grafana_postgres_port=5432
8685
grafana_postgres_db=agg_mode
8786
grafana_postgres_user=grafana
88-
# REQUIRED: Set to same password as db_password
89-
grafana_postgres_password=
9087

9188
# ============================================
9289
# Task Sender Configuration
9390
# ============================================
9491
task_sender_interval_hours=1
9592
task_sender_proof_path=scripts/test_files/sp1/sp1_fibonacci_5_0_0.proof
9693
task_sender_vk_path=scripts/test_files/sp1/sp1_fibonacci_5_0_0_vk.bin
97-
# REQUIRED: Set private key for sending proofs
98-
task_sender_private_key=
9994
task_sender_network=mainnet

infra/aggregation_mode/ansible/playbooks/poller.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
- name: Set config vars from INI file
2222
set_fact:
2323
git_branch: "{{ lookup('ini', 'git_branch', file=config_file) }}"
24-
poller_db_user: "{{ lookup('ini', 'gateway_db_user', file=config_file) }}"
25-
poller_db_password: "{{ lookup('ini', 'gateway_db_password', file=config_file) }}"
26-
poller_db_name: "{{ lookup('ini', 'gateway_db_name', file=config_file) }}"
24+
poller_db_user: "{{ lookup('ini', 'db_user', file=config_file) }}"
25+
poller_db_password: "{{ lookup('ini', 'db_password', file=config_file) }}"
26+
poller_db_name: "{{ lookup('ini', 'db_name', file=config_file) }}"
2727
poller_postgres_primary: "{{ lookup('ini', 'gateway_postgres_primary', file=config_file) }}"
2828
poller_postgres_secondary: "{{ lookup('ini', 'gateway_postgres_secondary', file=config_file) }}"
2929
poller_postgres_port: "{{ lookup('ini', 'gateway_postgres_port', file=config_file, default='5432') }}"

0 commit comments

Comments
 (0)