CEN3031-Group-7H / diamond-project16-7h

The Code Sparks repo for the Diamond team
https://www.casmm.org
0 stars 1 forks source link

CaSMM

Computation and Science Modeling through Making

Cloud-based programming interface

Deploy Staging Deploy Production


Application

client

client is the frontend of the application. It is powered by React and Blockly.

server

server is the web server and application server. It is powered by Node and Strapi.

compile

compile is an arduino compiler service. It is an unofficial fork of Chromeduino.


Environments

The project is divided into three conceptual environments.

Development

Structure

The development environment is composed of five servers. The first one is run with the Create React App dev server. The later four are containerized with docker and run with docker compose.

Running

casmm-client-dev

  1. Follow the client setup
  2. Run yarn start from /client

casmm-server-dev, casmm-compile-dev, casmm-db-dev, and casmm-compile_queue-dev

  1. Install docker

  2. Run docker compose up from /

    Grant permission to the scripts and server directories if you are prompted

Staging

Structure

The staging environment is a Heroku app. It is composed of a web dyno, compile dyno, Heroku Postgres add-on, and Heroku Redis add-on.

Running

casmm-staging is automatically built from the latest commits to branches matching release/v[0-9].[0-9]. Heroku runs the container orchestration from there.

Production

Structure

The production environment is a Heroku app. It is composed of a web dyno, compile dyno, Heroku Postgres add-on, and Heroku Redis add-on.

Running

casmm is automatically built from the latest commits to master. Heroku runs the container orchestration from there.


Maintenance

All three components of the application have their own dependencies managed in their respective package.json files. Run npm outdated in each folder to see what packages have new releases. Before updating a package (especially new major versions), ensure that there are no breaking changes. Avoid updating all of the packages at once by running npm update because it could lead to breaking changes.

Strapi

This is by far the largest and most important dependency we have. Staying up to date with its releases is important for bug/security fixes and new features. When it comes to actually upgrading Strapi make sure to follow the migration guides!


CI/CD

All of the deployments and releases are handled automatically with GitHub Actions. The workflows implement custom Actions that live in the auto repo.


Contributing

Git Flow

We will follow this git flow for the most part — instead of individual release branches, we will have one to streamline staging deployment

Git Flow

Branches

Protected

Locked for direct commits — all commits must be made from a non-protected branch and submitted via a pull request with one approving review

Non-protected

Commits can be made directly to the branch

Pull Requests

Before submitting a pull request, rebase the feature branch into the target branch to resolve any merge conflicts.

Project 16: Gamification

This project entailed the introduction of badges and a student profile to the CASMM system.

Features Implemented:

Search profile (student view)

View created badges (teacher view)

View badge details (teacher & student)

Upload custom badge via URL (teacher view)

Create custom badge via default template (teacher view)

Assign badges to students (teacher view)

View earned badges (student view)

Edit visibility of badges (student view)

Running the Project Locally

Same setup as the development instructions above.

Permissions Setup

It is necessary to have permissions in Strapi Roles match the permissions in the routes.json files. These changes to not seem to save to git, so here are the changes that will need to be made: Allow the student role to access badge/countearners, classroom/countstudents, student/granthidebadgearr, stuednt/hidebadge, student/showbadge image Allow the teacher role to access badge/countearners, badge/create, badge/delete, badge/find, badge/findone, badge/update, classroom/countstudents image

How to update database and server connections:

New server/client/database connections can be added by creating a new route to the respecctive server/api/ component, followed by creating a controller for that route request, and lastly adding a request method to the client/utils/requests.js file.

Updating STRAPI dump files (and creating a new one)

Outstanding Work (unfinished or not started):

Built Upon