Code Monkey home page Code Monkey logo

backend's Introduction

Backend for Transit Tracker

This repository contains the backend services for Transit Tracker. The server is powered by a Laravel application (PHP). The main application is hosted in the frontend repository (a NuxtJS app), but some frontend parts are hosted here (will be detailled below).

Parts

  • Developper home page
  • API : currently V2, V2.1 coming soon
  • exo VIN Project: a collaborative effort to associate VIN numbers to fleet numbers. exo GTFS-RT feeds only include the Vehicule Identification Number (VIN) as a Vehicule ID.
  • Admin panel (with Filament)

Services

The backend services use multiple services, some hosted on the same server and other hosted elsewere. Where possible, a local installation is preffered.

For local developpement, only a small portion of those services are necessary to run the base application. Optional service might throw an error, but can be ignored.

MySQL

Required.

SQLite can work, but some migrations will not run. MySQL is the recommended way to go.

Redis

Required.

Used for caching and job management (through Horizon).

Horizon

Mandatory, but can be replaced with php artisan queue:work

Laravel Horizon is the services use to manage the queues where long running jobs are running.

To start the service, run php artisan horizon

The following queue are used (a redesign is coming):

  • realtime-download Realtime data fetching
  • realtime-process Realtime data processing
  • notifications All notifications
  • static Static data update (download and processing)
  • ohdear Jobs related to the OhDear monitoring service
  • default All others jobs

Websockets

Optional.

Used for frontend automatic realtime refresh. Using Beyond Code Laravel Websockets.

Slack

Optional.

Used for admin notifications about late jobs and invalid static data.

OhDear

Optional.

Used for monitoring on production, everything running well.

Cloudflare Turnstile

Optional.

Used for VIN suggestion human validation. Bypassed on local.

print-gtfs-rt-cli

Optional.

Used for some GTFS-RT feeds that do not work with the PHP implementation (so far, Zenbus feeds).

Run the server

Requirements

  1. composer install
  2. cp .env.example .env check the settings and make sure to create a database
  3. php artisan key:generate
  4. php artisan migrate
  5. php artisan horizon:publish
  6. yarn install
  7. php artisan tinker then create a user
    1. User::create(['name' => 'Admin', 'email' => '[email protected]', 'password' => bcrypt('password')]);
    2. Don’t forget to adjust the .env variables, MAIL_TO
  8. Go to /admin and create a region and an agency to get started

Commands to run the server

One process each.

  1. yarn dev
  2. php artisan serve
  3. php artisan horizon
  4. php artisan websocket:serve

Current deploy script

For production environnement.

php artisan migrate --force

yarn install
yarn build

php artisan config:cache
php artisan event:cache
php artisan horizon:terminate
php artisan horizon:publish
php artisan log-viewer:publish
php artisan icons:cache
php artisan route:cache
php artisan schedule-monitor:sync
php artisan view:cache
php artisan websockets:restart

backend's People

Contributors

brodyflannigan avatar felixinx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

backend's Issues

Comment éditer les fils GTFS utilisés

Bonjour!

J'aimerais déployer une version locale de TransitTracker et je me demandais dans quel fichier je dois faire des changements pour modifier les URL des fils GTFS et GTFS-RT.

Merci!

run just the frontend with any GTFS-RT feed?

Hey!

This question is similar to #9: I'd like to use the frontend you've built, but with any GTFS-RT feed, and without running an adapter API server behind.

I was planning to build a general-purpose (as in city-/feed-independent) GTFS-RT visualiser, and came across your project. Would it be possible to restructure this project so that the frontend can directly consume a GTFS-RT feed?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.