IP Locate is a tool for querying and plotting geographic information for ipv4 and ipv6 addresses via the MaxMind GeoLite2 dataset.
The development environment is configured using docker-compose
. In order to run iplocate locally:
- Configure environment:
- copy the dev.example.env file to a new file called .env:
cp example.env .env
- add MaxMind account id and license key credentials to the
.env
file where appropriate. Access is free and an account can be created here.
- copy the dev.example.env file to a new file called .env:
- Start the environment:
- From the root of the project, start environment using docker:
docker-compose up --build
- Local changes in
backend/src
andfrontend/src
will be hot-reloaded - Other changes will require stopping and starting the environment
- From the root of the project, start environment using docker:
- Navigate to http://localhost in a browser
In order to run unit tests
- Install backend dependencies (outside of docker)
- cd
./backend
npm install
- cd
- Install frontend dependencies (outside of docker)
- cd
./frontend
npm install
- cd
- From either directory
- Run unit tests:
npm run test
- Run unit tests with coverage:
npm run test:coverage
- Format code using prettier:
npm run format
- Check formatting:
npm run format:check
- Run unit tests:
Pull requests are welcome. Prior to committing, run unit tests and formatting. Code coverage is required to be above 90%.
GitHub Actions is used for CI/CD. Backend CI configuration can be found in .github/workflows/backend.yml, and frontend configuration can be found in .github/workflows/frontend.yml. Every PR triggers the following steps in both:
- Install nodejs and dependencies (npm ci)
- Ensure prettier code style (npm format:check)
- Run tests (npm run test:coverage)
- Build production application (npm run build)
Every push to master triggers the following deployment steps with the deploy workflow in .github/workflows/deploy.yml
- Deploy infrastructure changes using terraform
- Deploy backend using serverless framework
- Deploy frontend to Netlify