All Projects → mbunge → multi-site-docker

mbunge / multi-site-docker

Licence: other
A multi-site-docker configuration featuring nginx, php and mysql

Programming Languages

javascript
184084 projects - #8 most used programming language
shell
77523 projects
Batchfile
5799 projects
PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to multi-site-docker

blimp
Web development with docker made easy
Stars: ✭ 12 (-85.88%)
Mutual labels:  development, development-environment
Ergo
The management of multiple apps running over different ports made easy
Stars: ✭ 452 (+431.76%)
Mutual labels:  development, development-environment
container
Custom containers for various usecases
Stars: ✭ 12 (-85.88%)
Mutual labels:  development, development-environment
wordless gem
The quickest CLI tool to setup a new WordPress locally. Wordless ready.
Stars: ✭ 38 (-55.29%)
Mutual labels:  development, development-environment
Docker Compose Starter
Run your development environment with a simple command using docker-compose 🚀
Stars: ✭ 159 (+87.06%)
Mutual labels:  development, development-environment
magento-ngrok
Magento 2 module for ngrok.io service support
Stars: ✭ 45 (-47.06%)
Mutual labels:  development, development-environment
Developer Roadmap Guide 2018
Stars: ✭ 344 (+304.71%)
Mutual labels:  development, development-environment
python3-docker-devenv
Docker Start Guide with Python Development Environment
Stars: ✭ 13 (-84.71%)
Mutual labels:  docker-container, development-environment
Koding
The Simplest Way to Manage Your Entire Dev Infrastructure!
Stars: ✭ 1,945 (+2188.24%)
Mutual labels:  development, development-environment
Cra Build Watch
A script for create-react-app that writes development builds to the disk
Stars: ✭ 110 (+29.41%)
Mutual labels:  development, development-environment
Takeoff
A rapid development environment using docker for convenience.
Stars: ✭ 271 (+218.82%)
Mutual labels:  development, development-environment
cqfd
cqfd helps running commands inside the Docker container configured for your project, keeping the user and working directory the same inside the container
Stars: ✭ 48 (-43.53%)
Mutual labels:  docker-container, development-environment
Pric
Simple zero-config tool to create Private Certificate Authority & issue locally-trusted development server certificates with any domain names you'd like. SSL certificates for development purposes.
Stars: ✭ 87 (+2.35%)
Mutual labels:  development, development-environment
Docker-Stack
This repo contains a simple Docker setup with minimal configuration and only few files you can drop into many PHP-based projects.
Stars: ✭ 31 (-63.53%)
Mutual labels:  development, development-environment
wp-cli-dev
🛠 WP-CLI development environment that allows for easy development across all packages
Stars: ✭ 29 (-65.88%)
Mutual labels:  development, development-environment
knime-docker
KNIME Analytics Platform & SDK with Docker Container in X11 desktop
Stars: ✭ 19 (-77.65%)
Mutual labels:  docker-container
graphsense-dashboard
A web dashboard for interactive cryptocurrency analysis.
Stars: ✭ 84 (-1.18%)
Mutual labels:  docker-container
dockermutillidae
Docker container for OWASP Mutillidae II Web Pen-Test Practice Application
Stars: ✭ 64 (-24.71%)
Mutual labels:  docker-container
scan-cli-plugin
Docker Scan is a Command Line Interface to run vulnerability detection on your Dockerfiles and Docker images
Stars: ✭ 135 (+58.82%)
Mutual labels:  docker-container
jpath.ru
Для разработчиков и опытных пользователей Joomla! CMS
Stars: ✭ 15 (-82.35%)
Mutual labels:  development

Engage - Multi-site docker

In some cases you or your team don't want to use many docker containers while development.

Getting started

Checkout this repository:

$ git clone https://github.com/mbunge/multi-site-docker.git

Copy .env.example and and name it .env file in the same directory as docker-compose.yml:

$ cp .env.example .env

Test config before start:

$ docker-compose config

Create and start all containers:

$ docker-compose up -d engage

Stop it:

$ docker-compose stop

Start it:

$ docker-compose start

Stop and remove it:

$ docker-compose down

Convinient Helpers

Instead of commands above you could also user command helpers for docker-compose.

Prepared for MacOS, Linux and Windows

Just call docker-composer with

$ ./bin/engage <command>

Following commands aliasing

start

start containers and execute

$ docker-compose up -d engage

stop

stop containers and execute

$ docker-compose down

restart

Calls stop and start

resume

resume containers and execute

$ docker-compose start

