Skip to content

Commit 015f2e7

Browse files
author
dineshkummarc
committed
Php
1 parent fc43f7b commit 015f2e7

File tree

2,373 files changed

+275045
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,373 files changed

+275045
-0
lines changed

Ansible-debian-PHP/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.vagrant
2+
vagrant_ansible_inventory_default
3+

Ansible-debian-PHP/README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Virtual Machine for PHP development
2+
3+
Virtual machine suitable for PHP development (Symfony, Laravel, Drupal 8, etc).
4+
Build with Debian 7.x (Wheezy) including Nginx, MySQL, PHP-FPM and more packages.
5+
6+
## Requirements
7+
8+
- VirtualBox: https://www.virtualbox.org/wiki/Downloads
9+
- Vagrant: http://downloads.vagrantup.com/
10+
11+
## Available Roles
12+
13+
- Java (openJDK)
14+
- MailCatcher
15+
16+
Set your favourite app to deliver to smtp://127.0.0.1:1025 instead of your default SMTP server, then check out
17+
http://127.0.0.1:1080 to see the mail that's arrived so far.
18+
- Memcached
19+
- MySQL
20+
21+
Uses the custom.ini from provisioning/roles/mysql/templates to override the default settings
22+
- NodeJs
23+
- Redis
24+
25+
Uses the config from provisioning/roles/redis/templates/redis.conf.j2
26+
- PHP-FPM
27+
28+
Uses the config files from provisioning/roles/php-fpm/templates
29+
- Nginx
30+
- Zend-Server
31+
32+
Can't be used with the roles PHP-FPM and Nginx!
33+
34+
## Configuration
35+
- Vagrantfile
36+
37+
This file contains a config options array which you can change, or create a Vagrantfile.local with the config options
38+
you want to override.
39+
40+
- provisioning/group_vars/all
41+
42+
This file contains all configuration variables for the available roles.
43+
44+
- provisioning/playbook.yml
45+
46+
Enable the roles you need by removing the # in front of the line or place a # in front of a role to disable it
47+
48+
## Usage
49+
Copy the Vagrantfile and provisioning directory to your project, update the configuration and type:
50+
51+
```
52+
vagrant up
53+
```
54+
55+
## Todo
56+
- Make PHP Timezone configurable, currently hardcoded to Europe/Amsterdam
57+
- Add vhost to Zend-Server
58+
59+
60+
61+
## License
62+
63+
This code is open-sourced software licensed under the
64+
[MIT license](http://opensource.org/licenses/MIT)

Ansible-debian-PHP/Vagrantfile

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
VAGRANTFILE_API_VERSION = "2"
2+
3+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
4+
5+
config_values = {
6+
memory: 512,
7+
name: "phpansible",
8+
ip: "33.33.33.61"
9+
}
10+
11+
# Overwrites config_values
12+
if File.exists? 'Vagrantfile.local'
13+
eval File.read 'Vagrantfile.local'
14+
end
15+
16+
config.vm.box = "debian71-64"
17+
config.vm.box_url = "https://dl.dropboxusercontent.com/u/197673519/debian-7.2.0.box"
18+
19+
config.vm.network :private_network, ip: config_values[:ip]
20+
21+
config.ssh.forward_agent = true
22+
23+
config.vm.synced_folder "./", "/var/www/php-ansible.dev", id: "vagrant-root", :nfs => true
24+
25+
config.vm.provider :virtualbox do |vb|
26+
vb.customize [
27+
"modifyvm", :id,
28+
"--name", config_values[:name],
29+
"--memory", config_values[:memory],
30+
"--natdnshostresolver1", "on"
31+
]
32+
end
33+
34+
config.vm.provision :ansible do |ansible|
35+
ansible.playbook = "provisioning/playbook.yml"
36+
#ansible.verbose = "v"
37+
ansible.extra_vars = {
38+
private_interface: config_values[:ip],
39+
hostname: config_values[:name]
40+
}
41+
end
42+
end
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
server_hostname: symfony.localhost
3+
4+
php_fpm_socket: /var/run/php5-fpm.sock
5+
6+
with_php55: true
7+
8+
mysql_root_password: somepass
9+
mysql_database_name: symfony
10+
mysql_user: symfony
11+
mysql_user_password: mysymfonydatabasepassword
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
- name: Awesome Development Image
3+
hosts: all
4+
sudo: yes
5+
6+
roles:
7+
- common
8+
- zend-server
9+
# - java
10+
# - memcached
11+
# - nodejs
12+
# - redis
13+
# - php-fpm
14+
# - mysql
15+
# - nginx
16+
# - mailcatcher
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
- name: update apt
3+
action: command /usr/bin/apt-get update
4+
5+
- name: install python-software-properties
6+
action: apt pkg=python-software-properties state=present
7+
8+
- name: Common - Install common packages
9+
apt: pkg="{{ item }}" state=latest
10+
with_items:
11+
- build-essential
12+
- imagemagick
13+
- vim
14+
- curl
15+
- git
16+
- wget
17+
- htop
18+
- ack-grep
19+
- ntp
20+
21+
- name: ensure user `vagrant` is part of `vboxsf` group (to access shared folder)
22+
user: name=vagrant groups=vboxsf append=yes
23+
24+
- name: Common | Set the hostname /etc/hostname
25+
shell: echo {{ hostname }} > /etc/hostname
26+
when: hostname is defined
27+
28+
- name: Set the hostname
29+
shell: hostname {{ hostname }}
30+
when: hostname is defined
31+
32+
- name: add dotdeb squeeze/wheezy repo
33+
action: template src=dotdeb.{{ ansible_lsb.codename }}.list.j2 dest=/etc/apt/sources.list.d/dotdeb.list mode=0644
34+
35+
- name: download dotdeb gpg
36+
action: get_url url=http://www.dotdeb.org/dotdeb.gpg dest=/tmp/dotdeb.gpg mode=0400
37+
38+
- name: add dotdeb gpg
39+
action: command apt-key add /tmp/dotdeb.gpg
40+
41+
- name: apt update
42+
action: apt update_cache=yes
43+
44+
- name: update /etc/hosts
45+
lineinfile: dest=/etc/hosts regexp='^127\.0\.0\.1' line='127.0.0.1 localhost {{ hostname }}' owner=root group=root mode=0644
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
deb http://packages.dotdeb.org squeeze all
2+
deb-src http://packages.dotdeb.org squeeze all
3+
4+
{% if with_php54 %}
5+
deb http://packages.dotdeb.org squeeze-php54 all
6+
deb-src http://packages.dotdeb.org squeeze-php54 all
7+
{% endif %}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
deb http://packages.dotdeb.org wheezy all
2+
deb-src http://packages.dotdeb.org wheezy all
3+
4+
{% if with_php55 %}
5+
deb http://packages.dotdeb.org wheezy-php55 all
6+
deb-src http://packages.dotdeb.org wheezy-php55 all
7+
{% endif %}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
- name: install OpenJDK 7 packages
3+
action: apt pkg="{{ item }}" state=present
4+
with_items:
5+
- openjdk-7-jre
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
- name: Commmon | MailUtils
3+
apt: pkg=mailutils state=latest
4+
5+
- name: Commmon | sqlite3
6+
apt: pkg=sqlite3 state=latest
7+
8+
- name: Commmon | libsqlite3-dev
9+
apt: pkg=libsqlite3-dev state=latest
10+
11+
- name: Common | Install rubygems package
12+
apt: pkg=rubygems state=installed
13+
14+
- name: MailCatcher | Install MailCatcher
15+
action: command gem install mailcatcher creates=/usr/bin/mailcatcher
16+
17+
- name: MailCatcher | Configure PHP Email
18+
command: sed -ir "s/;\?sendmail_path =.*/sendmail_path = \/usr\/bin\/env \/usr\/bin\/catchmail/" /etc/php5/php-fpm/php.ini
19+
command: sed -ir "s/;\?sendmail_path =.*/sendmail_path = \/usr\/bin\/env \/usr\/bin\/catchmail/" /etc/php5/cli/php.ini
20+
21+
- name: MailCatcher | Kill MailCatcher
22+
command: pkill mailcatcher
23+
ignore_errors: yes
24+
25+
- name: MailCatcher | Run MailCatcher
26+
command: mailcatcher --ip=0.0.0.0
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
- name: install Memcached packages
3+
action: apt pkg="{{ item }}" state=present
4+
with_items:
5+
- memcached
6+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
- name: restart mysql
3+
action: service name=mysql state=restarted enabled=yes
4+
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
- name: install MySQL server packages
3+
action: apt pkg="{{ item }}" state=present
4+
with_items:
5+
- mysql-server
6+
- mysql-client
7+
- python-mysqldb # used by mysql* ansible's modules
8+
- mytop
9+
- mysqltuner
10+
11+
# Secure MySQL setup
12+
- name: update mysql root password for all root accounts
13+
mysql_user: name=root host={{ item }} check_implicit_admin=yes password={{ mysql_root_password }} login_user=root login_password={{ mysql_root_password }}
14+
with_items:
15+
- "{{ hostname }}"
16+
- 127.0.0.1
17+
- ::1
18+
- localhost
19+
20+
- name: ensure anonymous users are not in the database
21+
mysql_user: name='' host={{ item }} state=absent login_user=root login_password={{ mysql_root_password }}
22+
with_items:
23+
- localhost
24+
25+
- name: remove the test database
26+
mysql_db: name=test state=absent login_user=root login_password={{ mysql_root_password }}
27+
28+
29+
# Users and DBs setup
30+
- name: Ensure {{ mysql_database_name }} DB is present
31+
mysql_db: name={{ mysql_database_name }} collation=utf8_unicode_ci encoding=utf8 state=present login_user=root login_password={{ mysql_root_password }}
32+
33+
- name: Ensure {{ mysql_user }} mysql user is present
34+
mysql_user: name='{{ mysql_user }}' password={{ mysql_user_password }} host=localhost state=present login_user=root login_password={{ mysql_root_password }} priv='{{ mysql_user }}.*:ALL'
35+
36+
# Update MySQL Config
37+
- name: Deploy custom mysql config settings
38+
template: src=custom.ini dest=/etc/mysql/conf.d/custom.ini
39+
notify: restart mysql
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[mysqld]
2+
bind-address = 0.0.0.0
3+
innodb_file_per_table
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
- name: restart nginx
3+
service: name=nginx state=restarted
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
- name: Install nginx
3+
apt: pkg=nginx state=latest
4+
5+
- name: Create nginx main configuration
6+
template: src=nginx.conf dest=/etc/nginx/nginx.conf
7+
8+
- name: Create symfony nginx configuration
9+
template: src=symfony.conf dest=/etc/nginx/sites-available/symfony.conf
10+
11+
- name: Delete default nginx configuration
12+
file: name=/etc/nginx/sites-enabled/default state=absent
13+
14+
- name: Create link for nginx configuration
15+
file: src=/etc/nginx/sites-available/symfony.conf dest=/etc/nginx/sites-enabled/symfony.conf state=link
16+
notify: restart nginx

0 commit comments

Comments
 (0)