Skip to content
This repository has been archived by the owner on Dec 26, 2022. It is now read-only.

Commit

Permalink
Merge pull request #44 from theofidry/patch-1
Browse files Browse the repository at this point in the history
Patch 1
  • Loading branch information
theofidry committed Jun 30, 2015
2 parents 1c42b88 + ce5dbfc commit b1705f0
Show file tree
Hide file tree
Showing 421 changed files with 9,266 additions and 14,623 deletions.
15 changes: 0 additions & 15 deletions COPYRIGHT

This file was deleted.

42 changes: 42 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

# Vagrantfile API/syntax version.
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

# Box configuration
config.vm.box = "jessie"
config.vm.box_url = "http://static.gender-api.com/debian-8-jessie-rc2-x64-slim.box"
config.vm.box_check_update = true

# Use Ansible as its provisioner
config.vm.provision :ansible do |ansible|
ansible.inventory_path = "ansible/inventory/hosts"
ansible.limit = "dev"
ansible.playbook = "ansible/playbook.yml"
# Enable this line if you wish to debug the provision
ansible.verbose = "vvvv"
end

# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
config.vm.network "forwarded_port", guest: 80, host: 8080 # Web server
config.vm.network "forwarded_port", guest: 3306, host: 3307 # MySQL server
config.vm.network "forwarded_port", guest: 6379, host: 6379 # redis server

# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
config.vm.synced_folder ".", "/var/www/symfony-app", group: "www-data", mount_options: ["dmode=775,fmode=664"]
# Disable the default /vagrant share can be done as follows:
config.vm.synced_folder ".", "/vagrant", disabled: true

# Provider-specific configuration
config.vm.provider "virtualbox" do |vb|
vb.memory = 2048 # Upgrade memory for package managers
end
end
2 changes: 2 additions & 0 deletions ansible/inventory/hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[dev]
default ansible_ssh_host=127.0.0.1 ansible_ssh_port=2222
35 changes: 35 additions & 0 deletions ansible/parameters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
symfony_src_dir: symfony-app
symfony_owner: vagrant

doc_root: /var/www/symfony-app/web

sys_packages:
- curl
- mcrypt
- wget

php_packages:
- { name: dev, package: php5-dev }
- { name: pear, package: php-pear }
- { name: xdebug, package: php5-xdebug }
- { name: curl, package: php5-curl }
- { name: mcrypt, package: php5-mcrypt }
- { name: mysql, package: php5-mysql }
- { name: redis, package: php5-redis }

php_extensions:
- { name: jsmin, package: pecl.php.net/jsmin-beta }
- { name: xhprof, package: pecl.php.net/xhprof-beta }

php_ppa: php5

php_global_settings_override:
date.timezone: Europe/Paris

# TODO: cf issue https://github.com/knopki/ansible-locale/issues/5
# Maybe use https://github.com/knopki as module instead of our custom?
locale: fr_FR.UTF-8
locale_language: fr
locale_ctype: fr_FR.UTF-8

composer_path: /usr/bin/composer
17 changes: 17 additions & 0 deletions ansible/playbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
- hosts: dev
sudo: true
vars_files:
- parameters.yml
roles:
- mysql
- init
- locales
- git
- shell
- nginx
- php5
- composer
- psysh
- redis
- symfony
10 changes: 10 additions & 0 deletions ansible/roles/composer/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
- name: Install Composer globally
sudo: yes
shell: >
curl -sS https://getcomposer.org/installer | php
&& mv composer.phar {{ composer_path }}
- name: Update Composer to latest version
sudo: yes
shell: composer self-update # Does not require the path since is installed globaly
10 changes: 10 additions & 0 deletions ansible/roles/git/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
- name: Install Git
sudo: yes
apt: pkg=git state=latest

- name: Configure Git for vagrant user
template: src=gitconfig.j2 dest=/home/vagrant/.gitconfig

- name: Configure gitignore for vagrant user
template: src=gitignore_global.j2 dest=/home/vagrant/.gitignore_global
16 changes: 16 additions & 0 deletions ansible/roles/git/templates/gitconfig.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[push]
default = current
[core]
excludesfile = /home/vagrant/.gitignore_global
[alias]
aa = add -A
am = commit
ci = commit
co = checkout
br = branch
bra = branch -a
fa = fetch --all
graph1 = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d% C(reset)' --all
graph2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(res et) %C(dim white)- %an%C(reset)' --all
graph = !"git lg1"
st = status
109 changes: 109 additions & 0 deletions ansible/roles/git/templates/gitignore_global.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# Created by https://www.gitignore.io

### Linux ###
*~

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*


### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm

*.iml

## Directory-based project format:
.idea/
# if you remove the above rule, at least ignore the following:

# User-specific stuff:
# .idea/workspace.xml
# .idea/tasks.xml
# .idea/dictionaries