destroy

remove all containers and execute on Linux / Mac OS

$ docker rmi -f $(docker images -q)

On Windows

$ FOR /F "usebackq tokens=*" %%a IN (`docker images -q`) DO echo %%a

reload

reload containers and executes

$ docker-compose restart

suspend

suspend containers and executes

$ docker-compose stop

Composer

Connect to php container

$ docker-compose exec php bash

and select your project

$ cd /var/www/my/project

and run any composer command

$ composer install

Features

  • Nginx
  • PHP (FPM) 5.6, 7.0, 7.1
  • MySQL 5.5, 5.6, 5.7, 8.0
  • Memcached
  • Redis

Designed for multi-site development.

Project data

Change location of your projects

Change SITES_FOLDER to your projects in .env.

Example

SITES_FOLDER=../

Add a new site

Go to sites/ and add a new folder mkdir -P sites/my-awesome-project/public. public/ is the place for your index.php and all other accessible files. The sites folder my-awesome-project is mapped to domain. You need to add my-awesome-project to your hosts and your project will be available via http://my-awesome-project.

PHP

Change PHP version

Change PHP_VERSION in .env in to one of the following:

  • 5.6
  • 7.0
  • 7.1

For detailed information about used PHP-Images please refer to php-fpm-xdebug images.

Customize PHP-Version

We provide more customization feautures since version 1.0.3.

Following options are configured in a separate *.env file configured with PHP_ENV_FILE in .env

Extend php.ini

The php configuration is dynamic. Just add environment variable with prefix PHP__.

Example

Following config overwrites display_errors and date.timezone and adds xdebug settings.

PHP__display_errors=On
PHP__date.timezone=Europe/Berlin
PHP__xdebug.remote_enable = 1

Enable additional PHP modules

The PHP Extensions are load on start. Just add environment variable PHP_php5enmod with list of your extensions.

Example

Following config adds mysql and pdo_mysql which is required by wordpress, laravel and many other tools.

PHP_php5enmod=mysql pdo_mysql xdebug

MySQL

Change MySQL Version

Change MYSQL_VERSION in .env in to one of the following:

  • 5.5
  • 5.5.54
  • 5.6
  • 5.6.35
  • 5.7
  • 5.7.17 (aliases 5 and latest)
  • 8.0 (aliases 8.0.0 and 8)

Please keep in mind, changing the version could corrupt the databases or MySQL is not able to use databases.

Change additional MySQL data

You could also change defaults for your MySQL instance. Just configure MYSQL_ENV_FILE in .env and add variables prefixed with MYSQL_* like the default database MYSQL_DATABASE.

A detailed list of opetions can be found on MySQL-Docker under Environment Variables.

Extend my.cnf

You may want to modify some mysql settings. Just create a new *.cnf under machine/mysql/cnf and setup your custom settings.

nginx

Add an additional nginx conf

Go to machine/nginx/sites-enabled, copy site.conf.example and set up your custom config

How to

Connect to MySQL

From host

If you use tools like SQuirreL, DataGrip, etc. you may want to connect to from host. The host is 127.0.0.1 by default. Username, password an port are the same as configured in docker-compose.yml.

From container

Inside of your container the hostanme to MySQL is database, similar to the service name. Just execute following code and you are connected.

<?php

$db = new PDO(
    'mysql:host=database;port=3306;dbname=engage_project;charset=UTF8;',
    'root',
    'dev', 
    [
        PDO::ATTR_PERSISTENT=>true
    ]
);

var_dump($db->query('SHOW TABLES')->fetchAll());

Extend docker-compose.yml

In some cases you need to adjust default configurations, like ports or something else. Instead of change values in docker-compose.yml, add docker-compose.overwrite.yml which is overwriting values in default config.

Connect to services

Nginx

$ docker-compose exec nginx bash

PHP

$ docker-compose exec php bash

MySQL

$ docker-compose exec database bash

Data

$ docker-compose exec dataphp bash

Execute composer and other CLI tools

Composer

For composer we recomment this awesome docker container which is executing composer in your desired PHP version.

$ docker run --rm -it --volume ${PWD}:/app prooph/composer:7.0 dumpautoload

Artisan and friends

This is very easy. Execute your commands from following pattern:

$ docker-compose exec php php [param1] [param2] [paramN]

For example migrate database with artisan:

$ docker-compose exec php php my-awesome-project/artisan migrate

Change log

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Issues and more help

Use the issue tracker and we will help you!

Credits

License

The MIT License (MIT). Please see License File for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].