Skip to content

dennmart/airport_gap

Repository files navigation

Airport Gap

Airport Gap is a RESTful API to help you improve your API automation testing skills. It provides access to a database of airports, calculate distances between airports, and allows you to save your favorite airports.

You can create a free Airport Gap account at https://airportgap.com/.

Airport data is provided by OpenFlights.org under the Open Database License.

Airport Gap is provided by Dev Tester - articles and tips to help you improve your test automation skills as a developer.

QuickStart: Setting up and running the application locally

Airport Gap is a Rails 7 application. You need the following dependencies installed to run the application:

  • Ruby (current version: 3.3.5)
  • Bundler (current stable 2.x version)
  • Yarn (current stable version)
  • PostgreSQL (version 12.0 or greater)
  • Foreman (current version)

Once the dependencies are installed, run ./bin/setup to set up the application. The script will perform the following steps automatically:

  • Install Ruby dependencies (bundle install)
  • Install Javascript dependencies (yarn install)
  • Set up the database with seed data (rails db:prepare)

When everything is installed, run ./bin/dev to start all the required processes to build the CSS and JavaScript and start the application server. The application will be accessible at http://localhost:3000/.

Automated tests

The Airport Gap application has a suite of automated tests to help during development.

Unit and integration tests are set up with RSpec. To run the tests, set up the application's Ruby dependencies (bundle install) and a test database, and run rails spec.

Docker

A Dockerfile is provided to run the application in a Docker container. You can build the container locally with docker build -t airport-gap ..

To run Airport Gap using a built Docker image, you can use Docker Compose to spin up the application and its required services. The example docker-compose.yml file below starts a PostgreSQL database, a Redis server, and the Airport Gap application.

version: "3.9"
services:
  web:
    image: airportgap:latest
    ports:
      - 3000:3000
    links:
      - postgres
      - redis
    environment:
      - RAILS_ENV=production
      - RACK_ENV=production
      - PGHOST=postgres
      - PGUSER=airport_gap_user
      - PGPASSWORD=airport_gap
      - DATABASE_URL=postgres://airport_gap_user:airport_gap@postgres:5432/airport_gap_db
      - REDIS_URL=redis://redis:6379/0
      - RAILS_SERVE_STATIC_FILES=true
      - RAILS_LOG_TO_STDOUT=true
      - SECRET_KEY_BASE=dsjkfhsdjfhsdjk
    depends_on:
      - postgres
      - redis
  postgres:
    image: postgres:15.2
    expose:
      - 5432
    environment:
      - POSTGRES_DB=airport_gap_db
      - POSTGRES_USER=airport_gap_user
      - POSTGRES_PASSWORD=airport_gap
  redis:
    image: redis:7.0.11
    expose:
      - 6379

To seed the database with data, run docker-compose exec web bundle exec rails db:setup. You can then access the application at http://localhost:3000/.

Kamal

This repo contains an example to use for deploying Airport Gap using Kamal.

If you want to deploy Airport Gap to your own server:

  • Copy config/deploy.yml.example to config/deploy.yml and update the configuration file with your server details.
  • Copy .kamal/secrets.example to .kamal/secrets and update the file with your secrets.
  • Run kamal setup to deploy the application to a new server.

For more details on deploying a Rails application using Kamal using Airport Gap as an example, check out the video "Rails Deployments Made Easy with Terraform and Kamal" on YouTube.

About

A fully-functional API to help you improve your test automation skills.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors