From 71bb2485361c8a26ee0d546949a5452f7ffa0d9f Mon Sep 17 00:00:00 2001 From: Filip Pajic Date: Fri, 15 Dec 2023 16:41:47 +0100 Subject: [PATCH 1/3] added Docker to the project --- .env.example | 2 ++ Dockerfile | 9 +++++++++ docker-compose.yml | 10 ++++++++++ docker-entrypoint.sh | 4 ++++ 4 files changed, 25 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100755 docker-entrypoint.sh diff --git a/.env.example b/.env.example index 18c7299..aa3e774 100644 --- a/.env.example +++ b/.env.example @@ -2,6 +2,8 @@ NODE_ENV=development NODE_PORT=3001 + +# Use 0.0.0.0 if Docker instance NODE_HOST=localhost COINGECKO_BASE_URL=https://api.coingecko.com/api/v3/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8f8c641 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM node:18 +WORKDIR /usr/src/app + +COPY package.json ./ +COPY yarn.lock ./ + +RUN yarn + +COPY . . \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..bccf7fa --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,10 @@ +version: "3" +services: + token_price_oracle_orchestrator_ts: + container_name: "token_price_oracle_orchestrator_ts" + build: . + entrypoint: ["./docker-entrypoint.sh"] + ports: + - ${NODE_PORT}:${NODE_PORT} + volumes: + - ./docker-entrypoint.sh:/usr/src/app/docker-entrypoint.sh \ No newline at end of file diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100755 index 0000000..0b8f3e9 --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +yarn build; +yarn start; From 508e8e76ae5d3f5143ec125c0a06d84fd6dfa5d7 Mon Sep 17 00:00:00 2001 From: Filip Pajic Date: Fri, 15 Dec 2023 16:42:04 +0100 Subject: [PATCH 2/3] updated the README --- README.md | 46 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0d085d6..c15585e 100644 --- a/README.md +++ b/README.md @@ -3,4 +3,48 @@ # Token Price Oracle - Orchestrator 🎶 Token Price Oracle is simple oracle for tracking token prices on-chain. In this repo is located the Typescript Client orchestrator used for -tracking, management and orchestration of the data. \ No newline at end of file +tracking, management and orchestration of the data. + +## Running the project 🚀 +### Requirements ✅ +- On your computer + * If setting up using Docker + * Installed [Docker](https://www.docker.com/) + * Installed docker-compose (Bundled with the official Docker setup) + * If setting up locally + * Installed [Node.js 18](https://nodejs.org/en/) + * Installed [yarn](https://yarnpkg.com/) package manager + +### Installation ⚙️ +#### Git +1. Clone the repo: ```git clone https://github.com/pajicf/token-price-oracle-orchestrator.git``` +2. Navigate to the folder: ```cd token-price-oracle-orchestrator``` + +#### Setting up the environment +3. Run ```cp .env.example .env``` and fill the values` +> [!IMPORTANT] +> Ensure that you've filled all the needed values in the .env + +--- +After you complete the previous steps, the following instruction will vary based on that +if you're trying to run the project using docker or your local setup +--- + +#### Docker setup +4. Run `docker-compose up` +5. That's it! +> [!NOTE] +> If you've pulled new code files you'll have to rebuild the Docker image using `docker-compose build --no-cache node_backend` + +#### Running locally +4. Run ```yarn``` to install the dependencies +5. Building the project: ```yarn build``` +6. Starting the project: ```yarn start``` + +### Commands 🧑‍💻 +| Name | Command | Description | +|------------------|------------------|--------------------------------------------------| +| Dev Environment | ```yarn dev``` | Starts the development environment | +| Build | ```yarn build``` | Compiles the project and builds production files | +| Start | ```yarn start``` | Starts the project from the production build | +| Contract Typings | ```yarn lint``` | Lints the project using `eslint` | \ No newline at end of file From 0b9acb0e6fcab1d48da9ae087308eba769d45287 Mon Sep 17 00:00:00 2001 From: Filip Pajic Date: Fri, 15 Dec 2023 16:50:53 +0100 Subject: [PATCH 3/3] added env guide to README.md --- .env.example | 6 +++--- README.md | 12 +++++++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index aa3e774..6958ed6 100644 --- a/.env.example +++ b/.env.example @@ -10,11 +10,11 @@ COINGECKO_BASE_URL=https://api.coingecko.com/api/v3/ COINGECKO_API_KEY= COINGECKO_API_KEY_QUERY_NAME=x_cg_demo_api_key -ETHERSCAN_BASE_URL= +ETHERSCAN_BASE_URL=https://api-sepolia.etherscan.io/ ETHERSCAN_API_KEY= -ETHERSCAN_API_KEY_QUERY_NAME= +ETHERSCAN_API_KEY_QUERY_NAME=apikey -ALCHEMY_URL= +ALCHEMY_URL=https://eth-sepolia.g.alchemy.com/v2/API_KEY_HERE PRIVATE_KEY= # Sepolia data diff --git a/README.md b/README.md index c15585e..843672d 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,17 @@ tracking, management and orchestration of the data. 2. Navigate to the folder: ```cd token-price-oracle-orchestrator``` #### Setting up the environment -3. Run ```cp .env.example .env``` and fill the values` +3. Run ```cp .env.example .env``` and fill the values` + +**Where can I obtain the needed values?** + +| Value | Description | Link | +|------------------|---------------------------------------------------------------------------------------------------------------|--------------------------------------------------| +| COINGECKO_API_KEY | The API key for consuming Coingecko service | https://www.coingecko.com/en/api/pricing | +| ETHERSCAN_API_KEY | The API key for consuming Etherscan service | https://docs.etherscan.io/getting-started/viewing-api-usage-statistics | +| ALCHEMY_URL | Url for interacting with Alchemy (Make sure the Network is the same as of other values) | https://docs.alchemy.com/docs/alchemy-quickstart-guide | +| PRIVATE_KEY | The Private key that your orchestrator instance will be using for interacting with the EVM compatible network | https://support.metamask.io/hc/en-us/articles/360015289632-How-to-export-an-account-s-private-key | + > [!IMPORTANT] > Ensure that you've filled all the needed values in the .env