Skip to content

Commit

Permalink
Release/v0.4 (#90)
Browse files Browse the repository at this point in the history
* Added basic page routing with home and mentor login

* Added Private Routing

* Added login styling and fixed privateroute

* Adjusted workspace css

* Added header component

* Implemented basic css color scheme

* activities can only belong to one topic

* commit development db and rewrote db script for other environment imports

* added classroom, mentor, school, session, student, submission models

* updated db dump

* WIP: Committing Minor Style Updates

* Render school list on teacher dashboard

* submissions don't exist under a session

* add user to metor

* add result and status to submission

* update dev db dump

* add custom session logic for getting by code, creating, and joining

* Adding session listings

* update dev db

* fix sequence on session table

* added validation to session/join

* check the classroom for join

* add antd and less; begin styling workspace w/ color scheme

* add second pannel to workspace view; use logo; style panels;

* finished general styling for workspace view

* add carousel for activity diagrams

* remove unused styles

* init cd

* fix container height issue

* blockly canvas expand a little more on larger screen

* Manual cleanup from merge conflict

* Added auth to route requests

* change .css files to .less files; basic styling for home and login pages

* removed submissions/attempts till we flesh this out more

* sessions now have activities

* sessions has students, and students has sessions

* get /sessions/code/:code returns a list of classroom students

* post /sessions/join logs in a classroom student

* added required fields to session and added validation to create session

* cleaned up validation errors

* cleaned up find topics

* Cleaned up warnings

* display mentor session data in table

* Now authenticating student and storing jwt

* update jwt config

* created isStudent policy

* added student info to ctx state in the permissions policy

* created /sessions/student/activities

* added student to normal user object to eliminate proxy student user

* moved frontend middleware settings to middleware config

* added /students/me

* comments

* added /mentor/me

* modified student auth

* created hasClassroom policy to check if a mentor has access to a classroom

* Added new student view

* Setup basic routing from student to workspace

* added hasClassroom to create session and now do 404 instead of 400

* updated dump

* Fixed error on arduino code alert

* updated cms/api documentation

* Update README.md

* align table items

* Updating /client docs

* add filter on classes; add sort alphabetically on session name; update db on session active toggle

* Added basic errors for logins

* Added bearer auth to /toolbox request

* WIP: Not populating with data

* created hasSession policy

* added custom update logic and moved the util functions into session service

* fix sessions table populating bug

* move setSessions into getClassrooms callback

* changed code generation and made the code a string to support leading 0s

* fixed session table and mentor update perm in db dump

* fix workspace UI bugs

* added policy to create mentor and added custom logic

* init test

* fix init mentor tests

* init documentation and other tweaks

* init k6 load test

* update scripts and dependenices

* finished join code/teacher login UI

* began student login view

* add and populate student name/animal dropdowns

* use array of ids on student jwt token

* fix student/me endpoint; fix setUser session bug

* set placeholder for student login selectors

* fix 'lo0se join code on refresh' bug

* css refactor and minor styling fixes to workspace

* style student view; handle routing to workspace for activity

* added fault protection to policies

* added validator service

* fixed join logic and beefed up other session controllers

* finished stuents/me and simplified student user token

* await the attach call for new students to a session

* fix postJoin function in client

* join with studentId as ints

* Added sandbox view and basic routing, need /toolbox/all

* Created /all request and cleaned up leftover code from workspace

* added sandbox toolbox endpoint

* make /sandbox/toolbox

* fix errors and warnings on render of new views

* broke out sandbox toolbox endpoint to its own controller

* updated db dump

* fix set state before mount

* remove useCallback

* remove dashboard logging

* Fixed render error for toolbox map

* student view styling fix

* Added sandbox button back

* removed old config

* updated frontend routes

* Update README.md

add style info to readme

* Update README.md

add info on how to enable web serial api

* fix home page styling

* added favicon; change index.html title to CASMM

* begin redoing mentor view with class cards

* In strapi admin: use casmm theme, update favicon, and add casmm-logo

* set admin homepage title

* set grid layout for classroom cards in dashboard; start roster view

* set grid layout for classroom cards in dashboard; start roster view

* add routing for /roster/:id; create table of students with edit feature

* settings for serving admin seperate in the future

* only use en translation

* increase margin on admin panel menu logo; add logo to login and style

* add MentorSubHeader component and implement in dashboard and roster.

* create togglable list/card views for roster view

* fix header-nav styling; fix miscellaneous console warnings/errors

* fix styling issues on dashboard and roster

* created BlocklyCanvasPanel component and implemented in workspace and sandbox

* create component for reusable activity info panel

* remove unnecessary divs

* remove unnecessary divs

* move styling from workspace to panel components; add navigation to canvas panel via props

* migrated session logic/routes to classroom

* added int validator function

* added code to classroom and created seperate teacher entity

* stripped session content type down

* created generic classroomManager policy and updated routes and related perms

* fixed weird forEach not returing bug

* if student role doesn't exist set user undefined

* create the basic roles if bootstrap function

* don't try to create a role, just log

* update db dump

* cms -> server && stem-c -> casmm

* use yarn in compile

* add mentor activity view; add activity catalogue view

* add autocomplete searchbar to activity catalogue

* update review workflows

* Create start-review.yml

* updated init script perms

* rm server frontend files

* fix bundling

* fix list view hrefs

* fixed client requests to handle new data models

* added view student modal to roster

* i goofed and left out the s

* fix modal bug

* add enrolled attribute to student model; add set enrollment status endpoint

* fix toggle enrollment validation bug; toggle enrollment from roster list view

* Fetch activities to populate catalogue; re-set student state on toggle enrolled

* Create end-review.yml

* Update end-review.yml

* update review flows

* fix name in docker compose

* add and implement hasStudentsClassroom policy

* update client built amd move

* fix build

* fix review misspelling

* add new routes to middleware

* i'm over it

* this shouild do the trick

* multiple stage build and update push

* add update student endpoint; edit students in roster updates db

* fix view student modal displays

* update dockerignore

* compile server stage into final for server os

* add casmm to client

* deploy script

* use new deploy script in all workflows

* fix deploy script

* add get pr

* add github token

* encapsulate variable

* fix typ

* add token to the other workflows

* prepend review-pr- in update review

* don't use minor version on a release

* update script

* don't use multistage builds for now for better caching

* don't use docker copy

* build client in app folder

* Bump lodash from 4.17.15 to 4.17.19 in /test

Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](lodash/lodash@4.17.15...4.17.19)

