Skip to content

Commit d4e7388

Browse files
committed
Merge branch 'develop'
2 parents 6b76320 + c79c885 commit d4e7388

File tree

37 files changed

+281
-165
lines changed

37 files changed

+281
-165
lines changed

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
.vagrant
2+
vagrant_ansible_inventory_default

Diff for: .gitmodules

-18
This file was deleted.

Diff for: LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2013, Ramon Kleiss <ramon@cubilon.nl>
1+
Copyright (c) 2014, Ramon Kleiss <ramon@cubilon.nl>
22
All rights reserved.
33

44
Redistribution and use in source and binary forms, with or without

Diff for: README.md

+15-10
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ that can be useful when developing for Symfony2:
2020
- APC
2121
- PEAR
2222
- XDebug
23+
- RabbitMQ
2324

2425
Additionally, it will create a MySQL database called `symfony` that a Symfony2
2526
application can connect to without any configuration.
@@ -30,14 +31,14 @@ Installation is as easy as cloning a GitHub project:
3031

3132
```
3233
$ cd your-symfony-project
33-
$ git clone --recursive https://github.com/kleiram/vagrant-symfony.git vagrant
34+
$ git clone https://github.com/kleiram/vagrant-symfony.git vagrant
3435
```
3536

3637
Or, if you're using Git already in your project, you can use it as a submodule:
3738

3839
```
3940
$ cd your-symfony-project
40-
$ git submodule add --recursive https://github.com/kleiram/vagrant-symfony.git vagrant
41+
$ git submodule add https://github.com/kleiram/vagrant-symfony.git vagrant
4142
```
4243

4344
After the project is added, you can start the environment like this:
@@ -49,25 +50,31 @@ $ vagrant up
4950

