diff --git a/.env b/.env.example similarity index 97% rename from .env rename to .env.example index 4b618509..e6902671 100644 --- a/.env +++ b/.env.example @@ -29,7 +29,7 @@ APP_SECRET=eb2f09f8a21b0b7c57b9fc36eee250eb # For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db" # For a PostgreSQL database, use: "postgresql://db_user:db_password@127.0.0.1:5432/db_name?serverVersion=11&charset=utf8" # IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml -#DATABASE_URL=mysql://root:root@127.0.0.1:3306/udoit3 +DATABASE_URL=mysql://root:root@db:3306/udoit3 ###< doctrine/doctrine-bundle ### ### PRIVATE KEY PASSWORD: UDOIT3.0 ### @@ -152,9 +152,9 @@ DATE_FORMAT="Y-m-d" ###> base url ### # Base URL for client callbacks -BASE_URL="" +BASE_URL="http://127.0.0.1:8000/udoit3" # Webpack public path -WEBPACK_PUBLIC_PATH="/build" +WEBPACK_PUBLIC_PATH="/udoit3/build" ###> base url ### ###> user name storage ### diff --git a/.env.local.example b/.env.local.example deleted file mode 100644 index 8f560497..00000000 --- a/.env.local.example +++ /dev/null @@ -1,14 +0,0 @@ -###> symfony/framework-bundle ### -APP_ENV=prod - -###> doctrine/doctrine-bundle ### -DATABASE_URL=mysql://root:root@db:3306/udoit3 - -###> base url ### -# Base URL for client callbacks -BASE_URL="http://127.0.0.1:8000/udoit3" -# Webpack public path -WEBPACK_PUBLIC_PATH="/udoit3/build" -###> base url ### - -APP_LMS=canvas \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 368a77be..a0bf3fd7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,13 +45,11 @@ jobs: - 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' + cp .env.example .env + 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 }} - - diff --git a/.github/workflows/udoit.yml b/.github/workflows/udoit.yml index 18bbc605..86540a2f 100644 --- a/.github/workflows/udoit.yml +++ b/.github/workflows/udoit.yml @@ -10,6 +10,7 @@ jobs: matrix: operating-system: [ubuntu-latest] php-versions: ['8.1'] + node-version: [16.19.0] steps: - name: Checkout uses: actions/checkout@v2 @@ -17,6 +18,11 @@ jobs: - name: Check PHP syntax errors uses: overtrue/phplint@3.0.3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + - name: Setup PHP, with composer and extensions uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php with: @@ -35,6 +41,9 @@ jobs: key: php-${{ matrix.php-versions }}-composer-${{ hashFiles('**/composer.lock') }} restore-keys: php-${{ matrix.php-versions }}-composer- + - name: Create .env file + run: cp .env.example .env + - name: Install Composer dependencies run: composer install --no-progress --prefer-dist --optimize-autoloader diff --git a/.gitignore b/.gitignore index 07df3607..9a538716 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,5 @@ yarn-error.log /phpunit.xml .phpunit.result.cache ###< phpunit/phpunit ### + +.env diff --git a/HEROKU.md b/HEROKU.md index b3486bb9..64483ccb 100644 --- a/HEROKU.md +++ b/HEROKU.md @@ -20,6 +20,8 @@ Click the Heroku button and follow the instructions below: 6. Fill out the `JWK_BASE_URL` field with the URL to your LMS. The default value works for instructure hosted instances of Canvas, but will need to be modified if your JWK configuration is hosted at a different domain than `iss`. 7. Click the Deploy button and wait for the process to complete. +The above deploy uses the Heroku Postgres Mini plan by default. Please check `https://elements.heroku.com/addons/heroku-postgresql` for Heroku Postgresql plan details. You can upgrade Postgresql plan inside Heroku UI later. + ### Step 2: Database Migration and Setup Next we need to set up the database and insert our institution in to the appropriate table. 1. Click "Manage App" or go to `https://dashboard.heroku.com/apps/yourapp`. (Replace 'yourapp' with the name you gave in Step 1.2.) diff --git a/INSTALL.md b/INSTALL.md index 6c554915..4d3032bd 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -28,22 +28,22 @@ We strongly recommend managing the source code through Git. The benefit of this 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. ## .ENV Setup -UDOIT uses a `.env.local` file for storing configuration variables. To create it: +UDOIT uses a `.env` file for storing configuration variables. To create it: -1. Copy the file `.env.local.example` to `.env.local` by running +1. Copy the file `.env.example` to `.env` by running ``` -cp .env.local.example .env.local +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 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.) +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. (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`). -8. (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"`) +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. @@ -54,7 +54,7 @@ To set up the docker containers, you must first install [Docker](https://docs.do ### 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: - docker-compose -f docker-compose.nginx.yml up + 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. @@ -62,7 +62,7 @@ Wait for all of the containers to finish initializing. This can take over 15 mi ### 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: - docker-compose -f docker-compose.nginx.yml run php php bin/console doctrine:migrations:migrate + docker compose -f docker-compose.nginx.yml run php php bin/console doctrine:migrations:migrate > You will also need to run that command whenever you update to a new version of UDOIT. @@ -72,7 +72,7 @@ Skip to [Testing your Setup](#testing-your-setup) to continue. ### 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 + docker compose -f docker-compose.nginx.yml down diff --git a/INSTALL_CANVAS.md b/INSTALL_CANVAS.md index 60cbadd9..a373539e 100644 --- a/INSTALL_CANVAS.md +++ b/INSTALL_CANVAS.md @@ -126,8 +126,8 @@ lms_api_domain=$Canvas.api.domain * Click `ON` to enable the newly created key --- -## Docker-Compose Base URL -If you are setting up UDOIT for local development through docker-compose, in both the API developer key and the LTI developer key above should be set to `http://127.0.0.1:8000/udoit3`. +## Docker Compose Base URL +If you are setting up UDOIT for local development through `docker compose`, in both the API developer key and the LTI developer key above should be set to `http://127.0.0.1:8000/udoit3`. --- ## Update the Institutions Table @@ -187,4 +187,4 @@ UDOIT now needs to be added to an account in Canvas. Follow these steps to add t 8. Paste the `Client ID` from the developer LTI Key you created earlier. 9. Click Submit. -You're done! "UDOIT" should now appear in the navigation menu of the course (or every course in the account) in which you installed it. If you installed it to an account, "UDOIT Admin" will also appear in the account navigation menu. \ No newline at end of file +You're done! "UDOIT" should now appear in the navigation menu of the course (or every course in the account) in which you installed it. If you installed it to an account, "UDOIT Admin" will also appear in the account navigation menu. diff --git a/app.json b/app.json index f666ba61..7004b63c 100644 --- a/app.json +++ b/app.json @@ -36,7 +36,7 @@ } }, "addons": [ - "heroku-postgresql:hobby-basic" + "heroku-postgresql:mini" ], "buildpacks": [ { diff --git a/build/nginx/php-custom.ini b/build/nginx/php-custom.ini index 9e185ace..e3cfe128 100644 --- a/build/nginx/php-custom.ini +++ b/build/nginx/php-custom.ini @@ -1 +1,2 @@ max_execution_time = 180 +memory_limit = 500M diff --git a/composer.lock b/composer.lock index 24d58283..e622f6a1 100644 --- a/composer.lock +++ b/composer.lock @@ -2144,16 +2144,16 @@ }, { "name": "knplabs/knp-snappy", - "version": "v1.4.1", + "version": "v1.4.2", "source": { "type": "git", "url": "https://github.com/KnpLabs/snappy.git", - "reference": "5126fb5b335ec929a226314d40cd8dad497c3d67" + "reference": "b66f79334421c26d9c244427963fa2d92980b5d3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/KnpLabs/snappy/zipball/5126fb5b335ec929a226314d40cd8dad497c3d67", - "reference": "5126fb5b335ec929a226314d40cd8dad497c3d67", + "url": "https://api.github.com/repos/KnpLabs/snappy/zipball/b66f79334421c26d9c244427963fa2d92980b5d3", + "reference": "b66f79334421c26d9c244427963fa2d92980b5d3", "shasum": "" }, "require": { @@ -2212,9 +2212,9 @@ ], "support": { "issues": "https://github.com/KnpLabs/snappy/issues", - "source": "https://github.com/KnpLabs/snappy/tree/v1.4.1" + "source": "https://github.com/KnpLabs/snappy/tree/v1.4.2" }, - "time": "2022-01-07T13:03:38+00:00" + "time": "2023-03-17T14:47:54+00:00" }, { "name": "knplabs/knp-snappy-bundle", @@ -6913,16 +6913,16 @@ }, { "name": "symfony/process", - "version": "v6.0.11", + "version": "v6.0.19", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "44270a08ccb664143dede554ff1c00aaa2247a43" + "reference": "2114fd60f26a296cc403a7939ab91478475a33d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/44270a08ccb664143dede554ff1c00aaa2247a43", - "reference": "44270a08ccb664143dede554ff1c00aaa2247a43", + "url": "https://api.github.com/repos/symfony/process/zipball/2114fd60f26a296cc403a7939ab91478475a33d4", + "reference": "2114fd60f26a296cc403a7939ab91478475a33d4", "shasum": "" }, "require": { @@ -6954,7 +6954,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v6.0.11" + "source": "https://github.com/symfony/process/tree/v6.0.19" }, "funding": [ { @@ -6970,7 +6970,7 @@ "type": "tidelift" } ], - "time": "2022-06-27T17:10:44+00:00" + "time": "2023-01-01T08:36:10+00:00" }, { "name": "symfony/property-access", diff --git a/docker-compose.nginx.yml b/docker-compose.nginx.yml index 7bf9ea1d..1a00f70f 100644 --- a/docker-compose.nginx.yml +++ b/docker-compose.nginx.yml @@ -26,45 +26,40 @@ services: web: image: nginx:latest ports: - - "8000:80" + - "8000:80" volumes: - - .:/var/www/html - - ./build/nginx/local.conf:/etc/nginx/conf.d/default.conf - + - .:/var/www/html + - ./build/nginx/local.conf:/etc/nginx/conf.d/default.conf links: - php env_file: - .env - - .env.local php: build: context: ./build/nginx dockerfile: Dockerfile.php.pdo.mysql volumes: - - ./:/var/www/html - - type: bind - source: ./build/nginx/php-custom.ini - target: /usr/local/etc/php/conf.d/php-custom.ini + - ./:/var/www/html + - type: bind + source: ./build/nginx/php-custom.ini + target: /usr/local/etc/php/conf.d/php-custom.ini env_file: - .env - - .env.local composer: build: context: ./build/nginx dockerfile: Dockerfile.composer command: "composer install --no-dev --no-interaction --no-progress --optimize-autoloader" volumes: - - ./:/app + - ./:/app env_file: - .env - - .env.local yarn: image: node:16 volumes: - - ./:/app + - ./:/app env_file: - .env - - .env.local command: > bash -c ' cd /app && @@ -74,4 +69,3 @@ services: volumes: web: dbdata: - diff --git a/yarn.lock b/yarn.lock index ddfb1519..88348c8b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7755,9 +7755,9 @@ json3@^3.3.3: integrity sha512-c7/8mbUsKigAbLkD5B010BK4D9LZm7A1pNItkEwiUZRpIN66exu/e7YQWysGun+TRKaJp8MhemM+VkfWv42aCA== json5@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.1.tgz#779fb0018604fa854eacbf6252180d83543e3dbe" - integrity sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow== + version "1.0.2" + resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.2.tgz#63d98d60f21b313b77c4d6da18bfa69d80e1d593" + integrity sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA== dependencies: minimist "^1.2.0" @@ -8181,9 +8181,9 @@ minimatch@^3.0.4: brace-expansion "^1.1.7" minimist@^1.1.1, minimist@^1.2.0, minimist@^1.2.5: - version "1.2.6" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44" - integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q== + version "1.2.7" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.7.tgz#daa1c4d91f507390437c6a8bc01078e7000c4d18" + integrity sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g== minipass-collect@^1.0.2: version "1.0.2" @@ -11048,9 +11048,9 @@ typedarray@^0.0.6: integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= ua-parser-js@^0.7.18: - version "0.7.28" - resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.28.tgz#8ba04e653f35ce210239c64661685bf9121dec31" - integrity sha512-6Gurc1n//gjp9eQNXjD9O3M/sMwVtN5S8Lv9bvOYBfKfDNiIIhqiyi01vMBO45u4zkDE420w/e0se7Vs+sIg+g== + version "0.7.33" + resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.33.tgz#1d04acb4ccef9293df6f70f2c3d22f3030d8b532" + integrity sha512-s8ax/CeZdK9R/56Sui0WM6y9OFREJarMRHqLB2EwkovemBxNQ+Bqu8GAsUnVcXKgphb++ghr/B2BZx4mahujPw== unbox-primitive@^1.0.1: version "1.0.1"