Signed-off-by: dependabot[bot] <[email protected]>

* fix client bundling in build

* update testing framework and commit test db dump

* remove teacher from create classrooms

* don't exit 0 from script

* include && for client bundling

* update dump and require enrollment

* Update README.md

* Update README.md

* Update README.md

* Added workflow for tagging onto master

Co-authored-by: Dakota Rennemann <[email protected]>
Co-authored-by: Adam Tamargo <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
4 people authored Jul 23, 2020
1 parent 1456d3a commit b0c1bb2
Show file tree
Hide file tree
Showing 289 changed files with 10,748 additions and 203,873 deletions.
9 changes: 3 additions & 6 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# Directories
*/node_modules
cms/.tmp

# Data
cms/er_diagram.png
cms/strapi.sql
*/build
*/.cache
*/.tmp
23 changes: 23 additions & 0 deletions .github/workflows/deploy-production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Deploy Production
on:
release:
types: [ published ]
branches: [ master ]
jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v2
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
- name: Built, test, and deploy app
run: ./scripts/build_test_deploy.sh
env:
IMAGE_NAME: server
IMAGE_TAG: ${{ steps.get_version.outputs.VERSION }}
APP_NAME: casmm
APP_TYPE: web
HEROKU_API_KEY: ${{ secrets.HEROKU_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22 changes: 22 additions & 0 deletions .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Deploy Staging
on:
push:
branches: [ 'release/v[0-9].[0-9]' ]
jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v2
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/heads/release/}
- name: Built, test, and deploy app
run: ./scripts/build_test_deploy.sh
env:
IMAGE_NAME: server
IMAGE_TAG: staging-${{ steps.get_version.outputs.VERSION }}
APP_NAME: casmm-staging
APP_TYPE: web
HEROKU_API_KEY: ${{ secrets.HEROKU_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18 changes: 18 additions & 0 deletions .github/workflows/end-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Delete Review App
on:
pull_request:
branches: [ develop ]
types: [ closed ]
jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Delete review app
id: app
uses: STEM-C/auto/[email protected]
with:
base: review
pipeline: ${{ secrets.PIPELINE_ID }}
token: ${{ secrets.HEROKU_TOKEN }}

42 changes: 42 additions & 0 deletions .github/workflows/start-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Create Review App
on:
pull_request:
branches: [ develop ]
types: [ opened, reopened ]
jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v2
- name: Create review app
id: app
uses: STEM-C/auto/[email protected]
with:
base: review
pipeline: ${{ secrets.PIPELINE_ID }}
token: ${{ secrets.HEROKU_TOKEN }}
- name: Import development database
run: ./scripts/init_db.sh
env:
ENVIRONMENT: development
DATABASE_URL: ${{ steps.app.outputs.database_url }}
SCRIPT_PATH: ./scripts
- name: Built, test, and deploy app
run: ./scripts/build_test_deploy.sh
env:
IMAGE_NAME: server
IMAGE_TAG: ${{ steps.app.outputs.app_name }}
APP_NAME: ${{ steps.app.outputs.app_name }}
APP_TYPE: web
HEROKU_API_KEY: ${{ secrets.HEROKU_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: chrnorm/deployment-action@releases/v1
name: Create GitHub deployment
if: success()
id: deployment
with:
initial_status: "success"
token: ${{ github.token }}
target_url: https://${{ steps.app.outputs.app_name }}.herokuapp.com
environment: ${{ steps.app.outputs.app_name }}
18 changes: 18 additions & 0 deletions .github/workflows/tag-master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Tag New Master Release
on:
pull_request:
branches:
- master
types: [closed]
jobs:
run:
runs-on: ubuntu-latest
steps:
# check out the repository
- name: Checkout
uses: actions/checkout@v2

- name: Tag Master
uses: STEM-C/auto/[email protected]
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
23 changes: 23 additions & 0 deletions .github/workflows/update-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Update Review App
on:
pull_request:
branches: [ develop ]
types: [ synchronize ]
jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v2
- name: Get review app name
id: get_name
run: echo ::set-output name=NAME::review-pr-$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')
- name: Built, test, and deploy app
run: ./scripts/build_test_deploy.sh
env:
IMAGE_NAME: server
IMAGE_TAG: ${{ steps.get_name.outputs.NAME }}
APP_NAME: ${{ steps.get_name.outputs.NAME }}
APP_TYPE: web
HEROKU_API_KEY: ${{ secrets.HEROKU_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ yarn-error.log*
.cache/
*.dump
!development_db.dump
!test_db.dump

# Packages
*.zip
Expand All @@ -28,5 +29,5 @@ yarn-error.log*
# node
node_modules/
build/
cms/public/frontend/*
!cms/public/frontend/.gitkeep
server/public/frontend/*
!server/public/frontend/.gitkeep
26 changes: 5 additions & 21 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,35 +1,19 @@
FROM strapi/base

WORKDIR /usr/src/app/client

# Install client dependencies
COPY ./client/package.json .
COPY ./client/yarn.lock .
RUN yarn install

# Build client
COPY ./client .
RUN PUBLIC_URL=/frontend yarn build

WORKDIR /usr/src/app

# Install app dependencies
COPY ./cms/package.json .
COPY ./cms/yarn.lock .
COPY ./server/package.json .
COPY ./server/yarn.lock .
RUN yarn install

# Bundle app source
COPY ./cms .
RUN mv ./client/build/* ./public/frontend && rm -r ./client

# Set the env to prod for build
COPY ./server .
ENV NODE_ENV production

# Build admin
RUN yarn build

# Port mapping
EXPOSE 1337

# Run when the container is started
RUN mv ./client/build/* ./public/frontend \
&& rm -rf ./client
CMD yarn start
55 changes: 28 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# STEM+C
# CaSMM

> Cloud-based programming interface
> Computation and Science Modeling through Making
Cloud-based programming interface

![Review](https://github.com/STEM-C/CaSMM/workflows/Review/badge.svg)
![Deploy Staging](https://github.com/STEM-C/CaSMM/workflows/Deploy%20Staging/badge.svg)
![Deploy Production](https://github.com/STEM-C/CaSMM/workflows/Deploy%20Production/badge.svg)

<br/>

Expand All @@ -9,15 +15,15 @@
### `/`

#### `client/`
[Client](/client#client) is the frontend of the application. It is powered by [React](https://reactjs.org/) and [Blockly](https://developers.google.com/blockly).
[client](/client#client) is the frontend of the application. It is powered by [React](https://reactjs.org/) and [Blockly](https://developers.google.com/blockly).

#### `cms/`
#### `server/`

[Cms](/cms#cms) is the REST API and admin portal that powers the backend. It is powered by [Node](https://nodejs.org/en/) and [Strapi](https://strapi.io/documentation/v3.x/getting-started/introduction.html).
[server](/server#server) is the web server and application server. It is powered by [Node](https://nodejs.org/en/) and [Strapi](https://strapi.io/documentation/v3.x/getting-started/introduction.html).

#### `compile/`

[Compile](/compile#compile) is an arduino compiler service. It is an unofficial fork of [Chromeduino](https://github.com/spaceneedle/Chromeduino).
[compile](/compile#compile) is an arduino compiler service. It is an unofficial fork of [Chromeduino](https://github.com/spaceneedle/Chromeduino).

<br/>

Expand All @@ -26,70 +32,65 @@
> The project is divided into three conceptual environments.
### Development
This project's dependencies are managed through [yarn](https://classic.yarnpkg.com/en/docs/install/#mac-stable). This effectively replaces npm and should be used in place of npm everywhere except sc-compile-dev.
The following are the available scripts we can use with the client and server:
This project's dependencies are managed through [yarn](https://classic.yarnpkg.com/en/docs/install/#mac-stable). This effectively replaces npm.

#### Structure

The development environment is composed of four servers. The first one is run with the [Create React App](https://create-react-app.dev/docs/getting-started/) dev server. The later three are containerized with docker and run with [docker compose](https://docs.docker.com/compose/).

* `stem-c-client-dev` - localhost:3000
* `stem-c-cms-dev` - localhost:1337
* `stem-c-compile-dev` - localhost:8080
* `stem-c-db-dev` - localhost:5432
* `casmm-client-dev` - localhost:3000
* `casmm-server-dev` - localhost:1337
* `casmm-compile-dev` - localhost:8080
* `casmm-db-dev` - localhost:5432

#### Running

`stem-c-client-dev`
`casmm-client-dev`

1. Follow the [client](/client#setup) setup
2. Run `yarn start` from `/client`

`stem-c-cms-dev`, `stem-c-compile-dev`, and `stem-c-db-dev`
`casmm-server-dev`, `casmm-compile-dev`, and `casmm-db-dev`

1. Install [docker](https://docs.docker.com/get-docker/)

> If you do not meet these [requirements](https://docs.docker.com/toolbox/toolbox_install_windows/) docker desktop will not initialize properly. There are some unofficial modifications, however, we recommend installing the docker [toolbox](https://docs.docker.com/toolbox/toolbox_install_windows/)
2. Add **dev_db.dump** to `scripts/`

> Pinned in the #dev channel
3. Run `docker-compose up` from `/`

> Grant permission to the **scripts** and **cms** directories if you are prompted
> Grant permission to the **scripts** and **server** directories if you are prompted
### Staging

#### Structure

The staging environment is deployed on Heroku. It is composed of one app running a Heroku Postgres instance and a web container.

* `stem-c-staging` - [stem-c-staging.herokuapp.com](https://stem-c-staging.herokuapp.com/)
* The web container attached to this Heroku app runs `cms` and serves static `client` build files
* `casmm-staging` - [casmm-staging.herokuapp.com](https://casmm-staging.herokuapp.com/)
* The web container attached to this Heroku app runs `server`, which will serve all static files and the api
* The Heroku Postgres instance is attached as an add-on

#### Running

`stem-c-staging` is automatically built from the latest commits to `release`. Heroku runs the container orchestration from there.
`casmm-staging` is automatically built from the latest commits to `release`. Heroku runs the container orchestration from there.

### Production

#### Structure

The production environment is deployed on Heroku. It is composed of two apps. One is running a Heroku Postgres instance and a web container and the other is running just a web container.

* `stem-c` - [stem-c.herokuapp.com](https://stem-c.herokuapp.com/)
* The web container attached to this Heroku app runs `cms` and serves static `client` build files
* `casmm` - [casmm.herokuapp.com](https://casmm.herokuapp.com/)
* The web container attached to this Heroku app runs `server`, which will serve all static files and the api
* The Heroku Postgres instance is attached as an add-on
* `stem-c-compile` - [stem-c-compile.herokuapp.com](https://stem-c-compile.herokuapp.com/)
* `casmm-compile` - [casmm.herokuapp.com](https://casmm-compile.herokuapp.com/)
* The web container attached to this Heroku app runs `compile`

#### Running

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

`stem-c-compile` is manually deployed through the [Container Registry](https://devcenter.heroku.com/articles/container-registry-and-runtime) and [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli).
`casmm-compile` is manually deployed through the [Container Registry](https://devcenter.heroku.com/articles/container-registry-and-runtime) and [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli).

1. Install [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli)
2. Run the following commands sequentially
Expand Down
15 changes: 15 additions & 0 deletions client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
1. Install [Node](https://nodejs.org/en/) and [Yarn](https://classic.yarnpkg.com/en/docs/install#windows-stable)
2. Run `yarn` to install project dependencies
3. Run `yarn start` to startup the client (please note that much of the functionality will not work without also starting up the backend services)
4. Navigate to chrome://flags/ and enable the #enable-experimental-web-platform-features flag (This will provide your browser access to serial ports)

<br />

Expand Down Expand Up @@ -49,6 +50,20 @@ It correctly bundles React in production mode and optimizes the build for the be

<br />

## Styling

To maintain a consistant theme the folowing has been implemented in `\client\src\assets\style.less` for import

### Colors

primary: #3D5C82;
secondary: #5BABDE;
tertiary: #F4F4F5;
text-primary: #414141;
text-secondary: #FFFFFF;

<br />

### Relevant notes

Section on fixing issue where yarn build does not minify: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
Expand Down
Binary file modified client/public/favicon.ico
Binary file not shown.
4 changes: 2 additions & 2 deletions client/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8"/>
<link rel="icon" href="./favicon.ico"/>
<link rel="casmm-icon" href="./favicon.ico"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta name="theme-color" content="#000000"/>
<meta
Expand All @@ -24,7 +24,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>STEM+C</title>
<title>CaSMM</title>

<!--libraries for style-->
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
Expand Down
Loading

0 comments on commit b0c1bb2

Please sign in to comment.