Skip to content
This repository has been archived by the owner on Oct 5, 2022. It is now read-only.

Generate a Laravel project

Bassin Laurent edited this page Jun 3, 2018 · 9 revisions

Table of content


Using an existing project

Step 1 : Go to Okty.io

In order to generate your docker-compose you need to open your favority internet browser, go to https://okty.io/ and press "Start" !

Okty home page

Step 2 : What do you need ?

A laravel application is a typical php application and need 4 containers to work :

  • Nginx : Handle HTTP requests
  • PHP : Generate your website content and execute all the magic things
  • MySQL : Store your data
  • Adminer : Manage your database (Optional)

We'll start with Mysql and Adminer !
Select Mysql in the list

Step 3 : MySQL

You may leave the first group with default values
In the second configuration group "Connection" you have to specify your authentication data Once all the fields are filled, save your container

Mysql configuration

Step 4 : Adminer

In the list, select adminer.
Adminer is simple and small container that doesn't require much configuration
That's why we'll leave all the configuration as is it and save the container

Adminer configuration

Step 5 : PHP

PHP is generally the most complicated container to configure because of all the extensions available and required depending of the project you're working on.
Don't worry ! Okty is here to help you

The first step is to go search on the laravel documentation and check what are the prerequisites

Laravel prerequisites

Luckily, most of the prerequisites are already satisfied by default ! The only php extension we have to add is PDO_Mysql.
You may find information about php extensions and which one is installed on a empty container on this wiki page

Knowing this, we'll select in the php extensions list "PDO Mysql" and add it.

The second step is to tell Okty where your code will be.
We recommend to add the docker-compose at the root of your project, default value is just right.

PHP Configuration

That's all for this container ! Let's save and go on with nginx.

Step 6 : Nginx

Finally, the last container to configure before being able to run your project.
Select nginx in the list.

Local path should be the same as specified to php in the previous step.
We recommend to leave it by default at the root of the project

Regarding the web port used on the host machine, 8080 works perfectly but feel free to used whatever value you want that is not already in use by another application.

The max upload size depends of your needs, 2Mo is a default value, feel free to change it.

Nginx needs to know which container will handle PHP, select the id of the php container
(leave empty if you don't need php)

The last field allows us the use modern frameworks which has a dedicated public folder which contains the index.php
In the case of a Laravel application, this folder is named "public"

Nginx configuration

Step 7 : Export

The hardest part is over now ! Just click the export button, download the zip file and unzip your docker-compose. Once you have this precious file, open your project folder and copy/paste the docker-compose at the root of your project.

Laraval folder

Step 8 : Free the power of docker !

Open a terminal and navigate to your project folder. Run : docker-compose up -d

Docker compose up

Step 8 : Is it really working ?!

Of course it is ! Open your favorite web browser and go to http://127.0.0.1:8080/

Laravel web view

There is a last step before being able to use all the power provided by laravel, editing the .env file.

env configuration
WARNING : Database host isn't 127.0.0.1, it's the id of the mysql container. In this example : mysql

Note : You may manage your database through adminer using http://127.0.0.1:8081

Step 9 : How should I shutdown my project ?

If you want to stop you database, all you have to do is run one command
docker-compose stop

That's all ! Thanks to Okty, you may start changing the world through your future application !

Create a new project