|
| 1 | +import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; |
| 2 | + |
| 3 | +# Use docker |
| 4 | + |
| 5 | +You can use Docker to run dispute explorer backend service [Dispute-explorer](https://github.com/optimism-java/dispute-explorer). |
| 6 | + |
| 7 | +## Prerequisites |
| 8 | + |
| 9 | +Download and install [Docker](https://www.docker.com/products/docker-desktop). |
| 10 | + |
| 11 | +# Run Super-proof backend Step-by-Step |
| 12 | + |
| 13 | +# Step 1. Config Environment file |
| 14 | + |
| 15 | +``` |
| 16 | +mv .env.template .evn |
| 17 | +``` |
| 18 | + |
| 19 | +``` |
| 20 | +#log_format you can use console or json |
| 21 | +LOG_FORMAT=console |
| 22 | +
|
| 23 | +# config your mysql data source |
| 24 | +MYSQL_DATA_SOURCE=<data-source> |
| 25 | +
|
| 26 | +# config chain name to tag your block chain name |
| 27 | +BLOCKCHAIN=<block-chain-name> |
| 28 | +
|
| 29 | +# l1 rpc url example: eth json rpc url |
| 30 | +L1_RPC_URL=<l1-rpc> |
| 31 | +
|
| 32 | +RPC_RATE_LIMIT=15 |
| 33 | +RPC_RATE_BURST=5 |
| 34 | +
|
| 35 | +# the block number which before the first game has been created to make sure can not missing any game |
| 36 | +FROM_BLOCK_NUMBER=6034337 |
| 37 | +
|
| 38 | +# FROM_BLOCK_NUMBER block hash |
| 39 | +FROM_BLOCK_HASH=0xafc3e42c5899591501d29649ffef0bfdec68f8d77e6d44ee00ef88cfb1a2f163 |
| 40 | +
|
| 41 | +# the contract address of dispute game factory proxy |
| 42 | +DISPUTE_GAME_PROXY_CONTRACT=0x05F9613aDB30026FFd634f38e5C4dFd30a197Fa1 |
| 43 | +
|
| 44 | +API_PORT=8080 |
| 45 | +``` |
| 46 | + |
| 47 | +# Step 2. Start Dispute Game Explorer backend service |
| 48 | + |
| 49 | +use docker-compose to run this service |
| 50 | + |
| 51 | +``` |
| 52 | +cd deploy |
| 53 | +docker-compose -f docker-compose.yml up -d |
| 54 | +``` |
| 55 | + |
| 56 | +Now, this project is running now. |
| 57 | + |
| 58 | +Tip: if you just need a backend service to collect all data, Run Step 1 and Step 2. |
| 59 | + |
| 60 | +# Step 3. Run meiliSearch |
| 61 | + |
| 62 | +Run a meiliSearch service to sync MySql data for front service to search quickly |
| 63 | + |
| 64 | +``` |
| 65 | +cd deploy |
| 66 | +docker-compose -f docker-compose-meiliSearch.yml up -d meiliSearch |
| 67 | +``` |
| 68 | + |
| 69 | +Now, meiliSearch is running. |
| 70 | + |
| 71 | +# Step 4. Run meiliSync |
| 72 | + |
| 73 | +first, we need to find the api_key of meiliSearch |
| 74 | + |
| 75 | +``` |
| 76 | +curl -H "Authorization: Bearer <Token>" http://localhost:port/keys |
| 77 | +``` |
| 78 | + |
| 79 | +You should get a result, similar to : |
| 80 | + |
| 81 | +```json |
| 82 | +{ |
| 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 |
| 107 | +} |
| 108 | +``` |
| 109 | + |
| 110 | +And, use `Default Admin API Key`, `key` to update config.yml |
| 111 | + |
| 112 | +``` |
| 113 | +meilisearch: |
| 114 | + api_url: http://localhost:7701 |
| 115 | + api_key: abc40e8457b32aa86d20ab0db0b42a86298b253209c4c31d9936b378e686d132 |
| 116 | +``` |
| 117 | + |
| 118 | +launch the meiliSync service |
| 119 | + |
| 120 | +``` |
| 121 | +cd deploy |
| 122 | +docker-compose -f docker-compose-meiliSearch up -d meiliSync |
| 123 | +``` |
| 124 | + |
| 125 | +# Step 5. Validate meiliSync Service |
| 126 | + |
| 127 | +We can visit meiliSearch api to validate meiliSync service. more [meiliSearch docs](https://www.meilisearch.com/docs/reference/api/overview) |
| 128 | + |
| 129 | +``` |
| 130 | +curl -H "Authorization: Bearer <Token>" http://localhost:port/indexes |
| 131 | +``` |
| 132 | + |
| 133 | +You should get a result, similar to : |
| 134 | + |
| 135 | +```json |
| 136 | +{ |
| 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 |
| 166 | +} |
| 167 | +``` |
| 168 | + |
| 169 | +If you get information like this, it means our deploy it`s success. |
0 commit comments