Skip to content
This repository was archived by the owner on Jul 5, 2020. It is now read-only.

ProfessorFrancken/Docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Francken Docker Environment

This repository can be used to setup a development environment that runs on Docker.

A shell script init.sh is included which, once you execute it, will setup our environment for you which includes setting an .env file, installing dependencies (both composer and npm), generating css, setting an encryption key and finally starting a nginx server so you can start working on the website and see it on localhost.

Once everything is working you should check the documentation on the main repository to find some tips on how to work with our application.

Requirements

There are 4 requirements that you will need to setup yourself before you can start using our shell script to setup your docker environment.

Gotchas

Once you’ve installed Docker be sure to add your user to the Docker group and logout and login again, otherwise you will get permission errors.

Manual instructions

The following are instructions on how to setup our environment without using the init.sh file, which might be useful if you want to know more about each step in the init.sh file, or if you’re on Windows.

First clone this repo to some folder where you’d like to work, i.e.,

cd Projects
git clone [email protected]:ProfessorFrancken/Docker.git

Next clone the ProfessorFrancken/ProfessorFrancken repo inside the folder that’s been cloned and name it Francken (this is because our docker-compose.yml file assumes the folder’s name is “Francken”),

cd docker
git clone [email protected]:ProfessorFrancken/ProfessorFrancken.git Francken

Next go to the francken directory and copy and rename the .env.example file,

cd Francken
cp .env.example .env

Install npm dependencies

We’re using Laravel Mix to compile scss files to css for this we will have to install some npm dependencies,

# Install dependencies
docker-compose run npm npm install

# Compile our css files
docker-compose run npm npm run dev

Install php dependencies

Next our application’s php dependencies need to be installed, run

docker-compose run composer install

Next generate a private key that is used for encryption,

docker-compose run php php artisan key:generate

Start the server

Once the composer dependencies have been installed (this might take a while depending on your internet speed) you can start the server by running,

docker-compose up -d nginx

Next run docker-compose run php php artisan migrate --seed to migrate the database. You should now be able to access the server at localhost.

You might get the following error when executing docker-compose run php php artisan migrate --seed,

[Illuminate\Database\QueryException]
SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = francken and table_name = migrations)



[PDOException]
SQLSTATE[HY000] [2002] Connection refused

This means that the mysql server hasn’t finished initializing yet, wait a while (≈ 1 minute) and try again.

Stopping the server

To stop the server run docker-compose down.

Testing

The unit and integration tests can be run using,

docker-compose run php vendor/bin/phpunit

Testing with coverage

Use the test_coverage container which includes xdebug to add collect coverage information.

docker-compose run test_coverage vendor/bin/phpunit

# Or run humbug, a mutation testing tool
docker-compose run test_coverage vendor/bin/humbug

About

Francken Docker environment

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •