Skip to content

Commit

Permalink
Revamp (#1)
Browse files Browse the repository at this point in the history
* Initial commit

* Updated Readme

* Added asset logo

* Logo change

* Added logo on read me

* Update logo position

* Updated read me

* Change logo to banner

* Change filename

* Update README.md

* Update README.md
  • Loading branch information
alexecus authored Jan 16, 2018
1 parent cb00f7f commit e3920c1
Show file tree
Hide file tree
Showing 12 changed files with 111 additions and 19 deletions.
31 changes: 31 additions & 0 deletions .vagrantplugins
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
class WebCommand < Vagrant.plugin(2, :command)
def self.synopsis
"Provisions only web related roles"
end

def execute
exec("vagrant provision --provision-with web")
end
end

class NginxCommand < Vagrant.plugin(2, :command)
def self.synopsis
"Provisions only nginx"
end

def execute
exec("vagrant provision --provision-with nginx")
end
end

class MyPlugin < Vagrant.plugin(2)
name "Custom command plugin"

command "web" do
WebCommand
end

command "nginx" do
NginxCommand
end
end
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
PHP VM
-------
PHP VM is a fast and stable local web environment built using Vagrant and Ansible.
<p align="center"><img src="assets/banner.png" width="450"></p>

Start working on your PHP projects without the hassle of setting up your development enviroment.
**PHP Vagrant** is a fast and stable local web environment built using Vagrant and Ansible. Start working on your PHP projects without the hassle of setting up your development enviroment.

**Requirements**

Expand All @@ -17,9 +15,9 @@ Start working on your PHP projects without the hassle of setting up your develop
- It's fast
- Easy to configure

**What's inside:**
**What's inside**

- Official Centos 7 vagrant box
- Official Centos 7 Box
- PHP 7.1
- Composer
- Nginx
Expand Down
32 changes: 30 additions & 2 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@ def which(cmd)
return nil
end

# Get the hostnames of the available servers
def hosts()
host = []
sites = YAML.load_file('sites.yml')

if sites && sites['nginx_vhosts']
sites['nginx_vhosts'].each do |site|
host.push(site['server_name'])
end
end

return host
end

Vagrant.configure("2") do |config|
# set virtual box name
config.vm.provider :virtualbox do |v|
Expand All @@ -37,6 +51,9 @@ Vagrant.configure("2") do |config|
config.vm.synced_folder commons['src'], commons['dest']
end

# Manage host files
config.hostsupdater.aliases = hosts()

# Port forwarding
# enable port forwarding as necessary, requires vagrant reload
# config.vm.network "forwarded_port", guest: 80, host: 8080, auto_correct: true
Expand All @@ -56,6 +73,17 @@ Vagrant.configure("2") do |config|
ansible.sudo = true
end

# We run the shell provisioner to fix the network issue
# config.vm.provision :shell, path: "ansible/shell.sh", run: "always"
# Custom provisioning to only provision web related roles
config.vm.provision "web", run: "never", type: ansible do |ansible|
ansible.verbose = "v"
ansible.playbook = "ansible/playbook.web.yml"
ansible.sudo = true
end

# Custom provisioning to only provision nginx
config.vm.provision "nginx", run: "never", type: ansible do |ansible|
ansible.verbose = "v"
ansible.playbook = "ansible/playbook.nginx.yml"
ansible.sudo = true
end
end
1 change: 1 addition & 0 deletions ansible/playbook.nginx.retry
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
default
10 changes: 10 additions & 0 deletions ansible/playbook.nginx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
- hosts: all
become: yes

vars_files:
- ../sites.yml
- vars/nginx.params.yml

roles:
- geerlingguy.nginx
16 changes: 16 additions & 0 deletions ansible/playbook.web.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
- hosts: all
become: yes

vars_files:
- ../sites.yml
- vars/firewall.yml
- vars/nginx.params.yml
- vars/php.yml

roles:
- AerisCloud.repos
- init
- geerlingguy.firewall
- geerlingguy.nginx
- geerlingguy.php
5 changes: 3 additions & 2 deletions ansible/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@
become: yes

vars_files:
- ../sites.yml
- vars/firewall.yml
- vars/nginx.params.yml
- vars/nginx.yml
- vars/php.yml
- vars/mysql.yml
- vars/node.yml

roles:
- init
- AerisCloud.repos
- init
- geerlingguy.firewall
- geerlingguy.nginx
- geerlingguy.git
- geerlingguy.ruby
- geerlingguy.drupal-console
- geerlingguy.php
- geerlingguy.php-pecl
- geerlingguy.composer
Expand Down
1 change: 1 addition & 0 deletions ansible/requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- src: geerlingguy.firewall
- src: geerlingguy.git
- src: geerlingguy.ruby
- src: geerlingguy.drupal-console
- src: geerlingguy.php
- src: geerlingguy.php-pecl
- src: geerlingguy.composer
Expand Down
7 changes: 0 additions & 7 deletions ansible/vars/nginx.yml

This file was deleted.

Binary file added assets/banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# You can specify here the box name and ip address. Modify this if you want to
# manage the host IP
name: "local_centos_env"
ip: 192.168.56.101
ip: 192.168.56.1

# SSH settings
# Specify here the custom key you want to use
Expand All @@ -13,7 +13,7 @@ key: ~/.ssh/id_rsa
# Specify the src and dest mount points. If you want to use NFS, which is highly
# recommended, just set the flag here to true
nfs: true
src: ~/Github/
src: ~/Projects
dest: /var/www/html

# Samba Sharing
Expand Down
13 changes: 13 additions & 0 deletions sites.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
nginx_vhosts:
- listen: "80"
server_name: "drupal.local"
root: "/var/www/html/Drupal"
index: "index.php"
extra_parameters: "{{ nginx_params_drupal }}"

- listen: "80"
server_name: "symfony.local"
root: "/var/www/html/Symfony"
index: "app.php"
extra_parameters: "{{ nginx_params_symfony }}"

0 comments on commit e3920c1

Please sign in to comment.