-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6cce475
commit b335731
Showing
16 changed files
with
287 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,9 @@ vendor/ | |
# PHPStorm | ||
.idea/ | ||
|
||
# Vagrant | ||
.vagrant/ | ||
vagrant_ansible_inventory_default | ||
|
||
# Config | ||
public_html/config.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# -*- mode: ruby -*- | ||
# vi: set ft=ruby : | ||
|
||
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | ||
VAGRANTFILE_API_VERSION = "2" | ||
|
||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | ||
# All Vagrant configuration is done here. The most common configuration | ||
# options are documented and commented below. For a complete reference, | ||
# please see the online documentation at vagrantup.com. | ||
|
||
# Every Vagrant virtual environment requires a box to build off of. | ||
config.vm.box = "saucy64" | ||
|
||
# The url from where the 'config.vm.box' box will be fetched if it | ||
# doesn't already exist on the user's system. | ||
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/saucy/current/saucy-server-cloudimg-amd64-vagrant-disk1.box" | ||
|
||
# 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: 8044 | ||
|
||
# Create a private network, which allows host-only access to the machine | ||
# using a specific IP. | ||
# config.vm.network :private_network, ip: "192.168.33.10" | ||
|
||
# Create a public network, which generally matched to bridged network. | ||
# Bridged networks make the machine appear as another physical device on | ||
# your network. | ||
# config.vm.network :public_network | ||
|
||
# If true, then any SSH connections made will enable agent forwarding. | ||
# Default value: false | ||
# config.ssh.forward_agent = true | ||
|
||
# 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 "../data", "/vagrant_data" | ||
|
||
# Provider-specific configuration so you can fine-tune various | ||
# backing providers for Vagrant. These expose provider-specific options. | ||
# Example for VirtualBox: | ||
# | ||
config.vm.provider :virtualbox do |vb| | ||
# # Don't boot with headless mode | ||
# vb.gui = true | ||
# | ||
# # Use VBoxManage to customize the VM. For example to change memory: | ||
vb.customize ["modifyvm", :id, "--cpuexecutioncap", "50"] | ||
vb.customize ["modifyvm", :id, "--cpus", "2"] | ||
vb.customize ["modifyvm", :id, "--memory", "2048"] | ||
end | ||
# | ||
# View the documentation for the provider you're using for more | ||
# information on available options. | ||
|
||
# Use rbconfig to determine if we're on a windows host or not. | ||
require 'rbconfig' | ||
is_windows = (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/) | ||
if is_windows | ||
# Provisioning configuration for shell script. | ||
config.vm.provision "shell" do |sh| | ||
sh.path = "ansible/ansible-in-vm.sh" | ||
sh.args = "ansible/playbook.yml ansible/inventory" | ||
end | ||
else | ||
# Provisioning configuration for Ansible (for Mac/Linux hosts). | ||
config.vm.provision "ansible" do |ansible| | ||
ansible.playbook = "ansible/playbook.yml" | ||
ansible.inventory_path = "ansible/inventory" | ||
ansible.sudo = true | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
This is a directory holding [Ansible](http://docs.ansible.com/) playbook that is used to provision the development environment created by [Vagrant](http://www.vagrantup.com/). | ||
|
||
|
||
Run ```vagrant up``` in the root directory (above this one) to start a Virtual Machine with this project. Then connect to [http://localhost:8044/](http://localhost:8044/). | ||
|
||
Remember that first you need to [install Vagrant](http://www.vagrantup.com/downloads) and [Virtual Box](https://www.virtualbox.org/wiki/Downloads). | ||
|
||
This directory is not needed for a real deployment, you can safely delete it. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
# | ||
# Windows shell provisioner for Ansible playbooks, based on KSid's | ||
# windows-vagrant-ansible: https://github.com/KSid/windows-vagrant-ansible | ||
# | ||
# @todo - Allow proxy configuration to be passed in via Vagrantfile config. | ||
# | ||
# @see README.md | ||
# @author Jeff Geerling, 2014 | ||
# @version 1.0 | ||
# | ||
|
||
# Uncomment if behind a proxy server. | ||
# export {http,https,ftp}_proxy='http://username:password@proxy-host:80' | ||
|
||
ANSIBLE_PLAYBOOK=$1 | ||
ANSIBLE_HOSTS=$2 | ||
TEMP_HOSTS="/tmp/ansible_hosts" | ||
|
||
if [ ! -f /vagrant/$ANSIBLE_PLAYBOOK ]; then | ||
echo "Cannot find Ansible playbook." | ||
exit 1 | ||
fi | ||
|
||
if [ ! -f /vagrant/$ANSIBLE_HOSTS ]; then | ||
echo "Cannot find Ansible hosts." | ||
exit 2 | ||
fi | ||
|
||
# Install Ansible and its dependencies if it's not installed already. | ||
if [ ! -f /usr/bin/ansible ]; then | ||
echo "Installing Ansible dependencies and Git" | ||
aptitude install -y git python python-pip python-dev | ||
echo "Installing Ansible" | ||
pip install ansible | ||
fi | ||
|
||
cp /vagrant/${ANSIBLE_HOSTS} ${TEMP_HOSTS} && chmod -x ${TEMP_HOSTS} | ||
echo "Running Ansible provisioner defined in Vagrantfile." | ||
ansible-playbook /vagrant/${ANSIBLE_PLAYBOOK} --inventory-file=${TEMP_HOSTS} --extra-vars "is_windows=true" --connection=local | ||
rm ${TEMP_HOSTS} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
127.0.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
- hosts: all | ||
tasks: | ||
- include: tasks/mysql.yml | ||
- include: tasks/nginx.yml | ||
- include: tasks/php5-fpm.yml | ||
- include: tasks/tfs.yml | ||
- include: tasks/DevAAC.yml | ||
|
||
handlers: | ||
- name: restart nginx | ||
service: name=nginx state=restarted | ||
|
||
- name: restart php5-fpm | ||
service: name=php5-fpm state=restarted | ||
|
||
- name: restart mysql | ||
service: name=mysql state=restarted | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
- name: Install composer | ||
shell: curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin | ||
creates=/usr/local/bin/composer.phar | ||
|
||
- name: Install requirements with composer | ||
shell: cd /vagrant && composer.phar install | ||
|
||
- name: Copy config.php | ||
template: src=templates/config.php dest=/home/vagrant/config.php | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
- name: Install Mysql package | ||
apt: pkg={{ item }} state=present | ||
with_items: | ||
- mysql-server | ||
- python-mysqldb | ||
|
||
- name: Start Mysql Service | ||
service: name=mysql state=started enabled=true | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
- name: Install nginx | ||
apt: pkg=nginx state=present | ||
|
||
- name: Copy nginx configuration for DevAAC | ||
template: src=templates/nginx-vhost.conf dest=/etc/nginx/sites-available/default | ||
notify: restart nginx | ||
|
||
- name: Start nginx Service | ||
service: name=nginx state=started enabled=true | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
- name: Install php5-fpm | ||
apt: pkg={{ item }} state=present | ||
with_items: | ||
- php5-fpm | ||
- php5-apcu | ||
- php5-mysqlnd | ||
- php5-json | ||
- php5-cli | ||
|
||
- name: Set php.ini display_errors | ||
lineinfile: dest=/etc/php5/fpm/php.ini line="display_errors = On" regexp="^display_errors =" state=present | ||
notify: restart php5-fpm | ||
|
||
- name: Set php.ini default_timezone | ||
lineinfile: dest=/etc/php5/fpm/php.ini line="date.timezone = America/New_York" regexp="date.timezone =" state=present | ||
notify: restart php5-fpm | ||
|
||
- name: Magically append vagrant-specific config.php for DevAAC | ||
lineinfile: dest=/etc/php5/fpm/php.ini line="^auto_prepend_file =" regexp="auto_prepend_file = /home/vagrant/config.php" state=present | ||
notify: restart php5-fpm | ||
|
||
- name: Disable default pool | ||
command: mv /etc/php5/fpm/pool.d/www.conf /etc/php5/fpm/pool.d/www.disabled creates=/etc/php5/fpm/pool.d/www.disabled | ||
notify: restart php5-fpm | ||
|
||
- name: Copy php5-fpm configuration | ||
template: src=templates/php5-fpm-pool.conf dest=/etc/php5/fpm/pool.d/DevAAC.conf | ||
notify: restart php5-fpm | ||
|
||
- name: Start php5-fpm Service | ||
service: name=php5-fpm state=started enabled=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
- name: Download latest TFS from git | ||
git: repo=https://github.com/otland/forgottenserver.git | ||
dest=/home/vagrant/forgottenserver | ||
|
||
- name: Create database user for TFS | ||
mysql_user: name=forgottenserver password="" priv=forgottenserver.*:ALL state=present check_implicit_admin=yes | ||
|
||
- name: Create database for TFS | ||
mysql_db: name=forgottenserver state=present | ||
|
||
- name: Import MySQL database from schema.sql | ||
shell: (cat /home/vagrant/forgottenserver/schema.sql | mysql forgottenserver) && touch /home/vagrant/.imported_db | ||
creates=/home/vagrant/.imported_db | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
// AT MINIMUM UNCOMMENT AND CONFIGURE ONE OF THE FOLLOWING OPTIONS: | ||
|
||
// OPTION ONE: READ MYSQL CONFIG FROM config.lua - RECOMMENDED | ||
define('TFS_CONFIG', '/home/vagrant/forgottenserver/config.lua'); | ||
|
||
// OPTION TWO: SPECIFY MYSQL CONNECTION DETAILS HERE | ||
// define('TFS_CONFIG', array('mysqlHost' => '127.0.0.1', 'mysqlDatabase' => 'tfs', 'mysqlUser' => 'tfs', 'mysqlPass' => 'tfs')); | ||
// THIS OPTION IS DISCOURAGED AS SOME CODE MIGHT DEPEND ON OTHER VALUES FROM TFS CONFIG | ||
|
||
// IF YOU WANT TO CHANGE SOMETHING ELSE, BE SMART AND FOLLOW THE PATTERN | ||
define('CORS_ALLOW_ORIGIN', '*'); | ||
define('ENABLE_DEBUG', true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
server { | ||
listen 80 default_server; | ||
server_name _; | ||
root /vagrant/public_html; | ||
|
||
client_max_body_size 64M; | ||
|
||
location / { | ||
index index.html index.php; | ||
try_files $uri $uri/ /index.php; | ||
} | ||
|
||
location ~* \.(gif|jpg|jpeg|png|css|js)$ { | ||
expires -1; | ||
} | ||
|
||
location ~ \.php$ { | ||
try_files $uri =404; | ||
fastcgi_split_path_info ^(.+\.php)(/.+)$; | ||
fastcgi_index index.php; | ||
fastcgi_pass unix:/var/run/php5-fpm_DevAAC.sock; | ||
fastcgi_param SCRIPT_FILENAME | ||
$document_root$fastcgi_script_name; | ||
include fastcgi_params; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[DevAAC] | ||
listen = /var/run/php5-fpm_DevAAC.sock | ||
listen.owner = www-data | ||
listen.group = www-data | ||
listen.mode = 0660 | ||
user = vagrant | ||
group = vagrant | ||
pm = dynamic | ||
pm.max_children = 10 | ||
pm.start_servers = 1 | ||
pm.min_spare_servers = 1 | ||
pm.max_spare_servers = 3 | ||
pm.max_requests = 500 | ||
#php_admin_value[open_basedir] = /vagrant/:/tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters