Skip to content

k-zehnder/airaccidentdata

Repository files navigation

airaccidentdata

CI/CD Pipeline

Quickstart

  1. Clone the Repository:

    git clone https://github.com/k-zehnder/airaccidentdata.git
    cd airaccidentdata
  2. Configure Environment:

    Copy the example environment file:

    cp .env.example .env

    Edit the .env file:

    Open the .env file and set your environment variables:

    # MySQL Configuration
    MYSQL_HOST=mysql
    MYSQL_PORT=3306
    MYSQL_DATABASE=airaccidentdata
    MYSQL_USER=user
    MYSQL_PASSWORD=password
    MYSQL_ROOT_PASSWORD=password
    
    # Backend Configuration
    GO_ENV=development
    SERVER_ADDRESS=0.0.0.0:8080
    
    # AWS Configuration (production only, for Cloudflare caching with S3 bucket)
    AWS_REGION=your-region
    AWS_ACCESS_KEY_ID=your-access-key-id
    AWS_SECRET_ACCESS_KEY=your-secret-access-key
    AWS_S3_BUCKET=your-s3-bucket
    
    # Frontend Configuration
    NEXT_PUBLIC_ENV=development
    
    # Google Maps API Configuration
    GOOGLE_MAPS_API_KEY=your-google-maps-api-key
  3. Obtain Google Maps Geocoding API Key:

    To get the coordinates for accidents, you need a Google Maps Geocoding API key. Follow the instructions here to obtain and configure your API key. Then, add it to your .env file:

    GOOGLE_MAPS_API_KEY=your-google-maps-api-key
  4. Ensure Docker is Installed and Running:

    Make sure Docker is installed and running on your host machine. You can download Docker Desktop from here.

    Alternatively, you can install Docker via the command line:

    For Ubuntu:

    sudo apt-get update
    sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
    sudo apt-get update
    sudo apt-get install -y docker-ce
    sudo systemctl status docker

    For Mac:

    brew install docker
    brew install docker-compose

    For Windows:

    You can download Docker Desktop for Windows from here and follow the installation instructions provided on the website.

  5. Launch Development Environment with Docker:

    This will build and start all necessary services:

    make dev
  6. Populate the Database with Accident Data:

    cd backend
    make data
    cd ..
  7. Populate the Database with Aircraft Images:

    cd aircraft_scraper
    make images
    cd ..
  8. Index Data into Elasticsearch:

    cd elastic
    make index
    cd ..

    Your development environment should now be running.

Accessing the Application

  • Frontend: Visit http://localhost:3000 to view the frontend.
  • Swagger UI: Access the API documentation at http://localhost:8080/swagger/index.html