Coder Social home page Coder Social logo

multibasebox's Introduction

multibasebox

Serve multiple docker container with the help of haproxy. Requires a running docker-environment

How it works

Multibasebox consists of a simple shell script setting up name resolution and a haproxy container on your local environment.

For serving the different containers a separate docker-container named haproxy-config will be pulled and started.

haproxy is listening on port 80 ond 443 and will forward all requests to a specific docker-image running inside the vm. It uses the hostname to distinguish the containers.

Installation

  1. Clone this repository,
  2. Run bash ./setup-docker.sh
  3. Visit http://multibasebox.test:1936 This will show you the haproxy status page.

(Ph|F)abalicious setup

Most likely you'll need a specialized fabfile.local.yaml if you are using fabalicious. Here's a short example, adpat it to your setup and it should work:

dockerHosts:
  mbb:
    runLocally: true
    rootFolder: <absolute-path-to-projects-folder>


hosts:
  mbb:
    xdebug:
      remote_host: docker.for.mac.localhost
    blueprint:
      xdebug:
        remote_host: docker.for.mac.localhost

Linux-specific remarks

The script won't run the dnsmasq-container for linux, but there are some workarounds:

Fedora

  1. Create /etc/NetworkManager/conf.d/00-use-dnsmaq.conf with the following content

    dns=dnsmasq
    
  2. Create /etc/NetworkManager/dnsmasq.d/test.conf with

    local=/test/
    address=/.test/127.0.0.1
    addn-hosts=/etc/hosts
    
  3. Restart the NetworkManager with sudo systemctl restart NetworkManager

Other distributions

Add your hosts to /etc/hosts similar to

127.0.0.1 multibasebox.test <your-other-hosts.test>

Setup a new project

Move your project-folder into projects or clone a repository into that folder.

Your docker-container should use the environment-variables VHOST and VPORT (defaults to 80) to signalize haproxy which hostname should be used and on which port the http-service is listening inside the container. There's no need to expose the ports to the host. See the documentation of haproxy-config

Fabalicious may help you to administrate your project and docker-setup. For more info visit fabalicious

For scaffolding new projects have a look at our generator jaMann

Usage

The containers are setup to restart automatically. If you encounter problems just run bash setup-docker.sh

Status

You can see the status of haproxy at http://multibasebox.test:1936/

Troubleshooting (Mac)

container are not reachable, Host is down messages

Test if name resolution is working: dscacheutil -q host -a name multibasebox.test If you get an error message, try restarting mDNSResponder with sudo killall mDNSResponder, or reboot the machine.

Still not working? Then try the /etc/hosts-route.

multibasebox's People

Contributors

stmh avatar muschpusch 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.