This monorepo contains the applications and services that constitute the Rhizone Learning Management System.
You can clone the repository via HTTPS as normal, but if you plan to contribute code to this repository in the future, you may want to consider installing and configuring the GitHub CLI tool to clone the repository after logging in. This helps address authentication errors when pushing commits to your working branch in the repository.
gh auth login
. Choose the following
options:
GitHub.com
SSH
Y
leave this blank, just press [ENTER]
Login with a web browser
[ENTER]
to complete the login process in the
terminal.~/Developer
.gh repo clone OpenTree-Education/rhizone-lms
to clone the repository.code rhizone-lms
Otherwise, open the repository in the editor or IDE of your choice.The app uses GitHub as an auth provider. Each dev must create their own GitHub app to handle authentication.
Rhizone LMS (Development)
http://rhi.zone-development/
Rhizone LMS (Development)
http://api.rhi.zone-development/auth/github/callback
.env.example
file in
the clone you made of the repository and name it .env
.
GITHUB_CLIENT_ID
.GITHUB_CLIENT_SECRET
.The development environment assumes that the domains rhi.zone-development
and
api.rhi.zone-development
resolve to your dev machine.
hosts
file for editing. You may need to do this with
administrator privileges. On macOS and Linux, the file is at /etc/hosts
.
On Windows it is at C:\Windows\System32\drivers\etc\hosts
.127.0.0.1 rhi.zone-development
127.0.0.1 api.rhi.zone-development
The development environment uses Docker Compose to run all the required services at once.
docker compose up
to start the dev environment.CTRL + C
to stop Docker Compose.When accessing http://rhi.zone-development/ or http://api.rhi.zone-development/,
the Nginx configuration that Docker Compose uses first checks to see whether the
webapp or api are running on localhost
, respectively. If they are, the
requests are forwarded to localhost
, otherwise they're forwarded to their
Docker containers.
While working on the api, run yarn develop
from the ./api/
directory while
docker compose up
is also running.
While working on the webapp, run yarn develop
from the ./webapp/
directory
while docker compose up
is also running.
When working on tasks such as Nginx configuration or database migrations, or
after pulling changes to the webapp or api from GitHub, the images need to be
rebuilt before starting Docker Compose again. This can be done with either
docker compose build
or docker compose up --build
.
/api
The /api
folder contains an Express.js server that
exposes an HTTP API that allows other applications to interact with the
database and third-party services like GitHub.
/db
The /db
folder contains scripts and migrations for the database.
/nginx
The /nginx
folder contains configuration files for Nginx for different
environments.
/webapp
The /webapp
folder contains a React app that enables user functionality and
communicates with the api.
This project expects specific versions of Node and Yarn to be used. It is
recommended to install Node Version Manager and
call nvm use
from each project directory before running Node scripts.
nvm
offers additional tips in its documentation about
deeper shell integration
such as automatically calling nvm use
when using the cd
command.
docker compose
takes longer to type than dc
, so add an alias in your shell
to simplify running commands. For example, the following will add a line
aliasing dc
to docker compose
in the ~/.profile
file.
echo 'alias dc="docker compose"' >> ~/.profile
source ~/.profile
Then any docker compose
command would be able to be run with dc
. For
example, docker compose up
, would be simply dc up
.
.gitignore
fileYour operating system and IDE may create files and folders inside the project
directory. Since the project can't account for which operating systems and IDEs
its contributors use, these paths are not listed in the project's .gitignore
file.
To prevent these files from getting picked up by Git across your machine, create
a global .gitignore
file. Check out
this Gist for more
info.
ESLint and Prettier can automatically fix many mistakes that will cause
automated checks to fail. It is recommended to use the preconfigured
yarn delint
command before committing to a module that supports it.
For files that aren't reformatted by Prettier, configure your IDE to ensure there is a newline at the end of the file on save.