A tour of the codebase and technical stack

This tour explores LiteFarm’s "notifications" features. It helps to introduce the LiteFarm codebase, the structure of the repository, and the technical solution stack/toolset. It also serves as a basis for describing team expectations for passing pre-integration review.

The LiteFarm application includes a screen that lists notifications-- messages to the user that inform them of relevant events connected with their farm(s). When a user has "alerts"-- new notifications since they last viewed the notification screen-- a numeric icon will be added to the bell on the navigation bar.

User stories and other requirements for the notifications features are defined in these JIRA tickets.

We sometimes refer to the LiteFarm repo as a "monorepository". The LiteFarm monorepo defines three "packages": webapp, shared, and api. Folders with these names can be found immediately under the packages folder at the root of the repo.

As we will see, there is a kind of a fourth package, embedded within the api folder, that provides a certification export service, variously known as "exports", "scheduler", or "job scheduler".

Deployments

LiteFarm deployments include

  • the production environment; entry point https://app.litefarm.org

  • the pre-production environment; entry point https://beta.litefarm.org

  • various short-term cloud deployments that come and go as needed for demos, etc.

  • local deployments for use by individual developers

The production environment consists of:

  • litefarmapp, a Digital Ocean Droplet that:

    • runs the webapp package (behind an Nginx reverse proxy) in litefarm-web, a Docker container assigned the hostname app.litefarm.org

    • runs the api package in litefarm-api, a Docker container assigned the hostname api.app.litefarm.org

    • runs PostgreSQL in a Docker container named litefarm-db

    • provides file storage for the database contents and backups

  • litefarm-imaginary, a Digital Ocean Droplet that:

    • runs the “exports package” jobs scheduler Node service

    • runs the Redis-based work queues used by the API server to submit export jobs to the scheduler

    • runs the image manipulation microservice imaginary in a Docker container

    • runs an Nginx web server, hostname image.litefarm.org, that reverse proxies access to a Docker container running the image manipulation microservice imaginary

  • Object storage “buckets” (Digital Ocean Spaces) that store images and documents uploaded by users, as well as certification exports for users to download.

The pre-production environment consists of:

  • litefarmbeta, a Droplet that duplicates the services on litefarmapp, with hostnames beta.litefarm.org and api.beta.litefarm.org

  • export-beta, a Droplet that duplicates the services of on litefarm-imaginary, except for the imaginary microservice

  • Buckets that duplicate those in the production environment.

Individual developers run local deployments as native services rather than Docker containers. There are buckets dedicated to object storage for development setups.

All deployments-- production, pre-production, and individual developers-- use the single instance of the imaginary microservice on image.litefarm.org