Skip to content

Commit

Permalink
Merge branch 'dev/v3-3-0' into issue/492-empty-tables
Browse files Browse the repository at this point in the history
  • Loading branch information
bagofarms committed Aug 5, 2022
2 parents a0f71c0 + 269ce5f commit aa412c0
Show file tree
Hide file tree
Showing 76 changed files with 2,359 additions and 2,683 deletions.
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.DS_Store
.vscode/
.idea/
.git/
tests/
fixtures/
coverage/
coverage.xml
images/
node_modules/
2 changes: 1 addition & 1 deletion .env.local.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ DATABASE_URL=mysql://root:root@db:3306/udoit3

###> base url ###
# Base URL for client callbacks
BASE_URL="https://127.0.0.1:8000"
BASE_URL="http://127.0.0.1:8000/udoit3"
###> base url ###

APP_LMS=canvas
58 changes: 58 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Build UDOIT 3 Docker Image

on:
push:
branches:
- main
- 'dev/*'

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2


- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Change String Case
id: case
uses: ASzc/change-string-case-action@v2
with:
string: ${{ github.repository }}

- name: Display repository name
run: echo ${{ steps.case.outputs.lowercase }}

- name: Find-and-replace strings
id: slash
uses: mad9000/actions-find-and-replace-string@2
with:
source: ${{ github.ref_name }}
find: '/'
replace: '-'

- name: Display issue name
run: echo ${{ steps.slash.outputs.value }}

- name: Build Image
run: |
cp .env.local.example .env.local
docker-compose -f docker-compose.nginx.yml build
docker-compose -f docker-compose.nginx.yml run composer composer install --no-dev --no-interaction --no-progress --optimize-autoloader
docker-compose -f docker-compose.nginx.yml run yarn bash -c 'cd /app && yarn install && yarn build'
docker build . -t udoit:latest -f build/nginx/Dockerfile.build
docker tag udoit:latest ${{ env.REGISTRY }}/${{ steps.case.outputs.lowercase }}:${{ steps.slash.outputs.value }}
docker push ${{ env.REGISTRY }}/${{ steps.case.outputs.lowercase }}:${{ steps.slash.outputs.value }}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:7.4-fpm
FROM php:8.1-fpm
ARG ENVIRONMENT_TYPE

#Install dependencies and php extensions
Expand Down
131 changes: 62 additions & 69 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,97 +2,98 @@
UDOIT can be installed on your own existing servers with the following instructions. UDOIT is also available as a hosted and maintained product by [Cidi Labs](https://cidilabs.com). UDOIT is built using the [PHP Symfony Framework](https://symfony.com).

## System Requirements
The system requirements depend on how you install UDOIT. If you use Docker, the host system doesn't require any additional software.

### Docker Method
* Docker
* Docker Compose

### Manual Installation Method
* Apache or Nginx webserver
* PHP 8.1+
* MySQL, MariaDB or PostgreSQL
* Git (If you are using The Git Method below) or if you plan on contributing to UDOIT
* Node v16 is supported; other versions may work
* Yarn

## Source Code
We strongly recommend source code should be managed 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:
## Download the Code
### 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:

* Install Git on your server
* Navigate to the directory on your server where UDOIT will live
* 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
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.)

## Docker
We provide a fast and simple way of setting up a local UDOIT instance through the use of docker containers. 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/). Then, simply run the following command from within the UDOIT 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.

docker-compose up -d
## .ENV Setup
UDOIT uses a `.env.local` file for storing configuration variables. To create it:

Once the containers are up and running, you can access the php container by calling the command:
1. Copy the file `.env.local.example` to `.env.local` by running
```
cp .env.local.example .env.local
```
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 thie `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. 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.
6. (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`).
7. (Optional) 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"`)

docker exec -it udoit_php_1 /bin/bash
## Docker
We provide a fast and simple way of setting up a local UDOIT instance through the use of Docker containers.

By default the application is set up to create a MySQL database container, but if you wish to create a postgres container instead you can do so by modifying the file `docker-compose.yml`. The credentials required to access this database depend on the database type and can be found in this same file. You can access the database container by calling the command:
### 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/).

