wckr / wocker

Create your WordPress development environment in 3 SECONDS!
https://wocker.dev/
MIT License
480 stars 42 forks source link

Multiple Containers / VM Hostnames #44

Closed emaildano closed 7 years ago

emaildano commented 8 years ago

This may not be the intended purpose of Wocker but I wanted to clarify before going ahead.

Why does Wocker not support multiple hostnames?

It supports multiple containers but they all carry the same URL, wocker.dev, unless you edit that on each vagrant up or vagrant reload.

For me, ideally config.vm.define "wocker" doesnt change but it doesn support multiple config.vm.hostnames.

For my personal use I will be writing a sites.yml file where I can add each of my locally hosted sites. On vagrant up it will iterate over each one creating the hostnames and containers.

Should config.vm.hostname = "wocker.dev" be a variable during for vagrant up?

What I'm proposing here is to support passing custom variables such as vagrant --hostname=test up

The fallback of course could be wocker.dev but gives the user a quick way to edit the hostname without editing the files.

Again, if this is not intended purpose of Wocker I will make these edits just for my personal use but if any of this could be helpful to the project I'd be happy to submit a pull request!

:) Thanks!

ixkaito commented 8 years ago

Hi @emaildano , thanks for your issue.

First, for a fast start-up, the default Docker image of Wocker skips the step of WordPress installation and contains "wocker.dev" as the site address, so if you change the config.vm.hostname, you won't be able to use the default image unless you replace "wocker.dev" in the database.

FYI, Wocker has a image (wocker/wordpress) without WordPress installed. You will need a WordPress installation step when you run a container from it, and it will use the current domain as the site address. If you change the config.vm.hostname, I recommend you to use this image. You can use it like this:

$ wocker run --name test wocker/wordpress

This will automatically pull the image from Docker Hub for the first time.

Second, I know what you intended to do; however, changing config.vm.hostname or make it variable may not solve the problem because you have to reload or re-provision the VM. The purpose of Wocker is creating new WordPress development environments in seconds. Usually, we don't reload or re-provision the VM.

This may help you. https://github.com/ailispaw/wocker/tree/wocker-multi

This fork allows you to run multiple containers at the same time. It use each container name as a subdomain of "wocker.dev". The first container URL will be "wocker.wocker.dev". If you run a container named "test", it will be "test.wocker.dev". However, wocker-multi seems not to be available on Windows.

Hope this answer helps you. If you have any other ideas, please let me know :)