From daf3a3bcc6915ef137b8a2d6c966e34fdb9b0b66 Mon Sep 17 00:00:00 2001 From: cortze Date: Thu, 31 Aug 2023 15:36:04 +0200 Subject: [PATCH 1/2] update .env template to add port configuration --- .env_template | 3 +++ .gitignore | 6 ++++++ docker-compose.yaml | 6 +++--- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.env_template b/.env_template index 959f0f3..249cde5 100644 --- a/.env_template +++ b/.env_template @@ -1,3 +1,6 @@ +CRAWLER_PORT="9020" +CRAWLER_METRICS_PORT="9080" +DB_PORT="5433" CRAWLER_LOG_LEVEL="info" CRAWLER_PSQL_ENDP="postgres://user:password@db:5432/armiarmadb" CRAWLER_PEERS_BACKUP="12h" diff --git a/.gitignore b/.gitignore index 5d93a70..0bea833 100644 --- a/.gitignore +++ b/.gitignore @@ -4,9 +4,15 @@ # do not include unnecesary files such as: # log .txt s **/*.txt + # launchers **/*.sh + # docker-compose volumes app-data/*_db +# configurations *.env + +# IDE configuration +.idea diff --git a/docker-compose.yaml b/docker-compose.yaml index ab8bc12..80ceefa 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -17,7 +17,7 @@ services: - ./app-data/postgresql_db:/var/lib/postgresql/data networks: [ cluster ] ports: - - "127.0.0.1:5432:5432" + - "127.0.0.1:${DB_PORT}:5432" healthcheck: test: pg_isready -U user -d armiarmadb interval: 10s @@ -70,5 +70,5 @@ services: condition: service_healthy networks: [ cluster ] ports: - - "9020:9020" - - "127.0.0.1:9080:9080" + - "${CRAWLER_PORT}:9020" + - "127.0.0.1:${CRAWLER_METRICS_PORT}:9080" From 8eb0bdec3fb51cd06b5bf0275c0b8fd73b8eabc3 Mon Sep 17 00:00:00 2001 From: cortze Date: Thu, 31 Aug 2023 15:36:28 +0200 Subject: [PATCH 2/2] update Readme adding more details about .envs --- README.md | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index f3d5f8a..c8a1451 100644 --- a/README.md +++ b/README.md @@ -18,13 +18,9 @@ To use the tool, the following requirements need to be installed in the machine: - gcc - C compiler - [go](https://go.dev/doc/install) on its 1.17 version (upper versions might fail to compile, we are working on it). Go needs to be executable from the terminal. Lower versions will report a dependency import error for the package `io/fs`. - PostgreSQL DB -- Docker version -- Docker-Compose - Alternatively, the tool can also be executed from: -- [docker](https://docs.docker.com/get-docker/) -- [docker-compose](https://docs.docker.com/compose/install/) +- [docker](https://docs.docker.com/get-docker/) / [docker-compose](https://docs.docker.com/compose/install/) OPTIONAL for data visualization: - [prometheus](https://prometheus.io/docs/prometheus/latest/installation/) time-series database. @@ -75,12 +71,11 @@ List of ports that are going to be used: | Grafana | `3000` | user=`admin` & password=`admin` | -To spawn up the entire set-up, just run the following command in the root directory +To spawn up the entire set-up, make a copy of the `.env_template` to configure it at your wish, and just run the following command in the root directory ``` # Call docker-compose in the root of the repository, and that's all -docker-compose up - +docker-compose up --env-file <.env-copy-path> ``` Docker-compose will generate the Docker images for you and will run the crawler and its requirements in your machine. Please note that, by running the tool through the `docker-compose --env-file <.env-file-name> up` command.