# Sensitive or high-churn files:
# .idea/dataSources.ids
# .idea/dataSources.xml
# .idea/sqlDataSources.xml
# .idea/dynamic.xml
# .idea/uiDesigner.xml

# Gradle:
# .idea/gradle.xml
# .idea/libraries

# Mongo Explorer plugin:
# .idea/mongoSettings.xml

## File-based project format:
*.ipr
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties


### NetBeans ###
nbproject/private/
build/
nbbuild/
dist/
nbdist/
nbactions.xml
nb-configuration.xml
.nb-gradle/


### Eclipse ###
*.pydevproject
.metadata
.gradle
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath

# Eclipse Core
.project

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

# CDT-specific
.cproject

# JDT-specific (Eclipse Java Development Tools)
.classpath

# PDT-specific
.buildpath

# sbteclipse plugin
.target

# TeXlipse plugin
.texlipse
25 changes: 25 additions & 0 deletions ansible/roles/init/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
# Task skipped if repositories as been updated less than 86400sec = 24h
- name: Refresh APT repositories
sudo: yes
apt: update_cache=yes cache_valid_time=86400

- name: Upgrade APT packages
sudo: yes
shell: DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confnew" --force-yes -fuy dist-upgrade

- name: Install system packages
sudo: yes
apt: pkg={{ item }} state=latest
with_items:
- build-essential
- curl
- python-software-properties
- telnet
- unzip
- wget

- name: Install extra packages
sudo: yes
apt: pkg={{ item }} state=latest
with_items: sys_packages
3 changes: 3 additions & 0 deletions ansible/roles/locales/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
- name: Regenerate locales
shell: locale-gen && update-locale "{{ locale }}"
15 changes: 15 additions & 0 deletions ansible/roles/locales/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
- name: Make sure the required packages are installed
apt: pkg={{ item }} state=present
sudo: yes
with_items:
- locales

- name: Configure system wide locales
sudo: yes
locale_gen: name={{ locale }} state=present

- name: Configure users locales
sudo: yes
template: src=locales.j2 dest=/etc/default/locale
notify: Regenerate locales
47 changes: 47 additions & 0 deletions ansible/roles/locales/templates/locales.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Generated by Ansible
{% if locale is defined %}
LANG="{{ locale }}"
{% endif %}
{% if locale_language is defined %}
LANGUAGE="{{ locale_language }}"
{% endif %}
{% if locale_ctype is defined %}
LC_CTYPE="{{ locale_ctype }}"
{% endif %}
{% if locale_numeric is defined %}
LC_NUMERIC="{{ locale_numeric }}"
{% endif %}
{% if locale_time is defined %}
LC_TIME="{{ locale_time }}"
{% endif %}
{% if locale_collate is defined %}
LC_COLLATE="{{ locale_collate }}"
{% endif %}
{% if locale_monetary is defined %}
LC_MONETARY="{{ locale_monetary }}"
{% endif %}
{% if locale_messages is defined %}
LC_MESSAGES="{{ locale_messages }}"
{% endif %}
{% if locale_paper is defined %}
LC_PAPER="{{ locale_paper }}"
{% endif %}
{% if locale_name is defined %}
LC_NAME="{{ locale_name }}"
{% endif %}
{% if locale_address is defined %}
LC_ADDRESS="{{ locale_address }}"
{% endif %}
{% if locale_telephone is defined %}
LC_TELEPHONE="{{ locale_telephone }}"
{% endif %}
{% if locale_measurement is defined %}
LC_MEASUREMENT="{{ locale_measurement }}"
{% endif %}
{% if locale_identification is defined %}
LC_IDENTIFICATION="{{ locale_identification }}"
{% endif %}
{% if locale_all is defined %}
LC_ALL="{{ locale_all }}"
{% endif %}

3 changes: 3 additions & 0 deletions ansible/roles/mysql/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
- name: Restart mysql
service: name=mysql enabled=yes state=restarted
16 changes: 16 additions & 0 deletions ansible/roles/mysql/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
- name: Install MySQL server
sudo: yes
apt: pkg=mysql-server state=latest

- name: Ensure that MySQL server is installed
sudo: yes
apt: pkg=mysql-server state=latest

- name: Allow access to MySQL from anywhere
sudo: yes
lineinfile: dest=/etc/mysql/my.cnf regexp="^bind-address" "line=#bind-address = 0.0.0.0"
notify: Restart mysql

- name: Add root user from anywhere to MySQL
command: mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'; FLUSH PRIVILEGES;"
6 changes: 6 additions & 0 deletions ansible/roles/nginx/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- name: Reload nginx
service: name=nginx state=reloaded

- name: Restart nginx
service: name=nginx state=restarted
Loading

0 comments on commit b1705f0

Please sign in to comment.