-
Notifications
You must be signed in to change notification settings - Fork 1
Developer setup
- NodeJS (at least > v14)
- Docker and docker-compose
- Bash (or equivalent) to run the git hooks
- Git (of course)
We use some githooks to automate some tasks: format & lint code, update API documentation.
Install them in your local repository by running ./githooks/setup-hooks.sh
(you can remove the created symlinks created in .git/hooks/
in your local repository if they annoy you).
This requires to have the API docs repository cloned next to the main repository.
$ ls -l MAIN_FOLDER
apothiquiz/
apothiquiz-api-docs/
wiki/
[... other files]
Docker allows to quickly setup a database and a fake ldap server used for authentication in the app. After installing the requirements, simply run ./dev-env.sh start
in your cloned repository and follow the instructions.
This need to have the mariadb (3306) and ldap (636) ports available on your machines, or you can override them in both dev.env
and docker-compose.override.yml.
You can list the different commands provided by the script by running ./dev-env.sh help
.
Click to see instructions
This setup require to install all the dependencies on your machine and will likely be longer.
With the above requirements, you have to install mariadb
and an ldap server on your machine.
This is not the recommended path, so please figure out yourself how to do this, and then come to update this documentation.
# Create the apothiquiz user
CREATE USER 'apothiquizUser'@'localhost' IDENTIFIED BY 'apothiquizPassword';
# Create the database
CREATE DATABASE apothiquizDb;
GRANT ALL PRIVILEGES ON apothiquizDb.* TO 'apothiquizUser'@'localhost';
-- Create the database for tests
CREATE DATABASE apothiquizTestDb;
GRANT ALL PRIVILEGES ON apothiquizTestDb.* TO 'apothiquizUser'@'localhost';
Insert test data in the database with the scripts in ./server/test/required_data/*.sql
. Note that the database is emptyied after each test (it's why we use a different database for them).
Run npm install
(or npm i
) in both server/
and client/
directories to install all dependencies with npm
.
The .env
is a file containing all the environment variables required to run the server, specific to your environment.
It must be in the server/
directory.
You can use the main .env.example
as a starting point.
You can use nodemon
to auto-reload the server on changes.
For the client, use npm run start
to start the Create-React-App script, which is watching the changes by default
Use npm run test:generate-data <number-of-users> <number-of-duels>
in the server
folder to generate fake data in your dev database.
It take approximately 10 minutes for 300 users and 3000 rounds (the default settings).
Apothiquiz, by Éros Albérola, Nathanaël Houn, Valentin Perignon & François Poguet