Skip to content

Developer setup

François Poguet edited this page Apr 2, 2021 · 40 revisions

Requirements

  • NodeJS (at least > v14)
  • MariaDB > v10.4
  • Git
  • Bash (or equivalent) to run the git hooks
  • A .env file with all the mandatory variables

Git hooks

We use some githooks to automate some tasks: format & lint code, run tests, update API documentation. Install them in your local repository with ./githooks/setup-hooks.sh. This requires to have the API docs repository cloned next to the main repository

$ ls -l MAIN_FOLDER
guacamole/
guacamole-api-docs/
wiki/
[... other files]

Create the database

# Create the guacamole user
CREATE USER 'guacamoleUser'@'localhost' IDENTIFIED BY 'p@ssword';

# Create the database
CREATE DATABASE guacamoleDb;
GRANT ALL PRIVILEGES ON guacamoleDb.* TO 'guacamoleUser'@'localhost';

-- Create the database for tests
CREATE DATABASE guacamoleTestDb;
GRANT ALL PRIVILEGES ON guacamoleTestDb.* TO 'guacamoleUser'@'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).

Set the .env

The .env is a file containing all the environment variables required to run the server. It must be in the server/ directory. See below the template of the required .env file

Run development server

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

Load testing

Use npm run test:generate-data <number-of-users> <number-of-duels> to generate fake data in your dev database. It take approximately 10 minutes for 300 users and 3000 rounds (the default settings).

Clone this wiki locally