There are two ways to run this project: using Docker-compose (Development version), using Kubernetes (Production version).
To run this project using Docker-compose you need have installed:
- Docker
- Docker-compose
- Nodejs
To run this project using Kubernetes you need have installed:
- Docker
- Kubernetes
To run project you need to fill required environment variables in docker/dev/docker-compose.yml
or
in kubernetes/production/configmaps/*.yaml
and kubernetes/production/secrets/*.yaml
There is one created admin user in project. To accept exercises you have to be logged as administrator with those credentials:
- Login: admin@example.com
- Password: AdminAdmin123
In our project, we use the Auth0 authorization system using a free billing plan. Only 1000 machine-to-machine token requests per month are available in the free plan. Therefore, when the tokens run out, you will need to comment out the relevant code fragments and disable validation and token requests. In functions where a token is fetched and returned, "fake_token" should be returned.
Files that need to be edited:
backend/index.js
line 23backend/routes/exercises.js
line 15backend_containers/index.js
line 17frontend/src/helpers/useToken.js
line 10tests/wdio.conf.js
line 7tests/wdio_ci.conf.js
line 7
To build and push project to Dockerhub run (all components):
./bin/build-and-push.sh
To build and push selected component to Dockerhub run (available components: bash, c, cpp, java, javascript, python, r, backend, backend_containers, frontend):
./bin/build-and-push.sh [component_names]
For example:
./bin/build-and-push.sh frontend
./bin/build-and-push.sh backend backend_containers python
Before running the project in the development version, you need to install dependencies in the frontend, backend and
backend_containers folders using npm install
or yarn install
To start development version run:
./bin/start-development.sh
To stop development version run:
./bin/stop-development.sh
To start production version run:
./bin/start-production.sh
To stop production version run:
./bin/stop-production.sh
Before running the tests, you need to run the development version of the project using the above scripts. Additionally
you need to install dependencies in tests folder with npm install
or yarn install
.
To run all tests run this command:
./bin/run-tests.sh
To run tests from selected suite run this command (available suites Login, Exercises, Editor, Exercise, ExercisesForm, AdminPage, Personalization, Statistics):
./bin/run-tests.sh --suite [suite]
For example:
./bin/run-tests.sh --suite Login
./bin/run-tests.sh --suite Exercises --suite Editor
To run tests from selected file run this command:
./bin/run-tests.sh --spec [path_to_file]
For example:
./bin/run-tests.sh --spec ./test/specs/login.js
You can also run tests with yarn. To run the following tests you must be in the tests folder
For example:
yarn test
yarn test --suite Login
yarn test --suite Exercises --suite Editor
yarn test --spec ./test/specs/login.js
Instruction to start Kubernetes Dashboard and Kubernetes Metrics-server