From 86e6f5315fea57857fe8a3ee64ff5176171a6bce Mon Sep 17 00:00:00 2001 From: Alex Hyett Date: Tue, 15 Dec 2015 22:11:01 +0000 Subject: [PATCH] Created new docker-vagrantpress A development environment for WordPress --- .gitignore | 11 +++++++++++ README.md | 21 +++++++++++++++++++++ Vagrantfile | 24 ++++++++++++++++++++++++ docker-compose.yml | 17 +++++++++++++++++ 4 files changed, 73 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 Vagrantfile create mode 100644 docker-compose.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bfc7db0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +.vagrant +.DS_Store +src/index.php +src/plugins/hello.php +src/plugins/index.php +src/plugins/akismet + +src/themes/index.php +src/themes/twentyfourteen +src/themes/twentyfifteen +src/themes/twentysixteen \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..4bc3795 --- /dev/null +++ b/README.md @@ -0,0 +1,21 @@ +# docker-vagrantpress + +This a wordpress development environment which uses Docker inside a Vagrant VM. + +I have created this mainly to see how Docker works and to try and get something faster than my current [Vagrant + Puppet setup](https://github.com/hyettdotme/vagrantpress) + +# Prerequisites ++ [Vagrant](http://www.vagrantup.com/downloads.html) ++ [Virtualbox](https://www.virtualbox.org/wiki/Downloads) ++ [Vagrant Hostsupdater](https://github.com/cogitatio/vagrant-hostsupdater) ++ [Vagrant-Docker-Compose](https://github.com/leighmcculloch/vagrant-docker-compose) + +## Getting started + +1. Clone the project. (There’s only master branch.) +2. Run `vagrant plugin install vagrant-hostsupdater` from command line +3. Run `vagrant plugin install vagrant-docker-compose` from command line +4. Run the command `vagrant up` from the directory +5. Open your browser to http://www.docker.dev and go through the WordPress installation wizard + +A src folder will be created by docker which contains a plugins and themes folder which can be used for development. \ No newline at end of file diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..6c2a16e --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,24 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +VAGRANTFILE_API_VERSION = "2" + +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| + config.vm.box = "trusty64" + config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box" + + # setup virtual hostname and provision local IP + config.vm.hostname = "docker.dev" + config.vm.network :private_network, :ip => "192.168.50.4" + config.hostsupdater.aliases = %w{www.docker.dev} + config.hostsupdater.remove_on_suspend = true + + config.vm.provision :docker + config.vm.provision :docker_compose, yml: "/vagrant/docker-compose.yml", run: "always" + + # Fix for slow external network connections + config.vm.provider :virtualbox do |vb| + vb.customize ['modifyvm', :id, '--natdnshostresolver1', 'on'] + vb.customize ['modifyvm', :id, '--natdnsproxy1', 'on'] + end +end diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..cbe2c94 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,17 @@ +web: + image: wordpress + links: + - mysql + environment: + - WORDPRESS_DB_PASSWORD=password + ports: + - 80:80 + working_dir: /var/www/html + volumes: + - /vagrant/src/:/var/www/html/wp-content + +mysql: + image: mysql:5.7 + environment: + - MYSQL_ROOT_PASSWORD=password + - MYSQL_DATABASE=wordpress \ No newline at end of file