/mps-on-track

Double Line - Minneapolis Public Schools - On Track application

Primary LanguageTSQL

MPS "On Track" Application

Local dev setup

Docker and SQL Server

  1. Install Docker for Windows or Docker Toolbox.

  2. Create a Docker volume:

> docker volume create --name=mssql-volume
  1. In the localDev/ directory, run docker-compose up -d. When running this the first time, it will download the required Docker images. Subsequent runs should start up immediately.
  2. If you are using Docker Toolbox on Win10 Home, make sure you map ports correctly.
  3. SQL Server should now be running and listening on port 1401.
  4. Connect with SSMS, using the login information:
  • Server type: Database Engine
  • Server name: 127.0.0.1,1401
  • Authentication: SQL Server Authentication
  • User: SA
  • Password: (specified in localDev/docker-compose.yml)

Reference the SQL Server on Docker documentation.

Install RoundhousE

  1. Install the dotnet global tool for RoundhousE:
> dotnet tool install --global dotnet-roundhouse --version 1.1.0

Initialize app database

  1. In Powershell, run migrations (optionally inserting test data):
PS> cd .\packages\databases\appdb\
PS> .\deployAppDb.ps1 -Environment "TEST"

Specify "TEST" as the environment to seed the database with test data. The default is "PROD".

Running the API

  1. Copy .env.default to a new file named .env and update its config values.

  2. Install Yarn. On Windows, using Chocolatey is the easiest way to install and keep Yarn up to date.

> choco install yarn
  1. Install Lerna globally:
> yarn global add lerna

If running lerna doesn't work, make sure you add the result of yarn global bin to your $PATH in your system environment variables, not just for your user.

  1. Install dependencies:
> yarn install
  1. Run API:
> yarn api:start

Running the web client

TODO

Building and deploying

$ yarn install
$ yarn build
$ yarn package

This will:

  1. Install dependencies.
  2. Execute the build script specified in the package.json of each package under the packages/ directory.
  3. Execute the package script in each package, outputting a dist/ folder with all of its dependencies.

Running tests

# Run all tests
> yarn test

# To specify a path or specific test file to run, add it as a parameter
> yarn test packages/api/

# You can also automatically re-run tests when files are changed
> yarn test --watch

There are also launch configurations set up for running tests in VS Code.


Other items

Adding a new dependency

See lerna add:

# add lodash as dependency to @mps/api package
> lerna add lodash --scope @mps/api

# add lodash as dependency to all packages
> lerna add lodash

Or just navigate to the subdirectory and use yarn add as usual.

Removing a dependency

Currently this must be done directly with Yarn workspaces:

> yarn workspace @mps/api remove helmet

Or just navigate to the subdirectory and use yarn remove as usual.