Skip to content

Commit

Permalink
Merge pull request #63 from migalabs/fix/docker-compose-setup
Browse files Browse the repository at this point in the history
Extend the docker-compose to make it more configurable
  • Loading branch information
cortze authored Aug 31, 2023
2 parents 9589fb4 + 8eb0bde commit b463d06
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
3 changes: 3 additions & 0 deletions .env_template
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"

0 comments on commit b463d06

Please sign in to comment.