AnnaDodson / step-challenge

Step Challenge webApp
GNU Affero General Public License v3.0
7 stars 4 forks source link

Step Challenge Web App

Built for a company step challenge competition. In beta.

Contents

  1. Tech stack
  2. Contributing
  3. License
  4. Requirements
  5. To Run Locally
  6. To Build the App
  7. To Build and Run in Docker

Tech stack

Contributing

Check out the contributing guide for instructions on how to contribute to this project.

License

This app is licensed as the GNU Affero General Public License v3.0.

Check you're happy with this before contributing or using the source code.

tldrlegal.com/license/gnu-affero-general-public-license-v3-(agpl-3.0)

Requirements

// TODO

To Run Locally

The front end is all within the ClientApp directory. It needs building and running locally to make changes to the React files. There's a great indepth README in this directory.

In the ClientApp directory, first install all the node modules:

$ npm i

Then run the node server

$ npm start

The main dotnet app is configured to proxy to the front end port, you can change this in the StartUp.cs file if you don't need to build the React front end.

Make sure your environment variable is set to development.

ASPNETCORE_Environment=Development

The sqlite db will be automatically created on startup into the db directory.

Run the dotnet app from the command line:

$ dotnet run

Or through Rider or Visual Studio.

It uses SSL for the authentication, so ignore or accept local host to run locally on https.

To Build the App

Build the front end first:

$ npm run build

Then build the main app:

$ dotnet publish

**Note, this currently doesn't work very well!

To Build and Run in Docker

Build the docker image:

$ git clone https://github.com/AnnaDodson/step-challenge.git
$ cd step-challenge
$ git checkout docker
# docker build -t stepchallenge .

Create a volume for the database:

# docker volume create stepchallenge-db

Create the Container:

# docker create --name=stepchallenge -v stepchallenge-db:/app/db -p 80:80 --restart=unless-stopped stepchallenge

Start the container:

# docker start stepchallenge

Running locally in docker

To run docker locally, you'll need to set up local certs for the ASP identity to work. See documentation here.

To create the container:

docker create --rm -it -p 8000:80 -p 8001:443 -e ASPNETCORE_URLS="https://+;http://+" -e ASPNETCORE_HTTPS_PORT=8001 -e ASPNETCORE_Kestrel__Certificates__Default__Password="crypticpassword" -e ASPNETCORE_Kestrel__Certificates__Default__Path=/https/aspnetapp.pfx -v ${HOME}/.aspnet/https:/https/ -v stepchallenge-db:/app/db --name=stepchallenge stepchallenge

Then navigate to https://localhost:8001

Seed Data

If the database is empty on start-up, the data seeder will run and generate some dummy data.

Four participants are created, one of which is admin and 8 teams. 6 teams do not have any participants, if you need any more - add them into the seeder.

Username Password Team Admin
alice alicePassword1! Team_1 true
bob bobPassword1! Team_1 false
susan susanPassword1! Team_2 false
helga helgaPassword1! Team_2 false

You can create new participants by registering them: https://localhost:8001/register

There's an admin area where you can edit participants, teams and adjust settings: https://localhost:8001/admin

Happy Stepping!