forked from sillsdev/web-languageforge
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature/deploy: Add ansible playbook and vagrant configuration
- See README_DEVELOPERS.md for details.
- Loading branch information
1 parent
14a331d
commit 352cc87
Showing
25 changed files
with
1,401 additions
and
13 deletions.
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
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 @@ | ||
[submodule "deploy/roles_common"] | ||
path = deploy/roles_common | ||
url = https://github.com/sillsdev/ops-ansible-common-roles | ||
branch = master | ||
[submodule "deploy/roles/apache_config"] | ||
path = deploy/roles/apache_config | ||
url = https://github.com/saygoweb/ansible-role-apache.git | ||
branch = master-our |
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 |
---|---|---|
@@ -1,17 +1,33 @@ | ||
# web-scriptureforge / web-languageforge # | ||
# web-languageforge / web-scriptureforge # | ||
|
||
## Building with gulp | ||
Although [web-languageforge](https://github.com/sillsdev/web-languageforge) and [web-scriptureforge](https://github.com/sillsdev/web-scriptureforge) represent different websites, they have the same code base but are stored in seperate repositories for the purpose of version control and issue tracking. Since they are related repos it is easy to merge from one to the other. | ||
|
||
(For installation of npm see https://github.com/nodesource/distributions) | ||
## Installation ## | ||
|
||
Install gulp and dependencies by running | ||
First clone this repository. From your *home* folder... | ||
|
||
npm install gulp gulp-util async gulp-livereload tiny-lr | ||
```` | ||
mkdir src | ||
cd src | ||
git clone https://github.com/sillsdev/web-languageforge xForge --recurse-submodules | ||
cd xForge/deploy | ||
ansible-playbook -i hosts dev.yml --limit localhost -K | ||
```` | ||
|
||
Afterwards you can build by running (from the root directory of the source tree): | ||
> The `--recurse-submodules` is used to fetch many of the Ansible roles used by the Ansible playbooks in the deploy folder. | ||
gulp | ||
Install the php packages, this can take awhile. Note that you must have [composer](https://getcomposer.org/) and [bower](http://bower.io/) installed to do this. | ||
|
||
To install the mongodb databases locally, run: | ||
``` | ||
cd ../src | ||
composer install | ||
bower install | ||
``` | ||
|
||
gulp copy-prod-db | ||
Install the node packages. We're using [gulp](http://gulpjs.com/) as our build runner which requires node and is available as a node package. | ||
|
||
```` | ||
npm install | ||
```` | ||
|
||
Further guidance can be found in our [README_DEVELOPERS](README_DEVELOPERS.md) |
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,107 @@ | ||
# Developer Information # | ||
|
||
## Recommended Development Environment ## | ||
|
||
Our recommended development environment for web development is Linux Mint. The easiest way to get setup is to use the Ansible assisted setup [described here](https://github.com/sillsdev/ops-devbox). | ||
|
||
Among other things this setup will ensure that you have: | ||
|
||
* A working *nodejs*, and *npm*. | ||
* A globally installed *gulp* and *bower*. | ||
* A globally installed *composer*. | ||
|
||
## Development Environment ## | ||
|
||
Your development environment can be setup using Ansible. Ansible Playbooks are provided that will install and configure the LAMP stack; installing and configuring Apache, PHP, and MongoDB. | ||
|
||
* The apache virtual host is created. | ||
* A MongoDB document store created with appropriate user and permissions granted. | ||
* The */etc/hosts* file is updated to point languageforge.local and scriptureforge.local to localhost. | ||
|
||
### LAMP Stack Setup ### | ||
Choose either the **Vagrant VM Setup** or the **Local Linux Development Setup**. The Vagrant Setup is definitely easier as it always installs from a clean slate on a new virtual box. | ||
|
||
We recommend doing development on your development machine directly rather than using Vagrant. This approach will make your page loads approximately 50 times faster. In my tests 100 ms (local) vs 5000 ms (Vagrant / Virtualbox). The reason for this is that Virtualbox gives access to the php files via the VirtualBox shared folder feature. This is notoriously slow. | ||
|
||
#### Ansible Setup #### | ||
|
||
For either **Vagrant VM Setup** or **Local Linux Development Setup**, merge the contents of `deploy/ansible.cfg.defaults` into `/etc/ansible/ansible.cfg`. | ||
|
||
#### Vagrant VM Setup #### | ||
|
||
Change the variable *mongo_path: /var/lib/mongodb* in `deploy/dev.yml`, i.e. uncomment line 10 and comment line 8. | ||
|
||
```` | ||
cd deploy | ||
vagrant up --provision | ||
```` | ||
|
||
You will need to manually edit your `/etc/hosts` file such that *default.local*, *languageforge.local* and *scriptureforge.local* map to *192.168.33.10*. | ||
|
||
```` | ||
192.168.33.10 default.local | ||
192.168.33.10 languageforge.local | ||
192.168.33.10 scriptureforge.local | ||
```` | ||
|
||
The Vagrant configuration uses Ansible to provision the box. | ||
|
||
#### Local Linux Development Setup #### | ||
|
||
The Ansible configuration used for the Vagrant setup can also be used to setup your local linux development machine. | ||
|
||
Change the variable *mongo_path: /hddlinux/mongodb* in `deploy/dev.yml`, i.e. uncomment line 8 and comment line 10 (or whatever is appropriate on your system, its best to have mongo on you HDD rather than SDD). | ||
|
||
```` | ||
cd deploy | ||
ansible-playbook -i hosts playbook.yml --limit localhost -K | ||
```` | ||
|
||
## Testing ## | ||
|
||
### PHP Unit Tests ### | ||
|
||
Unit testing currently uses [SimpleTest](http://www.simpletest.org/). Browse to [default.local/test/php](http://default.local/test/php/) and click [AllTest.php](http://default.local/test/php/AllTests.php). Browse to sub-folders to narrow tests. | ||
|
||
### End-to-End (E2E) Tests ### | ||
|
||
#### E2E Test Install #### | ||
|
||
Install **webdriver-manager** globally, then install **webdriver**: | ||
|
||
```` | ||
sudo npm install -g webdriver-manager | ||
sudo webdriver-manager update --standalone | ||
```` | ||
|
||
#### E2E Test Run #### | ||
|
||
First start **webdriver** in one terminal: | ||
|
||
```` | ||
webdriver-manager start | ||
```` | ||
|
||
Then run tests in another terminal: | ||
|
||
```` | ||
cd test/app | ||
sh rune2eLF.sh | ||
```` | ||
to test in on the **languageforge** site or run `sh rune2eSF.sh` to test on the **scriptureforge** site. Browse to sub-folders to narrow tests. | ||
|
||
## Building with gulp ## | ||
|
||
(For installation of npm see https://github.com/nodesource/distributions) | ||
|
||
Install gulp and dependencies by running | ||
|
||
npm install gulp gulp-util async gulp-livereload tiny-lr | ||
|
||
Afterwards you can build by running (from the root directory of the source tree): | ||
|
||
gulp | ||
|
||
To install the mongodb databases locally, run: | ||
|
||
gulp copy-prod-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,54 @@ | ||
# -*- 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| | ||
|
||
# Every Vagrant virtual environment requires a box to build off of. | ||
config.vm.box = "opscode-debian-7.8-x64" | ||
|
||
# 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://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_debian-7.8_chef-provisionerless.box" | ||
|
||
config.vm.define "dev" | ||
|
||
# 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" | ||
|
||
# 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/virtual/default_local", | ||
id: "vagrant-root", | ||
owner: "vagrant", | ||
group: "www-data", | ||
mount_options: ["dmode=775,fmode=664"] | ||
|
||
# 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, "--memory", "1024"] | ||
# end | ||
# | ||
|
||
config.vm.provision :ansible do |ansible| | ||
ansible.playbook = 'playbook.yml' | ||
ansible.extra_vars = { ansible_ssh_user: 'vagrant', vagrant: true } | ||
ansible.verbose = 'v' | ||
# ansible.vault_password_file was added in vagrant 1.6 so using raw_arguments for now CP 2015-07 | ||
# ansible.vault_password_file = '~/.ansible_vault_password' | ||
# ansible.raw_arguments = [ '--vault-password-file', '~/.ansible_vault_password' ] | ||
end | ||
|
||
end |
Oops, something went wrong.