Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve install docs #950

Merged
merged 6 commits into from
Sep 25, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 59 additions & 49 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,78 +20,87 @@ The system requirements depend on how you install UDOIT. If you use Docker, the
### Option 1: Git
We strongly recommend managing the source code through Git. The benefit of this method is that you can update an existing installation of UDOIT by simply using `git pull`. It also lets you roll back to previous versions if needed. Follow these steps:

1. Install Git on your server
2. Navigate to the directory on your server where UDOIT will live
3. Run `git clone [email protected]:ucfopen/UDOIT.git . ` (The . is important. It tells Git to download the files to the current directory.)
1. Install Git on your server (https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
2. Create the directory in which UDOIT will reside (e.g `UDOIT`) and navigate to it.
3. Inside the UDOIT directory, run `git clone [email protected]:ucfopen/UDOIT.git . ` (The . is important; It tells Git to download the files to the current directory.)

### Option 2: Zip File
If you prefer not to use Git, you can download a zip file of the latest release from the [Releases Page](https://github.com/ucfopen/UDOIT/releases). Unzip it in the directory on your server where UDOIT will live.
If you prefer not to use Git, you can download the zip file of the latest release from the [Releases Page](https://github.com/ucfopen/UDOIT/releases). Unzip it in the directory in which UDOIT will reside.

## .ENV Setup
UDOIT uses a `.env` file for storing configuration variables. To create it:
UDOIT stores configuration variables in a `.env` file. To create it:

1. Copy the file `.env.example` to `.env` by running
1. Inside the UDOIT directory, run the following command in shell:
```
cp .env.example .env
```
2. Leave `APP_ENV` set to `prod`
> If you are setting up a development environment, set this to `dev` and follow the steps in [Installing Composer Dependencies](#installing-composer-dependencies) without the `--no-dev` flag to obtain all of the development packages.
3. Add your database information to the `DATABASE_URL` variable. (The default value of `mysql://root:root@db:3306/udoit3` is suitable for running it on your local computer using Docker.)
4. Modify the `BASE_URL` to match the URL of your instance of UDOIT. (The default value of `http://127.0.0.1:8000/udoit3` is suitable for running it on your local computer using Docker.)
5. Modify the `WEBPACK_PUBLIC_PATH` to match the `BASE_URL` you set. (The default value of `/udoit3/build` is suitable for running it on your local computer usind Docker. Example: If your `BASE_URL` is set to `http://127.0.0.1:8000`, your `WEBPACK_PUBLIC_PATH` should be `/build`.)
6. Set `APP_LMS` to the name of your LMS.
* `canvas` if you are using the Canvas LMS.
* `d2l` if you are using the D2l Brightspace LMS.
7. If you are using UDOIT with a self-hosted instance of Canvas, you can add the `JWK_BASE_URL` variable and set it to the URL of your instance of Canvas. (Example: `JWK_BASE_URL="https://canvas.dev.myschool.edu"`)
8. (Optional) You can change the default language for your entire UDOIT instance by adding the `DEFAULT_LANG` variable. Currently supported languages are English (`en`) and Spanish (`es`).

## Docker
We provide a fast and simple way of setting up a local UDOIT instance through the use of Docker containers.

### 1. Install Docker
To set up the docker containers, you must first install [Docker](https://docs.docker.com/get-docker/) and [Docker Compose](https://docs.docker.com/compose/install/).

### 2. Build the Containers
If you prefer to build the containers yourself, or you are actively developing UDOIT and need to rebuild the containers to test your cahnges, run the following command from within the UDOIT directory:

This command copies the `.env.example` into `.env`, creating the `.env` file in the process if it does not exist.

2. Open `.env` with a text editor and make the necessary changes to the following variables:
SimHoZebs marked this conversation as resolved.
Show resolved Hide resolved
- `APP_ENV`: If you are setting up a development environment, change this to `dev` and follow the steps in [Installing Composer Dependencies](#installing-composer-dependencies) without the `--no-dev` flag to obtain all of the development packages. Otherwise, leave it as `prod`.
- `DATABASE_URL`: If you are hosting UDOIT on Docker or your local machine, leave it as it is. Otherwise, change it to your database URL.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `DATABASE_URL`: If you are hosting UDOIT on Docker or your local machine, leave it as it is. Otherwise, change it to your database URL.
- `DATABASE_URL`: If you are hosting UDOIT on Docker locally, leave it as it is. Otherwise, change it to your database URL.

This only works if Docker is running on your local machine, not either or. Same suggestion for the following two lines, but I'm good with any other similar changes!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If UDOIT is being hosted locally, doesn't that also mean the database is available too? Or are we seeing the database as a separate piece?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They should be separate, though I definitely misread what your comment was trying to say. Will make a small change and work on pushing this up to dev!

- `BASE_URL`: If you are hosting UDOIT on Docker or your local machine, leave it as it is. Otherwise, change it to the URL of your instance of UDOIT.
- `WEBPACK_PUBLIC_PATH`: Uf you are hosting UDOIT on Docker or your local machine, leave it as it is. Otherwise, change it to match the `BASE_URL`in such a way that `/build` is located at the root of the `BASE_URL` (Example: If your `BASE_URL` is set to `http://127.0.0.1:8000`, your `WEBPACK_PUBLIC_PATH` should be `/build`).
- `APP_LMS`:
* `canvas` for Canvas LMS.
* `d2l` for D2l Brightspace LMS.
- `JWK_BASE_URL`: If you are self-hosting Canvas, you may set it to the URL of your instance of Canvas. (Example: `JWK_BASE_URL="https://canvas.dev.myschool.edu"`)
- `DEFAULT_LANG`: (optional) the default language of UDOIT. This is English by default.
- `en` for English
- `es` for Spanish.

## Installation

### Option 1. Docker
We provide a fast and simple way of setting up a local UDOIT instance through Docker.

1. Install [Docker Desktop](https://docs.docker.com/get-docker/). This will install Docker and Docker Compose on your system.
> Alternatively, you may install Docker and [Docker Compose](https://docs.docker.com/compose/install/) individually.

3. Build the Containers
If you prefer to build the containers yourself, or you are actively developing UDOIT and need to rebuild the containers to test your changes, run the following command from within the UDOIT directory:
```
docker compose -f docker-compose.nginx.yml up
```

### 3. Wait
Wait for all of the containers to finish initializing. This can take over 15 minutes. You will know you are ready to proceed with the next step when you haven't seen any output in your terminal for a few minutes.

### 4. Set up the Database
The first time you start the containers, you will need to set up the database to handle all the information UDOIT generates as it runs. Run the following command:
4. Wait for the containers to finish initializing. This may take over 15 minutes. If you see no output in your terminal for few minutes, proceed to the next step.
SimHoZebs marked this conversation as resolved.
Show resolved Hide resolved

5. Once the containers are intialized, run the following command:
SimHoZebs marked this conversation as resolved.
Show resolved Hide resolved
```
docker compose -f docker-compose.nginx.yml run php php bin/console doctrine:migrations:migrate
```
This applies migrations necessary to set up the database to store all UDOIT data.

> You will also need to run that command whenever you update to a new version of UDOIT.
Running this will give the following warning:
> WARNING! You are about to execute a migration in database "udoit3" that could result in schema changes and data loss. Are you sure you wish to continue? (yes/no) [yes]:

### 5. Next steps
Skip to [Testing your Setup](#testing-your-setup) to continue.
Don't worry! Simply type `yes` and proceed.
SimHoZebs marked this conversation as resolved.
Show resolved Hide resolved

### 6. Stopping the Containers
If you ever want to stop the containers, you can do so with the following command:

docker compose -f docker-compose.nginx.yml down
> You will need to run this command whenever you update to a new version of UDOIT.

5. UDOIT should be installed and running in your Docker cotnainer.
SimHoZebs marked this conversation as resolved.
Show resolved Hide resolved

6. To stop UDOIT, run the following command:
SimHoZebs marked this conversation as resolved.
Show resolved Hide resolved
```
docker compose -f docker-compose.nginx.yml down
```

## Manual Installation
### Option 2. Manual Installation
If you prefer not to use Docker, the process is more complicated:

### Configuring your Web Server
1. Configuring your Web Server
The details of configuring a web server with PHP are out of the scope of this README. You should configure your web server to point to UDOIT's "public" folder as the web root folder. Doing this will hide the configuration and source files so that they are not web accessible. It will also clean up your URL structure so that you don't need to include the "public" folder in any of the URLs to UDOIT.

If you are using NGINX as your web server, you can use the `build/nginx/nginx.conf` file as a starting point.

### Installing Composer Dependencies
2. Installing Composer Dependencies
UDOIT uses Composer to install PHP dependencies. Follow the upstream documentation on [Composer Installation](https://getcomposer.org/download/) to install `composer.phar` into the project root, then run the following:

php composer.phar install --no-dev

> Remove the `--no-dev` flag if you set `APP_ENV=dev` in your `.env.local` file.

### Database Setup
3. Database Setup
While UDOIT is configured to use MySQL or MariaDB by default, Symfony can be configured to work with other databases as well. See the Symfony documentation for details.

Use Symfony to create the database with this command:
Expand All @@ -110,7 +119,7 @@ If you are operating in a production environment you will need to generate the d

php bin/console cache:warmup --env=prod

### JavaScript
4. JavaScript
UDOIT uses [node](https://nodejs.org) and [yarn](https://yarnpkg.com/) to compile the JavaScript. Install Node and Yarn on your system, then run:

yarn install
Expand All @@ -119,16 +128,17 @@ To build the JavaScript files for production, run the command:

yarn build

## Testing Your Setup
Once you have completed the steps above you will want to test your setup. Unfortunately, UDOIT is an LTI tool that can only fully run within the LMS. You will need to complete the steps in the [INSTALL_CANVAS.md](INSTALL_CANVAS.md) or [INSTALL_D2L.md](INSTALL_D2L.md) to test UDOIT fully.

However, UDOIT does have one URL that is publicly available outside of the LMS. To test your server setup point your browser to:
## Testing successful installation
While UDOIT only functions fully within an LMS, there is one URL publicly available you can access to test your server setup.
SimHoZebs marked this conversation as resolved.
Show resolved Hide resolved

<BASE_URL>/lti/config

For example, if you are setting this up on your local computer via Docker, it may look like:

http://127.0.0.1:8000/udoit3/lti/config

## Configuring Your LMS
You will need to complete the steps in the [INSTALL_CANVAS.md](INSTALL_CANVAS.md) or [INSTALL_D2L.md](INSTALL_D2L.md) to configure UDOIT to work within your LMS.

## Connecting UDOIT to an LMS
UDOIT is an LTI tool that functions fully within an LMS.
SimHoZebs marked this conversation as resolved.
Show resolved Hide resolved
- To install it on Canvas, follow [INSTALL_CANVAS.md](INSTALL_CANVAS.md)
- or for D2l Brightspace, follow [INSTALL_D2L.md](INSTALL_D2L.md)