docker exec -it udoit_db_1 /bin/bash
### 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:

If you ever want to take down the containers, you can do so with the following command:
docker-compose -f docker-compose.nginx.yml up

docker-compose down
### 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.

Once you have set up the containers in this way, you will still need to follow the rest of the instructions in this document.
### 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:

## 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.
docker-compose -f docker-compose.nginx.yml run php php bin/console doctrine:migrations:migrate

If you are setting up a local UDOIT instance through Docker, you can simplify this step and quickly setup a server by calling the following commands from within the php container:
> You will also need to run that command whenever you update to a new version of UDOIT.
docker exec -it udoit_php_1 /bin/bash
symfony server:ca:install
symfony serve -d
### 5. Next steps
Skip to [Testing your Setup](#testing-your-setup) to continue.

Security Note: Do not use the commands above for production installations. Use software such as [Apache](https://httpd.apache.org) or [NGINX](https://nginx.org).
### 6. Stopping the Containers
If you ever want to stop the containers, you can do so with the following command:

SSL Issues: It is important to note that most browsers will automatically block unsigned certificates, and the tool might fail to load with the message that the website might be down or have moved to a new location. If this happens to you after going through the rest of the instructions, you can bypass this warning by opening the specified url in a new tab, granting the browser permission to access the webpage, and then going back to where the UDOIT tool has been integrated and refreshing the page.
docker-compose -f docker-compose.nginx.yml down

> If you are running UDOIT in Docker, you will need do this each time you start the docker container.

## Installing Composer Dependencies
UDOIT uses Composer to install PHP dependencies. If you are using Docker, it will already be installed inside the PHP container. To install the required PHP dependencies, enter the PHP container with:

docker exec -it udoit_php_1 /bin/bash
## Manual Installation
If you prefer not to use Docker, the process is more complicated:

Then, install the dependencies:
### 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.

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

If you're not using Docker, follow the upstream documentation on [Composer Installation](https://getcomposer.org/download/) to install `composer.phar` into the project root, then run the following:
### 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 wish to use `APP_ENV=dev` below.
> Remove the `--no-dev` flag if you set `APP_ENV=dev` in your `.env.local` file.
## .ENV Setup
UDOIT uses a `.env` file for storing configuration. Local configuration such as database information and URLs should be stored in a `.env.local` file that is NOT tracked in Git.

> These changes should be made outside any of the Docker containers.
1. Copy the file `.env.local.example` to `.env.local`.
```
cp .env.local.example .env.local
```
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 this `DATABASE_URL` variable.
4. Add the `BASE_URL`, which is the full URL to reach the `public` folder of UDOIT. (i.e. https://udoit3.ciditools.com) WITHOUT the trailing slash.
5. 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.
6. (Optional) You can change the default language for your entire UDOIT instance by overriding the `DEFAULT_LANG` variable. Currently supported languages are English (`en`) and Spanish (`es`).

## Database Setup
### 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.

> If you are running UDOIT in Docker, you don't need to install PHP on your system. You can run
>
> docker exec -it udoit_php_1 /bin/bash
>
> and then run the commands below inside the Docker container.
You can create your database manually, or use `Symfony` to create the database with this command:
Use Symfony to create the database with this command:

php bin/console doctrine:database:create

Expand All @@ -108,16 +109,8 @@ If you are operating in a production environment you will need to generate the d

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

## JavaScript
UDOIT uses [node](https://nodejs.org) and [yarn](https://yarnpkg.com/) to compile the JavaScript. Instructions for installing Node and Yarn are out of the scope of this README.

> If you are running UDOIT in Docker, you don't need to install Node or Yarn on your system. Run
>
> docker exec -it udoit_php_1 /bin/bash
>
> and then run the following commands inside the Docker container.
To install the JavaScript dependencies run the command:
### 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 @@ -126,15 +119,15 @@ 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 or INSTALL_D2L.md to test UDOIT fully.
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:

<BASE_URL>/lti/config

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

https://localhost:8000/lti/config
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.
Loading

0 comments on commit aa412c0

Please sign in to comment.