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..2edb4cf9 100644 --- a/.github/workflows/udoit.yml +++ b/.github/workflows/udoit.yml @@ -35,6 +35,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/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/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: -