go-spatial / tegola

Tegola is a Mapbox Vector Tile server written in Go
http://tegola.io/
MIT License
1.28k stars 196 forks source link

chore: add docker-compose local dev env #840

Closed iwpnd closed 2 years ago

iwpnd commented 2 years ago

This PR adds a local development environment using docker compose as proposed here that makes local development a breeze, even if you're unfamiliar with the project.

  1. clone the repository
  2. docker compose up
  3. run test suite
    RUN_POSTGIS_TESTS=yes RUN_REDIS_TESTS=yes PGSSLMODE=disable PGSSLKEY="" PGSSLCERT="" PGSSLROOTCERT="" PGHOST=localhost PGPORT=5432 PGDATABASE=tegola PGUSER=postgres PGPASSWORD=postgres PGUSER_NO_ACCESS=tegola_no_access go test  ./... -v
  4. docker compose down
coveralls commented 2 years ago

Pull Request Test Coverage Report for Build 905eed645-PR-840


Totals Coverage Status
Change from base Build 21da05b0a: 0.0%
Covered Lines: 5485
Relevant Lines: 12158

💛 - Coveralls
ARolek commented 2 years ago

I have 2 minor requests:

That you for this addition!

iwpnd commented 2 years ago

@ARolek thank you for the review

add a docker-compose.env file with the various env vars that you have in the run command.

You'd have to check-in an docker-compose.env.example file and tell the user to rename it. This would also only allow me to do something like this in the docker-compose.yml:

    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U ${PGUSER} -d ${PGDATABASE}"]

It would not load the .env environment variables into our local environment so go test can use them. For this to work I'd have to refactor the test with a function to load the docker-compose.env or something. So the command to run the local test would still need whatever environment variables tegola uses in tests.

Add the docker-compose commands to the readme

Once the above is solved :)