Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Serve multiple docker container with the help of haproxy.

License

NotificationsYou must be signed in to change notification settings

factorial-io/multibasebox

Repository files navigation

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 namedhaproxy-config will be pulled and started.

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

Installation

With phabalicious

Phabalicious is nicely integrated with multibasebox and has a dedicated command to setup multibasebox since version 3.3. Run

phab workspace:create

and answer the questions. The scaffolder will create afabfile.local.yaml suited to your local setup.

That's it!

Manual setup

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

Integration with phabalicious

If you installed multibasebox with phabalicious, the following part is just for your information, as the phabalicious created this file already. Here's a short example forfabfile.local.yaml, adapt it to your setup and it should work:

dockerHosts:mbb:runLocally:truerootFolder:<absolute-path-to-projects-folder>hosts:mbb:xdebug:remote_host:docker.for.mac.localhostblueprint: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.1addn-hosts=/etc/hosts
  3. Restart the NetworkManager withsudo systemctl restart NetworkManager

Other distributions

Add your hosts to/etc/hosts similar to

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

dnsmasq is available for a lot of linux distributions and it should be easy to install. Adapt your local config to sth similar.

Setup a new project

  1. Move your project-folder intoprojects or clone a repository into that folder.
  2. Your docker-container should use the environment-variablesVHOST andVPORT (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 ofhaproxy-config

Phabalicious may help you to administrate your project and docker-setup. For more info visitfabalicious It can also new projects.

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 athttp://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.


[8]ページ先頭

©2009-2025 Movatter.jp