From b02e455d74da99440000ba77437f05a7f618e5a6 Mon Sep 17 00:00:00 2001 From: "adrien.boulay" Date: Thu, 3 Sep 2020 20:47:31 +0200 Subject: [PATCH] Refactor the docs/README Table of Contents and complete Proxy documentation --- docs/README.md | 10 +++---- docs/services/Proxy.md | 60 +++++++++++++++++++++++++++++++++--------- 2 files changed, 53 insertions(+), 17 deletions(-) diff --git a/docs/README.md b/docs/README.md index 1037419..b7b8427 100644 --- a/docs/README.md +++ b/docs/README.md @@ -6,15 +6,15 @@ 2 - [Architecture](./Architecture.md) -3 - [Run the project on the machine](./How_to_run_locally.md) - -4 - [Deploy the project on a cloud provider](./How_to_deploy_on_AWS.md) - -5 - [Services](./services) +3 - [Services](./services) - [API](./services/API.md) - [Proxy](./services/Proxy.md) - [Frontend](./services/Frontend.md) +4 - [Run the project on the machine](./How_to_run_locally.md) + +5 - [Deploy the project on a cloud provider](./How_to_deploy_on_AWS.md) + 6 - [Lambdas](./lambdas) - [Snapshot exporter](./lambdas/Snapshot_Exporter.md) - [Metrics cleaner](./lambdas/Metrics_Cleaner.md) diff --git a/docs/services/Proxy.md b/docs/services/Proxy.md index 568949e..5b9d81f 100644 --- a/docs/services/Proxy.md +++ b/docs/services/Proxy.md @@ -1,21 +1,57 @@ # Proxy -- HTTP proxy in front of the nodes -- In-memory (LRU) cache +The `proxy service` is a software developed by the team which handle: +- the redirection to the node which can satisfied the request (rolling node for request which need only the last cycle or archive node for more power). +- The authentification of the user with a token. +- The count of request for a user. + +To optimize the response time, it can keep request result in a In-memory (LRU) cache. + +The proxy service was created to handle only on network at once and need to be connected with a pair of archive and rolling nodes. + +## Requirements + +- `GNU Make` (setup with 3.81) +- `Golang` (setup with 1.13) ## Dependencies - `PostgreSQL` (setup with 9.6) +- One or More Tezos `Archive nodes` +- One or More Tezos `Rolling nodes` + +## Build the Proxy container + +In the root folder of the project, please run the command to build the Proxy containers: + +```bash +# Retrieve dependancies +go get -v -d ./... + +# compile the binary in bin/proxy +# generate the associated docker image +make build-docker +``` + +> Warning: The proxy need to be started **after** the API and required a database. Please deploy it with the docker-compose command to get a full environment. ## Environment variables -- `DATABASE_URL` (default: `postgres:5432`) -- `DATABASE_USERNAME` (default: `user`) -- `DATABASE_PASSWORD` (default: `pass`) -- `DATABASE_TABLE` (default: `tezoslink`) -- `DATABASE_ADDITIONAL_PARAMETER` (default: `sslmode=disable`) -- `ARCHIVE_NODES_URL` (default: `node`) -- `TEZOS_ARCHIVE_PORT` (default: `1090`) -- `ROLLING_NODES_URL` (default: `node`) -- `TEZOS_ROLLING_PORT` (default: `1090`) -- `SERVER_PORT` (default: `8001`) \ No newline at end of file +### Server internal variables + +- `SERVER_PORT` (default: `8001`): The port served by the proxy. + +### Tezos nodes connection variables + +- `ARCHIVE_NODES_URL` (default: `node`): The URL of the Archive node to connect with. +- `TEZOS_ARCHIVE_PORT` (default: `1090`): The port associated with the Archive node. +- `ROLLING_NODES_URL` (default: `node`): The URL of the Rolling node to connect with. +- `TEZOS_ROLLING_PORT` (default: `1090`): The port associated with the Rolling node. + +### Database connection parameters + +- `DATABASE_URL` (default: `postgres:5432`): The hostname of the database server to connect with. +- `DATABASE_USERNAME` (default: `user`): The username used to connect on the postgresql database server. +- `DATABASE_PASSWORD` (default: `pass`): The password of the postgresql database server. +- `DATABASE_TABLE` (default: `tezoslink`): The database to connect with on the postgresql database server. +- `DATABASE_ADDITIONAL_PARAMETER` (default: `sslmode=disable`): The connection parameter used to connect with the database (ssl...)