Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update deployment docs #2107

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 54 additions & 17 deletions docs/hyperchains_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,22 @@ To properly configure your middleware for Aeternity Hyperchains, start by genera
Once you have the necessary configuration files, you can run the middleware using Docker:

```
docker run -it --rm \
-p 3013:3013 \
docker run -it --name ae_mdw_${NAME} \
-p 4000:4000 \
-e AETERNITY_CONFIG=/home/aeternity/aeternity.yaml \
-v ${PWD}/${NAME}/nodeConfig/aeternity.yaml:/home/aeternity/aeternity.yaml \
-v ${PWD}/${NAME}/nodeConfig/${NAME}_accounts.json:/home/aeternity/node/local/rel/aeternity/data/aecore/${NAME}_accounts.json \
-v ${PWD}/${NAME}/nodeConfig/${NAME}_contracts.json:/home/aeternity/node/local/rel/aeternity/data/aecore/${NAME}_contracts.json \
-p 4001:4001 \
-p 3113:3113 \
-p 3013:3013 \
-p 3014:3014 \
-v ${PWD}/${NAME}/nodeConfig/aeternity.yaml:/home/aeternity/.aeternity/aeternity/aeternity.yaml \
-v ${PWD}/${NAME}/nodeConfig/${NAME}_accounts.json:/home/aeternity/node/data/aecore/${NAME}_accounts.json \
-v ${PWD}/${NAME}/nodeConfig/${NAME}_contracts.json:/home/aeternity/node/data/aecore/${NAME}_contracts.json \
aeternity/ae_mdw
```

- **Make sure you have enough account balance on the pinning chain for all of the accounts**
- The command assumes the configuration files are in the `${NAME}/nodeConfig` directory in your current working directory, where `${NAME}` is the name of your Hyperchain.
- This command uses the [middleware image](https://hub.docker.com/r/aeternity/ae_mdw), which differs from the [node image](https://hub.docker.com/r/aeternity/aeternity).
- You can pass the `-d` flag to run the container in detached mode.

---

Expand All @@ -62,22 +65,56 @@ To ensure data persistence across container restarts:


```
docker run -it --rm \
-p 3013:3013 \
docker run -it --name ae_mdw_${NAME} \
-p 4000:4000 \
-e AETERNITY_CONFIG=/home/aeternity/aeternity.yaml \
-v ${PWD}/${NAME}/nodeConfig/aeternity.yaml:/home/aeternity/aeternity.yaml \
-v ${PWD}/${NAME}/nodeConfig/${NAME}_accounts.json:/home/aeternity/node/local/rel/aeternity/data/mnesia/${NAME}_accounts.json \
-v ${PWD}/${NAME}/nodeConfig/${NAME}_contracts.json:/home/aeternity/node/local/rel/aeternity/data/mnesia/${NAME}_contracts.json \
-v ${PWD}/data/mnesia:/home/aeternity/node/local/rel/aeternity/data/mnesia \
-v ${PWD}/data/mdw.db:/home/aeternity/node/local/rel/aeternity/data/mdw.db \
-p 4001:4001 \
-p 3113:3113 \
-p 3013:3013 \
-p 3014:3014 \
-v ${PWD}/${NAME}/nodeConfig/aeternity.yaml:/home/aeternity/.aeternity/aeternity/aeternity.yaml \
-v ${PWD}/${NAME}/nodeConfig/${NAME}_accounts.json:/home/aeternity/node/data/mnesia/${NAME}_accounts.json \
-v ${PWD}/${NAME}/nodeConfig/${NAME}_contracts.json:/home/aeternity/node/data/mnesia/${NAME}_contracts.json \
-v ${PWD}/data/mnesia:/home/aeternity/node/data/mnesia \
-v ${PWD}/data/mdw.db:/home/aeternity/node/data/mdw.db \
aeternity/ae_mdw
```

- `-v ${PWD}/data/mnesia:/home/aeternity/node/local/rel/aeternity/data/mnesia`: Persists the node database.
- `-v ${PWD}/data/mdw.db:/home/aeternity/node/local/rel/aeternity/data/mdw.db`: Persists the middleware database.
- `-v ${PWD}/data/mnesia:/home/aeternity/node/data/mnesia`: Persists the node database.
- `-v ${PWD}/data/mdw.db:/home/aeternity/node/data/mdw.db`: Persists the middleware database.

With this setup, the middleware will retain its state even after the container is stopped or restarted.

You can also pass the `-d` flag to run the container in detached mode.

## Step 4: Accessing the Middleware

Once the container is running, you can access the middleware at `http://localhost:4000` and the node at `http://localhost:3013`.

## Managing the Container

To check the logs, run the following command:

```
docker logs ae_mdw_${NAME}
```

To check the status of the container, run the following command:

```
docker ps -a
```

To stop the container, run the following command:

With this setup, the middleware will retain its state even after the container is stopped or restarted.
```
docker stop ae_mdw_${NAME}
```

To restart the container, run the following command:

```
docker start ae_mdw_${NAME}
```

---

Expand Down
44 changes: 38 additions & 6 deletions docs/middleware_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Overview

AeMdw is a middleware that acts as a caching and reporting layer for the [æternity blockchain](https://github.com/aeternity/aeternity). It responds to queries more efficiently than the node and supports additional queries.
AeMdw is a middleware that acts as a caching and reporting layer for the [æternity blockchain](https://github.com/aeternity/aeternity). It responds to queries more efficiently than the node and supports additional queries.

The middleware runs an Aeternity Node alongside it in the same Docker container and BEAM VM instance. This node can be configured using the `aeternity.yaml` file or by passing environment variables, just like configuring the node directly.

Expand Down Expand Up @@ -73,19 +73,51 @@ If you want to use a database snapshot:
Start the container with the following command:

```
docker run -d \
docker run -it --name ae_mdw \
-p 4000:4000 \
-p 4001:4001 \
-p 3113:3113 \
-p 3013:3013 \
-p 3014:3014 \
-v ${PWD}/data/mnesia:/home/aeternity/node/local/rel/aeternity/data/mnesia \
-v ${PWD}/data/mdw.db:/home/aeternity/node/local/rel/aeternity/data/mdw.db \
-v ${PWD}/log:/home/aeternity/node/ae_mdw/log \
-e AETERNITY_CONFIG=/home/aeternity/aeternity.yaml \
-v ${PWD}/data/mnesia:/home/aeternity/node/data/mnesia \
-v ${PWD}/data/mdw.db:/home/aeternity/node/data/mdw.db \
-v ${PWD}/log:/home/aeternity/ae_mdw/log \
-v ${PWD}/docker/aeternity.yaml:/home/aeternity/.aeternity/aeternity/aeternity.yaml \
aeternity/ae_mdw:latest
```

This command starts the middleware in a docker container. The middleware will be available at `http://localhost:4000`. Note that you can pass the -d flag to run the container in detached mode.

### Step 4: Check the Status

To check if the middleware is running properly, visit the `/status` endpoint and ensure that `node_height` is higher than `0`.

### Step 5: Managing the Container

To check the logs, run the following command:

```
docker logs ae_mdw
```

To check the status of the container, run the following command:

```
docker ps -a
```

To stop the container, run the following command:

```
docker stop ae_mdw
```

To restart the container, run the following command:

```
docker start ae_mdw
```

## Customizing Configuration

Edit the configuration file `docker/aeternity.yaml` to specify network settings:
Expand Down
Loading