5051
Starting the VM might take some time, since it will download the entire box
5152
and additional applications/library. When the VM is done setting up, point
52-
your browser towards [http://33.33.33.10](http://33.33.33.10) and there you
53+
your browser towards [http://192.168.33.10](http://192.168.33.10) and there you
5354
have it: Symfony2.
5455

56+
### Ansible
57+
58+
[Ansible](http://ansible.com) is used to provision the virtual machine, so you
59+
must have that installed. Follow the
60+
[installation instructions](http://docs.ansible.com/intro_installation.html#installation).
61+
5562
#### Note
5663

5764
If you're using Windows, you have to modify the `Vagrantfile` a little bit to
5865
make it all work (since Windows doesn't support NFS). Replace the following
5966
lines in the Vagrantfile:
6067

6168
```ruby
62-
config.vm.share_folder "vagrant-root", "/vagrant", ".", :nfs => true
63-
config.vm.share_folder "www", "/var/www", "..", :nfs => true
69+
config.vm.synced_folder ".", "/vagrant", id: "vagrant-root", :nfs => true
70+
config.vm.synced_folder "..", "/var/www", id: "application", :nfs => true
6471
```
6572

6673
with:
6774

6875
```ruby
69-
config.vm.share_folder "vagrant-root", "/vagrant", "."
70-
config.vm.share_folder "www", "/var/www", ".."
76+
config.vm.synced_folder ".", "/vagrant", id: "vagrant-root"
77+
config.vm.synced_folder "..", "/var/www", id: "application"
7178
```
7279

7380
## Troubleshooting
@@ -120,10 +127,8 @@ the log from your host computer (the computer that's running Vagrant).
120127

121128
The following things are additions I want to add to the project:
122129

123-
- Gearman
124130
- Memcached
125131
- Node.js (with the Bower package)
126-
- ZeroMQ
127132

128133
Feel free to add these components and create a pull request!
129134

@@ -186,7 +191,7 @@ major version is incremented.
186191
## License
187192

188193
```
189-
Copyright (c) 2013, Ramon Kleiss <ramon@cubilon.nl>
194+
Copyright (c) 2014, Ramon Kleiss <ramon@cubilon.nl>
190195
All rights reserved.
191196
192197
Redistribution and use in source and binary forms, with or without

Diff for: TODO

-7
This file was deleted.

Diff for: Vagrantfile

+21-17
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
1-
Vagrant::Config.run do |config|
1+
Vagrant.configure("2") do |config|
2+
# Configure the box to use
3+
config.vm.box = 'precise64'
4+
config.vm.box_url = 'http://files.vagrantup.com/precise64.box'
25

3-
# Configure the VM box to use
4-
config.vm.box = 'ubuntu-server'
5-
config.vm.box_url = 'http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210.box'
6-
7-
# Configure network and port forwarding
8-
config.vm.network :hostonly, "33.33.33.10"
9-
config.vm.forward_port 80, 8080 # HTTP
10-
config.vm.forward_port 3306, 3306 # MySQL
11-
config.vm.forward_port 27017, 27017 # MongoDB
6+
# Configure the network interfaces
7+
config.vm.network :private_network, ip: "192.168.33.10"
8+
config.vm.network :forwarded_port, guest: 80, host: 8080
9+
config.vm.network :forwarded_port, guest: 8081, host: 8081
10+
config.vm.network :forwarded_port, guest: 3306, host: 3306
11+
config.vm.network :forwarded_port, guest: 27017, host: 27017
1212

1313
# Configure shared folders
14-
config.vm.share_folder "vagrant-root", "/vagrant", ".", :nfs => true
15-
config.vm.share_folder "www", "/var/www", "..", :nfs => true
16-
config.vm.share_folder "puppet", "/tmp/vagrant-puppet", "puppet", :nfs => true
14+
config.vm.synced_folder ".", "/vagrant", id: "vagrant-root", :nfs => true
15+
config.vm.synced_folder "..", "/var/www", id: "application", :nfs => true
16+
17+
# Configure VirtualBox environment
18+
config.vm.provider :virtualbox do |v|
19+
v.name = "symfony"
20+
v.customize [ "modifyvm", :id, "--memory", 512 ]
21+
end
1722

18-
# Configure provisioning
19-
config.vm.provision :puppet do |puppet|
20-
puppet.manifests_path = "puppet/manifests"
21-
puppet.module_path = "puppet/modules"
23+
# Provision the box
24+
config.vm.provision :ansible do |ansible|
25+
ansible.playbook = "ansible/site.yml"
2226
end
2327
end

Diff for: ansible/roles/composer/tasks/main.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
- name: Install Composer
3+
shell: curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer

Diff for: ansible/roles/curl/tasks/main.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
- name: Install cURL
3+
sudo: yes
4+
apt: pkg=curl state=latest

Diff for: ansible/roles/git/tasks/main.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
- name: Install Git
3+
sudo: yes
4+
apt: pkg=git state=latest

Diff for: ansible/roles/init/tasks/main.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
- name: Update apt
3+
sudo: yes
4+
apt: update_cache=yes
5+
6+
- name: Install system packages
7+
sudo: yes
8+
apt: pkg={{ item }} state=latest
9+
with_items:
10+
- curl
11+
- wget
12+
- build-essential
13+
- python-software-properties
14+
15+
- name: Add ppa repository
16+
sudo: yes
17+
apt_repository: repo=ppa:ondrej/{{ php_ppa }}
18+
19+
- name: Update apt again
20+
sudo: yes
21+
apt: update_cache=yes
22+
23+
- name: Install extra packages
24+
sudo: yes
25+
apt: pkg={{ item }} state=latest
26+
with_items: sys_packages

Diff for: ansible/roles/mongo/handlers/main.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
- name: restart mongodb
3+
service: name=mongodb enabled=yes state=restarted

Diff for: ansible/roles/mongo/tasks/main.yml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
- name: Install MongoDB
3+
sudo: yes
4+
apt: pkg=mongodb state=latest
5+
6+
- name: Allow access to MongoDB from anywhere
7+
sudo: yes
8+
lineinfile: dest=/etc/mongodb.conf regexp="^bind_ip" line="#bind_ip = 127.0.0.1"
9+
notify: restart mongodb

Diff for: ansible/roles/mysql/handlers/main.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
- name: restart mysql
3+
service: name=mysql enabled=yes state=restarted

Diff for: ansible/roles/mysql/tasks/main.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
- name: Install MySQL server
3+
sudo: yes
4+
apt: pkg=mysql-server state=latest
5+
6+
- name: Allow access to MySQL from anywhere
7+
sudo: yes
8+
lineinfile: dest=/etc/mysql/my.cnf regexp="^bind-address" "line=#bind-address = 0.0.0.0"
9+
notify: restart mysql
10+
11+
- name: Add root user from anywhere to MySQL
12+
command: mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'; FLUSH PRIVILEGES;"
13+
14+
- name: Create MySQL database symfony
15+
command: mysql -u root -e "CREATE DATABASE IF NOT EXISTS symfony;"

Diff for: ansible/roles/nginx/handlers/main.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
- name: restart nginx
3+
service: name=nginx enabled=yes state=restarted

Diff for: ansible/roles/nginx/tasks/main.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
- name: Install nginx
3+
sudo: yes
4+
apt: pkg=nginx state=latest
5+
6+
- name: Ensure nginx log directory exists
7+
file: dest=/var/log/nginx/symfony state=directory
8+
9+
- name: Change default nginx site
10+
sudo: yes
11+
template: src=default.tpl dest=/etc/nginx/sites-available/default
12+
notify: restart nginx
13+

Diff for: ansible/roles/nginx/templates/default.tpl

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
server {
2+
listen 80;
3+
4+
server_name symfony;
5+
root {{ doc_root }};
6+
7+
error_log /var/log/nginx/symfony/error.log;
8+
access_log /var/log/nginx/symfony/access.log;
9+
10+
rewrite ^/(app|app_dev)\.php/?(.*)$ /$1 permanent;
11+
12+
location / {
13+
index app_dev.php;
14+
try_files $uri @rewriteapp;
15+
}
16+
17+
location @rewriteapp {
18+
rewrite ^(.*)$ /app_dev.php/$1 last;
19+
}
20+
21+
location ~ ^/(app|app_dev|config)\.php(/|$) {
22+
fastcgi_pass unix:/var/run/php5-fpm.sock;
23+
fastcgi_split_path_info ^(.+\.php)(/.*)$;
24+
include fastcgi_params;
25+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
26+
fastcgi_param HTTPS off;
27+
}
28+
}

Diff for: ansible/roles/php5-cli/tasks/main.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
- name: Install PHP5-CLI
3+
sudo: yes
4+
apt: package=php5-cli state=latest

Diff for: ansible/roles/php5-common/tasks/main.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
- name: Install PHP packages
3+
sudo: yes
4+
apt: package={{ item.package }} state=latest
5+
with_items: php_packages
6+
7+
- name: Enable PHP packages
8+
sudo: yes
9+
command: /usr/sbin/php5enmod {{ item.name }} creates=/etc/php5/cli/conf.d/20-{{ item.name }}.ini
10+
with_items: php_packages
11+
notify: restart php5-fpm
12+
13+
- name: Install PHP extensions
14+
sudo: yes
15+
shell: echo "\n" | /usr/bin/pecl install {{ item.package }} creates=/usr/lib/php5/20121212/{{ item.name }}.so
16+
with_items: php_extensions
17+
18+
- name: Configure PHP extensions
19+
sudo: yes
20+
template: src=extension.tpl dest=/etc/php5/mods-available/{{ item.name }}.ini
21+
with_items: php_extensions
22+
23+
- name: Enable PHP extensions
24+
sudo: yes
25+
command: /usr/sbin/php5enmod {{ item.name }} creates=/etc/php5/cli/conf.d/20-{{ item.name }}.ini
26+
with_items: php_extensions
27+
notify: restart php5-fpm

Diff for: ansible/roles/php5-common/templates/extension.tpl

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
extension = {{ item.name }}.so

Diff for: ansible/roles/php5-fpm/handlers/main.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
- name: restart php5-fpm
3+
service: name=php5-fpm enabled=yes state=restarted

Diff for: ansible/roles/php5-fpm/tasks/main.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
- name: Install PHP5-FPM
3+
sudo: yes
4+
apt: package=php5-fpm state=latest

Diff for: ansible/roles/phpunit/tasks/main.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
- name: Configure PEAR for PHPUnit
3+
sudo: yes
4+
command: pear config-set auto_discover 1
5+
6+
- name: Install PHPUnit
7+
sudo: yes
8+
command: pear install pear.phpunit.de/PHPUnit creates=/usr/bin/phpunit

Diff for: ansible/roles/rabbitmq/handlers/main.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
- name: restart rabbitmq
3+
service: name=rabbitmq-server enabled=yes state=restarted

Diff for: ansible/roles/rabbitmq/tasks/main.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
- name: Add RabbitMQ repository
3+
shell: echo 'deb http://www.rabbitmq.com/debian/ testing main' > /etc/apt/sources.list.d/rabbitmq.list creates=/etc/apt/sources.list.d/rabbitmq.list
4+
5+
- name: Download RabbitMQ key
6+
get_url: url=http://www.rabbitmq.com/rabbitmq-signing-key-public.asc dest=/tmp/rabbitmq-signing-key-public.asc
7+
8+
- name: Add RabbitMQ key
9+
sudo: yes
10+
command: apt-key add /tmp/rabbitmq-signing-key-public.asc
11+
12+
- name: Update apt again
13+
sudo: yes
14+
apt: update_cache=yes
15+
16+
- name: Install RabbitMQ
17+
sudo: yes
18+
apt: pkg=rabbitmq-server state=latest
19+
20+
- name: Enable RabbitMQ plugins
21+
shell: rabbitmq-plugins enable rabbitmq_management
22+
23+
- name: Add admin user
24+
shell: rabbitmqctl add_user admin password
25+
ignore_errors: true
26+
27+
- name: Set admin user tags
28+
shell: rabbitmqctl set_user_tags admin administrator
29+
ignore_errors: true
30+
31+
- name: Set admin user permissions
32+
shell: rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"
33+
ignore_errors: true
34+
35+
- name: Delete guest user
36+
shell: rabbitmqctl delete_user guest
37+
notify: restart rabbitmq
38+
ignore_errors: true

Diff for: ansible/roles/sqlite/tasks/main.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
- name: Install SQLite
3+
sudo: yes
4+
apt: pkg=sqlite3 state=latest

Diff for: ansible/roles/wget/tasks/main.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
- name: Install wget
3+
sudo: yes
4+
apt: pkg=wget state=latest

0 commit comments

Comments
 (0)