CLI application to helps the use of multiple projects on Laradock.
- Python >= 3.0
- PyYAML
Clone the project inside laradock project folder and access the cloned folder:
git clone https://github.com/sfelix-martins/laradock-multiple-project.git multiple-project
cd multiple-projectInstall the project dependencies from requirements.txt:
python -m pip install --upgrade pip
pip install -r requirements.txtCopy the file Projects.yml.example to Projects.yml:
cp Projects.yml.example Projects.ymlSet your projects configs on Projects.yml file.
# Project name
laravel_project:
# The containers that will be executed
services:
- nginx
- mysql
- mailhog
# Environment vars that will override the `.env` vars from laradock
env:
- PHP_VERSION: 7.3
# The server definitions to point domain to folder
server:
name: laravelproject.test
root: Projects/laravel/laravelproject.test/public
template: laravel
laravel_api:
# The containers that will be executed
services:
- apache2
- postgres
- maildev
- redis
# Environment vars that will override the `.env` vars from laradock
env:
- PHP_VERSION: 7.3
# The server definitions to point domain to folder
server:
name: laravel_api.test
root: Projects/laravel/laravel_api.test/publicThe containers that will be executed. You must defined at least one service
Define the environment variables to each specific project.
If no one variable was defined the default .env file from laradock will be
used to up environment.
On server config section you must define the server name, root and template (Optional).
The name are the site domain.
The root are the folder that contains your site code.
The template are the example .conf.example file that will be used to create the server configs.
For the nginx services you can choose between laravel, symfony and default.
The default template is laravel.
For apache2 and caddy exists just one template.
E.g.: If your folder structure look like this:
+ laradock
+ Projects
+ site-1
+ laravel-api # This folder contains a laravel API, for example
Your server definitions section for your project in Projects.yml file should look like:
server:
name: laravelapi.test
root: Projects/site-1/laravel-api/publicThe caddy web server accepts too the https param. By the default the https value is False:
server:
name: laravelapi.test
root: Projects/site-1/laravel-api/public
https: TrueDon't forget put the domain in your hosts file:
127.0.0.1 laravelapi.test
IMPORTANT: To the server definitions works correctly, you must assert that:
- Exists only one web server container in your
servicessection. You must choosenginx,apache2orcaddy. - If your
servicessection has no one web server container nothing will happens.
After configure your projects on Projects.yml file you can execute the script
laradock passing the project name on first param:
./laradock up laravel_projectWait the process finish and your laradock should be started with your chosen project definitions.
Call the exec command to access the workspace container:
./laradock exec laravel_project