Skip to content

Commit 8a5a4d9

Browse files
Feat/upgrade protocol refactor (#359)
* refactor upgrade protocol to reflect stage and prod envs * remove files * fmt * deploy values
1 parent 0501452 commit 8a5a4d9

16 files changed

+199
-116
lines changed

deploy/stage/common-values-upgrade-server-left.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ env:
6060
secretKeyRef:
6161
key: DATABASE_URL
6262
name: application
63+
- name: ENVIRONMENT
64+
value: stage
6365

6466

6567
keelPolling:

deploy/stage/common-values-upgrade-server-right.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ env:
6060
secretKeyRef:
6161
key: DATABASE_URL
6262
name: application
63-
63+
- name: ENVIRONMENT
64+
value: stage
6465

6566
keelPolling:
6667
# -- Specifies whether keel should poll for container updates

deploy/stage/mpc1-stage/values-upgrade-server-left.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ args:
77
- "0"
88
- "--eye"
99
- "left"
10+
- "--environment"
11+
- "$(ENVIRONMENT)"

deploy/stage/mpc1-stage/values-upgrade-server-right.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ args:
77
- "0"
88
- "--eye"
99
- "right"
10+
- "--environment"
11+
- "$(ENVIRONMENT)"

deploy/stage/mpc2-stage/values-upgrade-server-left.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ args:
77
- "1"
88
- "--eye"
99
- "left"
10+
- "--environment"
11+
- "$(ENVIRONMENT)"

deploy/stage/mpc2-stage/values-upgrade-server-right.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ args:
66
- "--party-id"
77
- "1"
88
- "--eye"
9-
- "right"
9+
- "right"
10+
- "--environment"
11+
- "$(ENVIRONMENT)"

deploy/stage/mpc3-stage/values-upgrade-server-left.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ args:
77
- "2"
88
- "--eye"
99
- "left"
10+
- "--environment"
11+
- "$(ENVIRONMENT)"

deploy/stage/mpc3-stage/values-upgrade-server-right.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ args:
77
- "2"
88
- "--eye"
99
- "right"
10+
- "--environment"
11+
- "$(ENVIRONMENT)"

iris-mpc-upgrade/src/bin/README.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Upgrade Protocol
2+
3+
Quick local test setup of upgrade protocol:
4+
5+
## Start some DBs
6+
7+
```bash
8+
docker compose up -d
9+
```
10+
11+
will bring up two old dbs on ports 6200 and 6201, and 3 new dbs on ports 6100,6101,6102.
12+
13+
## Fill DBs with test data
14+
15+
```bash
16+
cargo run --release --bin seed-v1-dbs -- --side right --shares-db-urls postgres://postgres:postgres@localhost:6100 --shares-db-urls postgres://postgres:postgres@localhost:6101 --masks-db-url postgres://postgres:postgres@localhost:6111 --num-elements 10000
17+
cargo run --release --bin seed-v1-dbs -- --side left --shares-db-urls postgres://postgres:postgres@localhost:6100 --shares-db-urls postgres://postgres:postgres@localhost:6101 --masks-db-url postgres://postgres:postgres@localhost:6111 --num-elements 10000
18+
```
19+
20+
## Upgrade for left eye
21+
22+
### Run the 3 upgrade servers
23+
24+
Concurrently run:
25+
26+
```bash
27+
cargo run --release --bin upgrade-server -- --bind-addr 127.0.0.1:8000 --db-url postgres://postgres:postgres@localhost:6200 --party-id 0 --eye left --environment dev
28+
```
29+
30+
```bash
31+
cargo run --release --bin upgrade-server -- --bind-addr 127.0.0.1:8001 --db-url postgres://postgres:postgres@localhost:6201 --party-id 1 --eye left --environment dev
32+
```
33+
34+
```bash
35+
cargo run --release --bin upgrade-server -- --bind-addr 127.0.0.1:8002 --db-url postgres://postgres:postgres@localhost:6202 --party-id 2 --eye left --environment dev
36+
```
37+
38+
### Run the 2 upgrade clients
39+
40+
Concurrently run:
41+
42+
```bash
43+
cargo run --release --bin upgrade-client -- --server1 127.0.0.1:8000 --server2 127.0.0.1:8001 --server3 127.0.0.1:8002 --db-start 0 --db-end 10000 --party-id 0 --eye left --shares-db-url postgres://postgres:postgres@localhost:6100 --masks-db-url postgres://postgres:postgres@localhost:6111
44+
cargo run --release --bin upgrade-client -- --server1 127.0.0.1:8000 --server2 127.0.0.1:8001 --server3 127.0.0.1:8002 --db-start 0 --db-end 10000 --party-id 1 --eye left --shares-db-url postgres://postgres:postgres@localhost:6101 --masks-db-url postgres://postgres:postgres@localhost:6111
45+
```
46+
47+
## Upgrade for right eye
48+
49+
### Run the 3 upgrade servers
50+
51+
Concurrently run:
52+
53+
```bash
54+
cargo run --release --bin upgrade-server -- --bind-addr 127.0.0.1:8000 --db-url postgres://postgres:postgres@localhost:6200 --party-id 0 --eye right --environment dev
55+
```
56+
57+
```bash
58+
cargo run --release --bin upgrade-server -- --bind-addr 127.0.0.1:8001 --db-url postgres://postgres:postgres@localhost:6201 --party-id 1 --eye right --environment dev
59+
```
60+
61+
```bash
62+
cargo run --release --bin upgrade-server -- --bind-addr 127.0.0.1:8002 --db-url postgres://postgres:postgres@localhost:6202 --party-id 2 --eye right --environment dev
63+
```
64+
65+
### Run the 2 upgrade clients
66+
67+
(In practice these DBs would point to different old DBs, we just use the same old DBs for left and right in this example )
68+
69+
Concurrently run:
70+
71+
```bash
72+
cargo run --release --bin upgrade-client -- --server1 127.0.0.1:8000 --server2 127.0.0.1:8001 --server3 127.0.0.1:8002 --db-start 0 --db-end 10000 --party-id 0 --eye right --shares-db-url postgres://postgres:postgres@localhost:6100 --masks-db-url postgres://postgres:postgres@localhost:6111
73+
```
74+
```bash
75+
cargo run --release --bin upgrade-client -- --server1 127.0.0.1:8000 --server2 127.0.0.1:8001 --server3 127.0.0.1:8002 --db-start 0 --db-end 10000 --party-id 1 --eye right --shares-db-url postgres://postgres:postgres@localhost:6101 --masks-db-url postgres://postgres:postgres@localhost:6111
76+
77+
```
78+
## Check the upgrade was successful
79+
80+
```bash
81+
cargo run --release --bin upgrade-checker -- --environment dev --num-elements 10000 --db-urls postgres://postgres:postgres@localhost:6100 --db-urls postgres://postgres:postgres@localhost:6101 --db-urls postgres://postgres:postgres@localhost:6111 --db-urls postgres://postgres:postgres@localhost:6200 --db-urls postgres://postgres:postgres@localhost:6201 --db-urls postgres://postgres:postgres@localhost:6202
82+
```

iris-mpc-upgrade/src/bin/Readme.md

Lines changed: 0 additions & 85 deletions
This file was deleted.

0 commit comments

Comments
 (0)