Skip to content

Instantly share code, notes, and snippets.

@ailispaw
Last active February 10, 2017 04:55
Show Gist options
  • Save ailispaw/979e715018f510477e24081c61631871 to your computer and use it in GitHub Desktop.
Save ailispaw/979e715018f510477e24081c61631871 to your computer and use it in GitHub Desktop.
Build WordPress on Barge by Docker-Compose with Veertu and Vagrant

Build WordPress on Barge by Docker-Compose with Veertu and Vagrant

Requirements to run

Vagrant up

$ git clone https://gist.github.com/979e715018f510477e24081c61631871.git wp-barge-veertu
$ cd wp-barge-veertu/
$ vagrant up --provider veertu

Docker Compose Up

$ export DOCKER_HOST=tcp://localhost:2375
$ unset DOCKER_CERT_PATH
$ unset DOCKER_TLS_VERIFY
$ docker-compose up -d

Open WordPress Site

$ vagrant ssh -c "ifconfig eth0 | awk '/inet addr/{print substr(\$2,6)}'" -- -T
192.168.64.3
$ open http://192.168.64.3:8000

Known issues

  • It may take a few minutes for a site to be ready at the first time.
  • When I put config.vm.network :forwarded_port, guest: 8000, host: 8000 to port forward it, the Veertu VM makes Mac OSX slow with CPU overload until I kill the Veertu VM.
version: '2'
services:
db:
image: mysql:5.7
volumes:
- "./.data/db:/var/lib/mysql"
environment:
MYSQL_ROOT_PASSWORD: wordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
wordpress:
depends_on:
- db
image: wordpress:latest
volumes:
- "./.data/wp:/var/www/html"
links:
- db
ports:
- "8000:80"
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_PASSWORD: wordpress
# A dummy plugin for Barge to set hostname and network correctly at the very first `vagrant up`
module VagrantPlugins
module GuestLinux
class Plugin < Vagrant.plugin("2")
guest_capability("linux", "change_host_name") { Cap::ChangeHostName }
guest_capability("linux", "configure_networks") { Cap::ConfigureNetworks }
end
end
end
PWD=Dir.pwd
Vagrant.configure(2) do |config|
config.vm.define "barge-veertu"
config.vm.box = "ailispaw/barge"
config.vm.box_version = ">= 2.2.1"
config.vm.provider :virtualbox do |vb, override|
override.vm.network :private_network, ip: "192.168.33.10"
end
config.vm.synced_folder ".", "/vagrant", type: "nfs",
mount_options: ["nolock", "vers=3", "udp", "noatime", "actimeo=1"]
config.vm.provision :shell, run: "always" do |sh|
sh.inline = <<-EOT
pkg install bindfs
_UID=$(ls -ld /vagrant | awk '{print $3}')
_GID=$(ls -ld /vagrant | awk '{print $4}')
if mountpoint -q '/vagrant' && ! mountpoint -q '#{PWD}/.data/db'; then
mkdir -p '/vagrant/.data/db'
mkdir -p '#{PWD}/.data/db'
bindfs --map=${_UID}/999:@${_GID}/@999 '/vagrant/.data/db' '#{PWD}/.data/db'
fi
if mountpoint -q '/vagrant' && ! mountpoint -q '#{PWD}/.data/wp'; then
mkdir -p '/vagrant/.data/wp'
mkdir -p '#{PWD}/.data/wp'
bindfs --map=${_UID}/33:@${_GID}/@33 '/vagrant/.data/wp' '#{PWD}/.data/wp'
fi
EOT
end
end
@ailispaw
Copy link
Author

ailispaw commented Sep 2, 2016

While I SSH into the VM, CPU usage of the VM goes 100%. - Veertu - Run Windows and Linux on your Mac
https://veertu.com/forums/topic/while-i-ssh-into-the-vm-cpu-usage-of-the-vm-goes-100/

When I SSH through forwarded port like 127.0.0.1:2222, it happens.
But I SSH through the VM IP address like 192.168.64.3:22, it doesn’t.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment