-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial sync from aeternity repo (#1)
- Loading branch information
Showing
30 changed files
with
489 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
version: 2.1 | ||
commands: | ||
run_test_nodes: | ||
description: Run docker-compose nodes | ||
steps: | ||
- run: | ||
name: Run nodes in background | ||
command: docker-compose up | ||
background: true | ||
- run: | ||
name: Give it some time to boot the nodes | ||
command: sleep 30 | ||
|
||
health_check_node: | ||
description: Health Check a Node | ||
parameters: | ||
port: | ||
type: integer | ||
default: 3013 | ||
steps: | ||
- run: | ||
name: Health check APIs | ||
command: | | ||
EXTERNAL_ADDR=localhost:<< parameters.port >> \ | ||
INTERNAL_ADDR=localhost:<< parameters.port >> \ | ||
WEBSOCKET_ADDR=localhost:<< parameters.port >> \ | ||
./test/healthcheck.sh | ||
- run: | ||
name: Health check APIs (legacy routing) | ||
command: | | ||
EXTERNAL_ADDR=localhost:<< parameters.port >> \ | ||
INTERNAL_ADDR=localhost:<< parameters.port >>/internal \ | ||
WEBSOCKET_ADDR=localhost:<< parameters.port >> \ | ||
./test/healthcheck.sh | ||
integration_tests: | ||
description: Integration Tests | ||
steps: | ||
- health_check_node: | ||
port: 3001 | ||
- health_check_node: | ||
port: 3002 | ||
- health_check_node: | ||
port: 3003 | ||
|
||
jobs: | ||
integration_tests: | ||
machine: | ||
image: ubuntu-1604:201903-01 | ||
steps: | ||
- checkout | ||
- run_test_nodes | ||
- integration_tests | ||
|
||
workflows: | ||
test: | ||
jobs: | ||
- integration_tests: | ||
requires: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,68 @@ | ||
# localnet | ||
# Aeternity Localnet | ||
|
||
Docker-compose based configuration to easily run locally deployed dev/test network | ||
|
||
It runs three nodes using the `mean15-generic` miner (fastest generic miner) and a proxy server to allow CORS and URL routing. | ||
As the beneficiary key-pair is publicly available, this setup should *not* be connected to public networks. | ||
|
||
All local network nodes are configured with the same beneficiary account (for more details on beneficiary see [configuration documentation](https://github.com/aeternity/aeternity/blob/master/docs/configuration.md#beneficiary-account)): | ||
- public key: ak_twR4h7dEcUtc2iSEDv8kB7UFJJDGiEDQCXr85C3fYF8FdVdyo | ||
- private key secret: `secret` | ||
- key-pair binaries can be found in `/node/keys/beneficiary` directory of this repository | ||
|
||
All APIs (external, internal and state channels websocket) are exposed to the docker host, the URL pattern is as follows: | ||
- external/internal API - http://$DOCKER_HOST_ADDRESS:$NODE_PORT/ | ||
- channels API - ws://$DOCKER_HOST_ADDRESS:$NODE_PORT/channel | ||
|
||
Node ports: | ||
- `node1` - port 3001 | ||
- `node2` - port 3002 | ||
- `node3` - port 3003 | ||
|
||
For example to access `node2` peer public key, assuming docker host address is `localhost`: | ||
|
||
```bash | ||
curl http://localhost:3002/v2/peers/pubkey | ||
``` | ||
|
||
To start the network: | ||
|
||
```bash | ||
docker-compose up -d | ||
``` | ||
|
||
To destroy the network: | ||
|
||
```bash | ||
docker-compose down | ||
``` | ||
|
||
To cleanup the associated docker volumes, `-v` option could be used: | ||
|
||
```bash | ||
docker-compose down -v | ||
``` | ||
|
||
More details can be found in [`docker-compose` documentation](https://docs.docker.com/compose/reference/). | ||
|
||
### Image Version | ||
|
||
Docker compose uses the `aeternity/aeternity:latest` image by default, it will be pulled from [docker hub](https://hub.docker.com/r/aeternity/aeternity/) if it's not found locally. | ||
|
||
To change what node version is used set `IMAGE_TAG` environment variable, e.g.: | ||
|
||
```bash | ||
IMAGE_TAG=v4.0.0 docker-compose up -d | ||
``` | ||
|
||
This configuration is known to work with node versions >= 2.0.0 | ||
|
||
### Mining Rate | ||
|
||
By default the localnet has set default mine rate of 1 block per 15 seconds. | ||
It can be changed by setting `AETERNITY_MINE_RATE` environment variable. | ||
The variable is in milliseconds, so to set 1 block per 10 seconds use: | ||
|
||
```bash | ||
AETERNITY_MINE_RATE=10000 docker-compose up | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Small local network of three nodes using the fastest mean15 | ||
version: '3' | ||
services: | ||
node1: | ||
image: aeternity/aeternity:${IMAGE_TAG-latest} | ||
hostname: node1 | ||
environment: | ||
AETERNITY_CONFIG: /home/aeternity/aeternity.yaml | ||
command: > | ||
-aecore expected_mine_rate ${AETERNITY_MINE_RATE:-15000} | ||
volumes: | ||
- ${PWD}/node/config/node1_mean15.yaml:/home/aeternity/aeternity.yaml | ||
- ${PWD}/node/keys/node1:/home/aeternity/node/keys | ||
- node1_db:/home/aeternity/node/data/mnesia | ||
|
||
node2: | ||
image: aeternity/aeternity:${IMAGE_TAG-latest} | ||
hostname: node2 | ||
environment: | ||
AETERNITY_CONFIG: /home/aeternity/aeternity.yaml | ||
command: > | ||
-aecore expected_mine_rate ${AETERNITY_MINE_RATE:-15000} | ||
volumes: | ||
- ${PWD}/node/config/node2_mean15.yaml:/home/aeternity/aeternity.yaml | ||
- ${PWD}/node/keys/node2:/home/aeternity/node/keys | ||
- node2_db:/home/aeternity/node/data/mnesia | ||
|
||
node3: | ||
image: aeternity/aeternity:${IMAGE_TAG-latest} | ||
hostname: node3 | ||
environment: | ||
AETERNITY_CONFIG: /home/aeternity/aeternity.yaml | ||
command: > | ||
-aecore expected_mine_rate ${AETERNITY_MINE_RATE:-15000} | ||
volumes: | ||
- ${PWD}/node/config/node3_mean15.yaml:/home/aeternity/aeternity.yaml | ||
- ${PWD}/node/keys/node3:/home/aeternity/node/keys | ||
- node3_db:/home/aeternity/node/data/mnesia | ||
|
||
proxy: | ||
image: nginx:1.13.8 | ||
hostname: proxy | ||
ports: | ||
- "3001:3001" | ||
- "3002:3002" | ||
- "3003:3003" | ||
volumes: | ||
- ${PWD}/nginx/default.conf:/etc/nginx/conf.d/default.conf | ||
- ${PWD}/nginx/cors.conf:/etc/nginx/cors.conf | ||
- ${PWD}/nginx/ws.conf:/etc/nginx/ws.conf | ||
|
||
volumes: | ||
node1_db: | ||
node2_db: | ||
node3_db: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<��&��1�o�g8��ESD�kM (�� |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
��{��>n�l���;�@��x��F6 | ||
y� |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
b���p��g�1̀�!�G�A����7U��[�R |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
������4u���l�k�����o#��.?� |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
��v��?��ԋu�1���P�_c�%�%�2@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
�g����+PD�,�$ �B��6��8��W |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# | ||
# Wide-open CORS config for nginx | ||
# source: https://enable-cors.org/server_nginx.html | ||
# | ||
|
||
if ($request_method = 'OPTIONS') { | ||
add_header 'Access-Control-Allow-Origin' '*' always; | ||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always; | ||
# | ||
# Custom headers and headers various browsers *should* be OK with but aren't | ||
# | ||
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range' always; | ||
# | ||
# Tell client that this pre-flight info is valid for 20 days | ||
# | ||
add_header 'Access-Control-Max-Age' 1728000 always; | ||
add_header 'Content-Type' 'text/plain; charset=utf-8' always; | ||
add_header 'Content-Length' 0 always; | ||
return 204; | ||
} | ||
|
||
if ($request_method = 'POST') { | ||
add_header 'Access-Control-Allow-Origin' '*' always; | ||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always; | ||
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range' always; | ||
add_header 'Access-Control-Expose-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range' always; | ||
} | ||
|
||
if ($request_method = 'GET') { | ||
add_header 'Access-Control-Allow-Origin' '*' always; | ||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always; | ||
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range' always; | ||
add_header 'Access-Control-Expose-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range' always; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
# Assumptions: | ||
# - The set of paths tagged as `internal` and the set of paths tagged as `external` are disjoint. | ||
# - The set of paths tagged as `internal` is equal to the union of: the set of paths with prefix `/v2/debug`; and the exact path `/v2/key-blocks` (beware that if you do not consider "exact" here, additional constraints need to be considered). | ||
|
||
server { | ||
listen 3001; | ||
|
||
# External API | ||
location / { | ||
include cors.conf; | ||
proxy_pass http://node1:3013/; | ||
} | ||
|
||
# Internal API | ||
location /internal/ { | ||
# Backward compatibility | ||
include cors.conf; | ||
proxy_pass http://node1:3113/; | ||
} | ||
|
||
location /v2/debug { | ||
include cors.conf; | ||
proxy_pass http://node1:3113; | ||
} | ||
|
||
location = /v2/key-blocks { | ||
include cors.conf; | ||
proxy_pass http://node1:3113; | ||
} | ||
|
||
# State Channels Web Sockets | ||
location /channel { | ||
include cors.conf; | ||
include ws.conf; | ||
proxy_pass http://node1:3014; | ||
} | ||
} | ||
|
||
server { | ||
listen 3002; | ||
|
||
# External API | ||
location / { | ||
include cors.conf; | ||
proxy_pass http://node2:3013/; | ||
} | ||
|
||
# Internal API | ||
location /internal/ { | ||
# Backward compatibility | ||
include cors.conf; | ||
proxy_pass http://node2:3113/; | ||
} | ||
|
||
location /v2/debug { | ||
include cors.conf; | ||
proxy_pass http://node2:3113; | ||
} | ||
|
||
location = /v2/key-blocks { | ||
include cors.conf; | ||
proxy_pass http://node2:3113; | ||
} | ||
|
||
# State Channels Web Sockets | ||
location /channel { | ||
include cors.conf; | ||
include ws.conf; | ||
proxy_pass http://node2:3014; | ||
} | ||
} | ||
|
||
server { | ||
listen 3003; | ||
|
||
# External API | ||
location / { | ||
include cors.conf; | ||
proxy_pass http://node3:3013/; | ||
} | ||
|
||
# Internal API | ||
location /internal/ { | ||
# Backward compatibility | ||
include cors.conf; | ||
proxy_pass http://node3:3113/; | ||
} | ||
|
||
location /v2/debug { | ||
include cors.conf; | ||
proxy_pass http://node3:3113; | ||
} | ||
|
||
location = /v2/key-blocks { | ||
include cors.conf; | ||
proxy_pass http://node3:3113; | ||
} | ||
|
||
# State Channels Web Sockets | ||
location /channel { | ||
include cors.conf; | ||
include ws.conf; | ||
proxy_pass http://node3:3014; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
proxy_http_version 1.1; | ||
proxy_set_header Upgrade "websocket"; | ||
proxy_set_header Connection "upgrade"; | ||
proxy_connect_timeout 15s; | ||
proxy_send_timeout 2h; | ||
proxy_read_timeout 2h; | ||
proxy_pass_request_headers on; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
peers: | ||
- aenode://pp_28uQUgsPcsy7TQwnRxhF8GMKU4ykFLKsgf4TwDwPMNaSCXwWV8@node2:3015 | ||
- aenode://pp_Dxq41rJN33j26MLqryvh7AnhuZywefWKEPBiiYu2Da2vDWLBq@node3:3015 | ||
|
||
http: | ||
external: | ||
port: 3013 | ||
internal: | ||
port: 3113 | ||
listen_address: 0.0.0.0 | ||
debug_endpoints: true | ||
cors: | ||
allow_domains: [""] | ||
|
||
websocket: | ||
channel: | ||
port: 3014 | ||
listen_address: 0.0.0.0 | ||
|
||
keys: | ||
peer_password: "top secret" | ||
dir: ./keys | ||
|
||
chain: | ||
persist: true | ||
|
||
mining: | ||
beneficiary: "ak_twR4h7dEcUtc2iSEDv8kB7UFJJDGiEDQCXr85C3fYF8FdVdyo" | ||
beneficiary_reward_delay: 2 | ||
autostart: true | ||
cuckoo: | ||
edge_bits: 15 | ||
miners: | ||
- executable: mean15-generic | ||
|
||
fork_management: | ||
network_id: ae_docker |
Oops, something went wrong.