Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

wotanut/papl-cw

Repository files navigation

Repo Structure

This is a monolithic repository structured as follows:

  • app/: Contains all Flutter-related files for the frontend.
  • src/: Contains all API-related files for the backend.

Project Idea

I decided to reimplement the MCDU for the A320 as my papl idea. As the project is large at best, my initial submission focuses on the ATSU and building up a scalable frontend and backend.

Key Terms

MCDU - Multipurpose Control and Display Unit. It is the primary interface for the pilots to interact with the FMGC and ATSU of the A320 FMGC - Flight Management and Guidance Computer ATSU - Air Traffic Services Unit ACARS - Aircraft Communications Addressing and Reporting System CPDLC - Controller-Pilot Data Link Communications PDC - Pre-Departure Clearance DDU - Datalkink Display Unit

Frontend Deployment

The frontend is primarily built for iOS and Android but can also run on macOS (via iPhone mirroring or emulators), Windows, and Linux (via Android emulators). While the web version should work, it hasn't been thoroughly tested.

Prerequisites

Running the Frontend

  1. Navigate to the /app directory.
  2. Run the following command:
    flutter run

Note

  • By default, the app connects to https://api.sambot.dev as its backend.
  • To use a local backend, edit the apiUrl variable in lib/globals.dart

Backend Deployment

Option 1: Docker Compose (Preferred)

  1. Ensure Docker is installed on your system.

  2. Place the following files just outside the workspace folder:

    • papl.env: Use .env.example as a template.
    • db_password.txt: Contains the MySQL database password in plaintext.
    • ~/caddy_config/Caddyfile: Use Caddyfile.example as a template, ONLY if you're using Caddy as a reverse proxy. Some key things to note:
      • Replace example.com with your domain name.
      • Replace CLOUDFLARE_API with your Cloudflare API key.
      • Oh yeah, this only works if you're using Cloudflare as your DNS provider. If you're not, you'll have to change the DNS provider in the Caddyfile.
  3. Run the following command from the root directory:

    docker compose up

Docker will automatically pull necessary images and build the containers.

Database Configuration

  • Use db as the database URL in your connection string. For example:
    mysql+pymysql://username:password@db/databaseName
    

Troubleshooting MySQL Access Issues

If you encounter issues accessing the MySQL database:

  1. Enter the MySQL container:

    docker exec -it papl-cw-db-1 mysql -u root -p

    Use the randomly generated root password found in the logs.

  2. Update the password for the user account:

    ALTER USER '<Username>' IDENTIFIED BY '<NewPassword>';
  3. Exit the container and restart Docker Compose:

    docker compose up

Development Environment

The backend will run on 127.0.0.1. To use this with the frontend, ensure the Flutter app is configured to connect to 127.0.0.1 instead of https://api.sambot.dev.


Option 2: Manual Deployment

  1. Ensure MySQL is running with a valid user account and password.
  2. Navigate to the /src directory.
  3. Run the backend server using:
    uvicorn app:app

Configuration

  • Ensure you have a .env file with the correct database connection string, for example:
    mysql+pymysql://username:password@db/databaseName
    

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published