Git Product home page Git Product logo

multi-site-docker's Introduction

Multi-site docker

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

Getting started

Checkout this repository

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

Up and running

docker-compose up -d engage

And stop it

docker-compose down

Features

  • Nginx
  • PHP (FPM)
  • MySQL

Designed for multi-site development.

How to's

Change location of your projects

Change path to your projects in docker-compose.yml on line 40. Replace - ./sites:/var/www with -../your-path:/var/www

Change PHP-Version

Go to docker-compose.yml and change image with your desired php-image. We prefer php fpm xdebug images provided by prooph for development.

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. Keep your host file in mind. 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.

Add an additional nginx conf

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

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=agantty_app;charset=UTF8;',
    'root',
    'dev', 
    [
        PDO::ATTR_PERSISTENT=>true
    ]
);
var_dump($db->query('SHOW TABLES')->fetchAll());

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.

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.

multi-site-docker's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.