Skip to content
energyyear edited this page Aug 26, 2020 · 12 revisions

Getting Started

These instructions will help setup the development environment using docker. It is also possible to run without docker, however no instructions are provided for that.

Required

The following items are required when using these instructions.

  • Docker
    • You can download Docker Desktop for Windows here.
    • Please note that this application does not support Windows 10 Home. Alternatively, you can use virtualization software like VirtualBox to run Docker inside a virtual machine.

Recommended

It is recommended, but not neccessary, to install the following tools on your development environment. This makes your life easier.

Installing

For convenience sake the PHP container is able to run composer and yarn commands. However, it is often easier to run them outside of Docker.

First clone the repository (or use the HTTPS clone version)

git clone git@github.com:HuInstituteForICT/workplacelearning.git

Enter the project folder

cd workplacelearning

Make a copy of the .env.example file, and name it .env. If you want to use the development version of workplacelearning it is not necessary to configure the values inside.

Now start the other containers with the following command below. Please note that running the application for the first time can take up to 30 minutes. This time could be better, or worse, dependent of your internet connection, processor, hard disk, etc.

docker-compose up -d

After the Docker environment is up and running, you need to install the PHP dependencies. This can be done through the PHP Docker container, or if you have Composer installed in your local development environment, you can use that.

docker-compose exec php composer install

or

composer install

When the PHP dependencies are installed, you need to create the database schema. This is done by running the migrations with the following command.

# Yes, double php. First denotes container, second calls PHP executable
docker-compose exec php php artisan migrate:refresh --seed

The installation is almost finished. Run the following command to generate an encryption key.

docker-compose exec php php artisan key:generate

We're done.

You can now reach the following services:

Service Location
Webserver localhost (HTTPS)
Database localhost:3306
PhpMyAdmin localhost:8080
Mailcatcher localhost:1080

The application itself enforces HTTPS (Secure HTTP). Please note that this is not the case for phpMyAdmin and Mailcatcher. If you need to reach these services, please make sure you are reaching those services by using HTTP (the insecure variant).

When registering a new account is might be necessary to increase the accounts rights to teacher or admin. This should be done through the PhpMyAdmin service. The login details of the database are found in the .env file (DB_USERNAME and DB_PASSWORD).

Compiling assets

At this moment, Javascript and CSS assets have compiled versions in the repository. This might change in the future. Javascript and CSS should be compiled after every asset update. Asset compilation can be done using Laravel Mix. Please notice that these commands should only be run if these assets are changed.

This requires that the dependencies are installed, install them with:

docker-compose exec php yarn

Or if yarn is available on host machine use yarn

Now you can compile assets with

docker-compose exec php yarn dev

To keep compiling on changes

docker-compose exec php yarn watch

Running the tests

Tests can be ran in the IDE by configuring PHPUnit in it.
Alternatively you can execute it in the PHP container by running:

docker-compose exec php ./vendor/bin/phpunit

Please note:_ Unit tests are currently untested and/or broken due to software upgrades._

Clone this wiki locally