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

Commit

Permalink
Merge branch 'release/1.3.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Rombauts committed Sep 3, 2015
2 parents 8d0dc7b + e28f516 commit 1c9bacc
Show file tree
Hide file tree
Showing 42 changed files with 1,649 additions and 82 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ in 1.x versions.
To get the diff for a specific change, go to https://github.com/joomlatools/joomla-vagrant/commit/xxx where xxx is the change hash.
To view the diff between two versions, go to https://github.com/joomlatools/joomla-vagrant/compare/v1.0.0...v1.0.1

* 1.3.1 (2015-09-03)
* Added - Support for PHP7
* Added - Support for [joomla-platform](https://github.com/joomlatools/joomla-platform) installations
* Added - Installed git-ftp
* Added - `box server:restart` command
* Improved - Use the async option when mounting NFS on Linux
* Improved - Link to both site and administrator in dashboard listing
* Fixed - Allow value _0_ to be written to PHP ini using `box php:ini`
* Fixed - Use bison 2.4 when building PHP 5.4.19+
* Fixed - Point to global apc-dashboard.php file in `/apc` alias

* 1.3.0 (2015-06-01)
* Improved - Upgraded default PHP to 5.5
* Improved - Upgraded OS and stack: Ubuntu 14.04, Apache 2.4, Puppet 3.4, Ruby 2.2
Expand Down
65 changes: 63 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ Getting started
1. Once you have installed the box as described above, SSH into the box:
```
```
vagrant ssh
```
```
1. Create your first Joomla website with this command:
Expand All @@ -52,6 +52,18 @@ joomla site:create mysite
1. You can now symlink and install your custom extensions into the site, manage PHP versions and much more. Head over to our [documentation pages](http://developer.joomlatools.com/tools/vagrant/introduction.html) to learn more about the box and its possibilities.
Sharing access to the box
-------------------------
One of the great features of Vagrant is [Vagrant Share](https://docs.vagrantup.com/v2/share/index.html). Please note that Vagrant Share requires an account with [HashiCorp's Atlas](https://atlas.hashicorp.com/).
To share access, run this command and follow the instructions:
```
vagrant share --http 80
```
For more options please refer to the [Vagrant docs](https://docs.vagrantup.com/v2/share/index.html).
For hacking on the box
----------------------
Expand Down Expand Up @@ -84,6 +96,55 @@ vagrant up
vagrant provision
```
Building and releasing using Packer
-----------------------------------
We use [Packer](https://www.packer.io/) to automatically build and deploy the box on [Atlas](https://atlas.hashicorp.com/joomlatools/box). To launch a build, follow these steps:
1. Clone this repository:
```
git clone https://github.com/joomlatools/joomla-vagrant.git
```
1. Install [Packer](https://www.packer.io/)
1. Generate a new token for your [Atlas account](https://atlas.hashicorp.com/settings/tokens).
1. Make the token available to Packer in the current terminal session:
```
export ATLAS_TOKEN=<token>
```
1. Now edit the `packer.json` file. Look for the current version and increase the version number.
The version number is defined in the post-processor section and can be found at the bottom of the file. It looks like this:
```js
"post-processors": [
...
{
"type": "atlas",
...
"metadata": {
"provider": "virtualbox",
"version": "1.3.0"
}
}]
]
```
If you are not updating the `joomlatools/box` but want to create your own version, be sure to replace all occurences of `joomlatools/box` with your account and box name in the `packer.json` file.
*Note* A build cannot overwrite an existing version. If you want to replace an existing version, you will have to delete it on Atlas first!
1. Commit the change and push back to GitHub.
1. Instruct packer to start the build:
```
packer push packer.json
```
You can follow-up the build progress on the [Builds](https://atlas.hashicorp.com/builds) page. Once it's finished, the new version will be automatically available on the [your boxes](https://atlas.hashicorp.com/vagrant) section. Add a changelog and release it to the public.
Reporting issues
----------------
Expand Down
2 changes: 1 addition & 1 deletion Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Vagrant.configure("2") do |config|
if CONF.has_key?('synced_folders')
CONF['synced_folders'].each { |target, source|
if source
config.vm.synced_folder source, target, :nfs => CONF['nfs'], :create => true
config.vm.synced_folder source, target, :nfs => CONF['nfs'], :linux__nfs_options => ['rw', 'no_subtree_check', 'all_squash','async'], :create => true
end
}

Expand Down
2 changes: 1 addition & 1 deletion Vagrantfile.pkg
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Vagrant.configure("2") do |config|
if CONF.has_key?('synced_folders')
CONF['synced_folders'].each { |target, source|
if source
config.vm.synced_folder source, target, :nfs => CONF['nfs'], :create => true
config.vm.synced_folder source, target, :nfs => CONF['nfs'], :linux__nfs_options => ['rw', 'no_subtree_check', 'all_squash','async'], :create => true
end
}

Expand Down
6 changes: 3 additions & 3 deletions packer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
"disk_size": 8000,
"guest_os_type": "Ubuntu_64",
"http_directory": "packer/http",
"iso_checksum": "83aabd8dcf1e8f469f3c72fff2375195",
"iso_checksum": "9e5fecc94b3925bededed0fdca1bd417",
"iso_checksum_type": "md5",
"iso_url": "http://releases.ubuntu.com/14.04/ubuntu-14.04.2-server-amd64.iso",
"iso_url": "http://releases.ubuntu.com/14.04/ubuntu-14.04.3-server-amd64.iso",
"ssh_username": "vagrant",
"ssh_password": "vagrant",
"ssh_port": 22,
Expand Down Expand Up @@ -90,7 +90,7 @@
"artifact_type": "vagrant.box",
"metadata": {
"provider": "virtualbox",
"version": "1.3.0"
"version": "1.3.1"
}
}]
]
Expand Down
13 changes: 12 additions & 1 deletion puppet/manifests/default.pp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
require => Apt::Key['4F4EA0AAE5267A6C']
}

apt::ppa { 'ppa:resmo/git-ftp': }

include '::gnupg'
gnupg_key { 'gpg-rvm-signature':
ensure => present,
Expand All @@ -40,7 +42,7 @@
'git-core',
'unzip'
]:
ensure => 'installed',
ensure => 'installed'
}

class apache::certificate {
Expand Down Expand Up @@ -332,4 +334,13 @@

class { 'phpmetrics':
require => [Class['composer'], Class['scripts']]
}

package { 'git-ftp':
require => Apt::Ppa['ppa:resmo/git-ftp']
}

swap_file::files { 'default':
ensure => present,
swapfilesize => '512 MB'
}
4 changes: 4 additions & 0 deletions puppet/modules/apache/templates/custom.conf.erb
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
EnableSendfile Off

<Directory "/var/www">
AllowOverride All
</Directory>
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
ErrorLog <%= scope.lookupvar('apache::log_dir') %>/<%= @name %>-error_log
CustomLog <%= scope.lookupvar('apache::log_dir') %>/<%= @name %>-access_log combined

Alias /apc /home/vagrant/scripts/apc.php
Alias /apc /home/vagrant/scripts/apc-dashboard.php
Alias /phpinfo /home/vagrant/scripts/phpinfo.php

Alias /dashboard /home/vagrant/scripts/dashboard
Expand Down
43 changes: 38 additions & 5 deletions puppet/modules/box/files/scripts/Command/Php/Ini.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class Ini extends Command
Expand All @@ -14,12 +15,16 @@ protected function configure()
->setDescription('Get or set PHP config directive for the currently active PHP version')
->addArgument(
'key',
InputArgument::REQUIRED,
'Name of the directive'
InputArgument::OPTIONAL,
'Name of the directive to lookup or update'
)->addArgument(
'value',
InputArgument::OPTIONAL,
'Value to set'
'New value'
)->addOption(
'list-files',
'l',
InputOption::VALUE_NONE
);
}

Expand All @@ -28,6 +33,14 @@ protected function execute(InputInterface $input, OutputInterface $output)
$key = $input->getArgument('key');
$value = $input->getArgument('value');

if ($input->getOPtion('list-files') || empty($key)) {
$this->_listIniFiles();
}

if (empty($key)) {
return;
}

$current = $this->_getConfigValue($key);

if ($current === false)
Expand All @@ -37,6 +50,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
return;
}

if (empty($current)) {
$current = 'no value (0 or empty string)';
}

if (!is_null($value))
{
$ini = $this->_getIniOverride();
Expand All @@ -51,7 +68,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
else $output->write('Error: failed to find PHP\'s additional config directory (config-file-scan-dir)!');
}
else $output->writeln($current);
else $output->writeln("$key value is $current");
}

protected function _getConfigValue($key)
Expand Down Expand Up @@ -85,6 +102,22 @@ protected function _getIniOverride()
return false;
}

protected function _listIniFiles()
{
$filelist = `php -r 'echo php_ini_scanned_files();'`;

if (strpos($filelist, ','))
{
$files = explode(',', $filelist);

foreach ($files as $file) {
echo trim($file) . PHP_EOL;
}
}

return false;
}

protected function _updateIni($ini, $key, $value)
{
$values = parse_ini_file($ini);
Expand All @@ -93,7 +126,7 @@ protected function _updateIni($ini, $key, $value)
$string = '';
foreach($values as $k => $v)
{
if (!empty($v)) {
if (!empty($v) || $v === '0') {
$string .= "$k = $v" . PHP_EOL;
}
}
Expand Down
24 changes: 24 additions & 0 deletions puppet/modules/box/files/scripts/Command/Server/Restart.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
namespace Command\Server;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class Restart extends Command
{
protected function configure()
{
$this->setName('server:restart')
->setDescription('Restart Apache and MySQL');
}

protected function execute(InputInterface $input, OutputInterface $output)
{
`sudo service apache2 restart 2>&1 1> /dev/null`;
`sudo service mysql restart 2>&1 1> /dev/null`;

$output->writeln("Server has been restarted");
}
}
17 changes: 4 additions & 13 deletions puppet/modules/box/files/scripts/Command/Server/Stop.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,14 @@ class Stop extends Command
protected function configure()
{
$this->setName('server:stop')
->setDescription('Stop Apache and MySQL')
->addOption(
'restart',
null,
InputOption::VALUE_NONE,
"Restart the services instead of stopping them."
);
->setDescription('Stop Apache and MySQL');
}

protected function execute(InputInterface $input, OutputInterface $output)
{
$task = $input->getOption('restart') ? 'restart' : 'stop';
$txt = $task == 'stop' ? 'stopped' : 'restarted';
`sudo service apache2 stop 2>&1 1> /dev/null`;
`sudo service mysql stop 2>&1 1> /dev/null`;

`sudo service apache2 $task 2>&1 1> /dev/null`;
`sudo service mysql $task 2>&1 1> /dev/null`;

$output->writeln("Server has been $txt");
$output->writeln("Server has been stopped");
}
}
1 change: 1 addition & 0 deletions puppet/modules/box/files/scripts/box
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ $application->add(new Command\Apc\Clear());
$application->add(new Command\Xdebug\Enable());
$application->add(new Command\Xdebug\Disable());

$application->add(new Command\Server\Restart());
$application->add(new Command\Server\Start());
$application->add(new Command\Server\Stop());

Expand Down
Loading

0 comments on commit 1c9bacc

Please sign in to comment.