Skip to content

SpringACT/digital-safe

Repository files navigation

How to build and run

Install Redis 7

Install Postgres 9.x+ (12.x+ preferred)

Then, from the project directory...

Prerequisites

  1. Install the Azure CLI. Ask a tech team member to set up an Azure account for you and provide the credentials. Then, navigate to the Azure Portal and follow the instructions that appear to change your password and set up MFA for your account. Finally, run az login.

  2. Ask one of the tech team members to add your IP address to the allow list of the firewall of the Postgres Database.

Install all dependencies

npm i ; cd server/ && npm i && cd .. ; cd client/ && npm i && cd ..

Development

For development, run

ENVIRONMENT=DEVELOPMENT npm run dev

# Or: BROWSER=none ENVIRONMENT=DEVELOPMENT npm run dev

to build and run both the server and the client.

Then visit http://localhost:3000 to test this app (this is the client's dev server)

  • The homepage will be the Digital Safe's login/account creation page

Or, visit http://localhost:2999 (the server's dev server) to see how this app will look and behave in production

  • Run Kutt locally by putting a .env file we give into your kutt directory, then running sudo docker-compose up -d
  • The homepage will be the Kutt homepage (which our server proxies through to), a working URL shortener site we are pretending to be
  • You will need to obtain a temporary URL from a test chat bot in order to log into your Digital Safe
  • Server headers are set correctly (because we're not proxying through the client's dev server to server.ts)
  • Rate-limiting middleware will work, unlike when visiting the client's dev server, also due to the proxying setup

Production

To test a production build (by building and running just the server), but using DEVELOPMENT resources (e.g., Redis), run

npm run build-prod && ENVIRONMENT=DEVELOPMENT node server/dist/server.js

To run a production build elsewhere, run the same command but with ENVIRONMENT equal to TEST_SERVER, STAGING, or PRODUCTION, depending on where you're running the Digital Safe.

Environment variables

  • ENVIRONMENT (required)

    • Use ENVIRONMENT=DEVELOPMENT, ENVIRONMENT=TEST_SERVER, ENVIRONMENT=STAGING, or ENVIRONMENT=PRODUCTION
  • KUTT_URL (optional)

    • This is to manually override the default Kutt URL to proxy to, which is...
      • https://old.tinylink.me/ when ENVIRONMENT=DEVELOPMENT
      • http://localhost:3001/ when ENVIRONMENT=PRODUCTION
    • Useful for using development resources but wanting to do a production build, for example on a test server
  • BROWSER (optional; only relevant during dev)

    • If you are annoyed that the dev server keeps opening your browser to the same URL over and over again, use BROWSER=none

Testing

Selenium Testing

Use npx mocha qaAutomationTests/tests/createSafeTestCases.js --browser Chrome --machine (windows/mac/ubuntu) in your terminal to run the testcase locally

To use Mocha Test Explorer-

  • Save the changes and complie the test file if you add any new changes
  • click on flask icon in activiy bar
  • Refresh clicking on 'refresh' icon
  • Expand the test suite, you can either run all the cases at once or a specific test case clicking on 'run' icon

About

Digital Safe Application

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 14