Skip to content

Commit 434220c

Browse files
authoredAug 20, 2024··
Merge pull request #7 from optimism-java/frontend
feat: add deploy doc for super proof frontend
2 parents f12f2e0 + 2c7fb40 commit 434220c

File tree

1 file changed

+139
-55
lines changed

1 file changed

+139
-55
lines changed
 

‎docs/super-proof-docs/deployment/use_docker.md

+139-55
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ mv .env.template .evn
1818

1919
```
2020
#log_format you can use console or json
21-
LOG_FORMAT=console
21+
LOG_FORMAT=console
2222
2323
# config your mysql data source
2424
MYSQL_DATA_SOURCE=<data-source>
@@ -80,38 +80,41 @@ You should get a result, similar to :
8080

8181
```json
8282
{
83-
"results": [{
84-
"name": "Default Search API Key",
85-
"description": "Use it to search from the frontend",
86-
"key": "d09536ef1e2742b4792c607465dc169f659f1b2dcb0107bfdce2542b602ed534",
87-
"uid": "675ff658-9e73-460c-a3be-c6fcee624edf",
88-
"actions": ["search"],
89-
"indexes": ["*"],
90-
"expiresAt": null,
91-
"createdAt": "2024-08-06T08:47:38.225365511Z",
92-
"updatedAt": "2024-08-06T08:47:38.225365511Z"
93-
}, {
94-
"name": "Default Admin API Key",
95-
"description": "Use it for anything that is not a search operation. Caution! Do not expose it on a public frontend",
96-
"key": "abc40e8457b32aa86d20ab0db0b42a86298b253209c4c31d9936b378e686d132",
97-
"uid": "db1499f6-59a1-42c7-a13a-e18e191f456c",
98-
"actions": ["*"],
99-
"indexes": ["*"],
100-
"expiresAt": null,
101-
"createdAt": "2024-08-06T08:47:38.225052792Z",
102-
"updatedAt": "2024-08-06T08:47:38.225052792Z"
103-
}],
104-
"offset": 0,
105-
"limit": 20,
106-
"total": 2
83+
"results": [
84+
{
85+
"name": "Default Search API Key",
86+
"description": "Use it to search from the frontend",
87+
"key": "d09536ef1e2742b4792c607465dc169f659f1b2dcb0107bfdce2542b602ed534",
88+
"uid": "675ff658-9e73-460c-a3be-c6fcee624edf",
89+
"actions": ["search"],
90+
"indexes": ["*"],
91+
"expiresAt": null,
92+
"createdAt": "2024-08-06T08:47:38.225365511Z",
93+
"updatedAt": "2024-08-06T08:47:38.225365511Z"
94+
},
95+
{
96+
"name": "Default Admin API Key",
97+
"description": "Use it for anything that is not a search operation. Caution! Do not expose it on a public frontend",
98+
"key": "abc40e8457b32aa86d20ab0db0b42a86298b253209c4c31d9936b378e686d132",
99+
"uid": "db1499f6-59a1-42c7-a13a-e18e191f456c",
100+
"actions": ["*"],
101+
"indexes": ["*"],
102+
"expiresAt": null,
103+
"createdAt": "2024-08-06T08:47:38.225052792Z",
104+
"updatedAt": "2024-08-06T08:47:38.225052792Z"
105+
}
106+
],
107+
"offset": 0,
108+
"limit": 20,
109+
"total": 2
107110
}
108111
```
109112

110113
And, use `Default Admin API Key`, `key` to update config.yml
111114

112115
```
113116
meilisearch:
114-
api_url: http://localhost:7701
117+
api_url: http://localhost:7701
115118
api_key: abc40e8457b32aa86d20ab0db0b42a86298b253209c4c31d9936b378e686d132
116119
```
117120

@@ -134,36 +137,117 @@ You should get a result, similar to :
134137

135138
```json
136139
{
137-
"results": [
138-
{
139-
"uid": "disputegame",
140-
"createdAt": "2024-08-06T09:24:24.640693956Z",
141-
"updatedAt": "2024-08-07T07:02:32.402360903Z",
142-
"primaryKey": "id"
143-
},
144-
{
145-
"uid": "gameclaim",
146-
"createdAt": "2024-08-06T09:24:24.670117944Z",
147-
"updatedAt": "2024-08-07T07:02:28.94487306Z",
148-
"primaryKey": "id"
149-
},
150-
{
151-
"uid": "gamecredit",
152-
"createdAt": "2024-08-06T10:37:42.013472322Z",
153-
"updatedAt": "2024-08-07T07:02:32.379350451Z",
154-
"primaryKey": "id"
155-
},
156-
{
157-
"uid": "syncevents",
158-
"createdAt": "2024-08-06T09:24:24.696318772Z",
159-
"updatedAt": "2024-08-07T07:02:30.382386632Z",
160-
"primaryKey": "id"
161-
}
162-
],
163-
"offset": 0,
164-
"limit": 20,
165-
"total": 4
140+
"results": [
141+
{
142+
"uid": "disputegame",
143+
"createdAt": "2024-08-06T09:24:24.640693956Z",
144+
"updatedAt": "2024-08-07T07:02:32.402360903Z",
145+
"primaryKey": "id"
146+
},
147+
{
148+
"uid": "gameclaim",
149+
"createdAt": "2024-08-06T09:24:24.670117944Z",
150+
"updatedAt": "2024-08-07T07:02:28.94487306Z",
151+
"primaryKey": "id"
152+
},
153+
{
154+
"uid": "gamecredit",
155+
"createdAt": "2024-08-06T10:37:42.013472322Z",
156+
"updatedAt": "2024-08-07T07:02:32.379350451Z",
157+
"primaryKey": "id"
158+
},
159+
{
160+
"uid": "syncevents",
161+
"createdAt": "2024-08-06T09:24:24.696318772Z",
162+
"updatedAt": "2024-08-07T07:02:30.382386632Z",
163+
"primaryKey": "id"
164+
}
165+
],
166+
"offset": 0,
167+
"limit": 20,
168+
"total": 4
166169
}
167170
```
168171

169172
If you get information like this, it means our deploy it`s success.
173+
174+
# Step 6. Start frontend
175+
176+
pull the docker image
177+
178+
```bash
179+
docker pull ghcr.io/optimism-java/dispute-explorer-frontend:development
180+
```
181+
182+
config the `nginx.conf`, below is a example, you should change the server part
183+
184+
```bash
185+
worker_processes 2;
186+
187+
events {
188+
worker_connections 1024;
189+
}
190+
191+
http {
192+
include mime.types;
193+
default_type application/octet-stream;
194+
195+
sendfile on;
196+
keepalive_timeout 65;
197+
198+
gzip on;
199+
200+
server {
201+
listen 80;
202+
location / {
203+
root html;
204+
index index.html index.htm;
205+
try_files $uri $uri/ /index.html;
206+
}
207+
location ~ /index/ {
208+
proxy_pass ${Sepolia meiliSearch}; # replace with Sepolia meiliSearch service url
209+
proxy_set_header Host $host;
210+
proxy_set_header X-Forward-For $remote_addr;
211+
proxy_set_header X-Forward-Proto $scheme;
212+
proxy_http_version 1.1;
213+
proxy_set_header Upgrade $http_upgrade;
214+
proxy_set_header Connection "upgrade";
215+
proxy_set_header Authorization "Bearer $TOKEN"; # replace TOKEN with Sepolia meiliSearch token
216+
}
217+
location ~ /indexMain/ {
218+
proxy_pass ${Mainnet meiliSearch}; # replace with Mainnet meiliSearch service url
219+
proxy_set_header Host $host;
220+
proxy_set_header X-Forward-For $remote_addr;
221+
proxy_set_header X-Forward-Proto $scheme;
222+
proxy_http_version 1.1;
223+
proxy_set_header Upgrade $http_upgrade;
224+
proxy_set_header Connection "upgrade";
225+
proxy_set_header Authorization "Bearer $TOKEN"; # replace TOKEN with Mainnet meiliSearch token
226+
}
227+
location ~ /api/ {
228+
proxy_pass ${Sepolia api server}; # replace with Sepolia api service url
229+
proxy_set_header Host $host;
230+
proxy_set_header X-Forward-For $remote_addr;
231+
proxy_set_header X-Forward-Proto $scheme;
232+
proxy_http_version 1.1;
233+
proxy_set_header Upgrade $http_upgrade;
234+
proxy_set_header Connection "upgrade";
235+
}
236+
location ~ /apiMain/ {
237+
proxy_pass ${Mainnet api server}; # replace with Mainnet api service url
238+
proxy_set_header Host $host;
239+
proxy_set_header X-Forward-For $remote_addr;
240+
proxy_set_header X-Forward-Proto $scheme;
241+
proxy_http_version 1.1;
242+
proxy_set_header Upgrade $http_upgrade;
243+
proxy_set_header Connection "upgrade";
244+
}
245+
}
246+
}
247+
```
248+
249+
start the image, replace the `docker run -d -v` to the real `nginx.conf` path. Then you can visit `localhost:3000`
250+
251+
```bash
252+
docker run -d -v ${path to nginx.conf}:/etc/nginx/nginx.conf -p 3000:80 ghcr.io/optimism-java/dispute-explorer-frontend:development
253+
```

0 commit comments

Comments
 (0)
Please sign in to comment.