diff --git a/CHANGELOG.md b/CHANGELOG.md index 6465e79..e01638b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,27 @@ in 1.x versions. To get the diff for a specific change, go to https://github.com/joomlatools/joomlatools-vagrant/commit/xxx where xxx is the change hash. To view the diff between two versions, go to https://github.com/joomlatools/joomlatools-vagrant/compare/v1.0.0...v1.0.1 +* 1.6.0 (2020-01-24) + * Improved - Upgrade to Ubuntu 18.04 LTS [#111](https://github.com/joomlatools/joomlatools-vagrant/issues/111) + * Improved - Use PHP 7.3 by default [#165](https://github.com/joomlatools/joomlatools-vagrant/issues/165) + * Improved - Updated PHPManager EXTRA_CONFIGURE_ARGUMENTS variable [#130](https://github.com/joomlatools/joomlatools-vagrant/issues/130) + * Improved - Use local phpmanager dependencies installer during development [#154](https://github.com/joomlatools/joomlatools-vagrant/issues/154) + * Improved - Run two vagrant boxes simultaneously [#37](https://github.com/joomlatools/joomlatools-vagrant/issues/37) + * Improved - Use rbenv and update default Ruby version to 2.6.5 [#166](https://github.com/joomlatools/joomlatools-vagrant/issues/166) + * Improved - Make mount options configurable [#77](https://github.com/joomlatools/joomlatools-vagrant/issues/77) + * Improved - Set joomla.box as default Nginx vhost [#117](https://github.com/joomlatools/joomlatools-vagrant/issues/117) + * Improved - Update NodeJS version [#138](https://github.com/joomlatools/joomlatools-vagrant/issues/138) + * Added - Install YellowLab tools CLI [#157](https://github.com/joomlatools/joomlatools-vagrant/issues/157) + * Added - Install MailHog instead of MailCatcher [#87](https://github.com/joomlatools/joomlatools-vagrant/issues/87) + * Added - Use ngrok to share websites [#88](https://github.com/joomlatools/joomlatools-vagrant/issues/88) + * Added - Enable http/2 [#146](https://github.com/joomlatools/joomlatools-vagrant/issues/146) + * Added - Install Cockpit [#139](https://github.com/joomlatools/joomlatools-vagrant/issues/139) + * Added - Install folioshell [#134](https://github.com/joomlatools/joomlatools-vagrant/issues/134) + * Fixed - Installing packages requires user input [#156](https://github.com/joomlatools/joomlatools-vagrant/issues/156) + * Fixed - Incorrect host permissions over site files [#150](https://github.com/joomlatools/joomlatools-vagrant/issues/150) + * Fixed - Downgrade phing [#133](https://github.com/joomlatools/joomlatools-vagrant/issues/133) + * Fixed - Make sure static assets are revalidated [#136](https://github.com/joomlatools/joomlatools-vagrant/issues/136) + * 1.5.1 (2018-06-19) * Added - Install php-ldap extension [#123](https://github.com/joomlatools/joomlatools-vagrant/issues/123) * Added - Install `tmate` to share terminal [#120](https://github.com/joomlatools/joomlatools-vagrant/issues/120) diff --git a/README.md b/README.md index eb9b3f4..7f0de79 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ For more details refer to our [FAQ](https://www.joomlatools.com/developer/tools/ Open source is all about collaboration, so there will be times you will want to share your work with others. Luckily for you, we've pre-configured [ngrok](https://ngrok.com/) to run within the vagrant box. -We've also created a new box command `box share:site` to help you share your websites. +We've also created a new box command `box share` to help you share your websites. ### Terminal diff --git a/Vagrantfile.pkg b/Vagrantfile.pkg index 48e9706..76bee00 100644 --- a/Vagrantfile.pkg +++ b/Vagrantfile.pkg @@ -15,7 +15,7 @@ _config = { }, "nfs" => !!(RUBY_PLATFORM =~ /darwin/ || RUBY_PLATFORM =~ /linux/), "virtualbox" => { - "name" => "joomlatools-box-build", + "name" => "joomlatools-box", "memory" => 1024, "cpus" => 1, "natdnshostresolver1" => "on", diff --git a/packer.json b/packer.json index 5e1f514..96e0dcf 100644 --- a/packer.json +++ b/packer.json @@ -1,8 +1,8 @@ { "variables": { - "guest_additions_url": "https://download.virtualbox.org/virtualbox/5.2.12/VBoxGuestAdditions_5.2.12.iso", - "guest_additions_sha256": "b81d283d9ef88a44e7ac8983422bead0823c825cbfe80417423bd12de91b8046", - "version": "1.5.1" + "guest_additions_url": "https://download.virtualbox.org/virtualbox/6.0.14/VBoxGuestAdditions_6.0.14.iso", + "guest_additions_sha256": "cb82f43a71f91a50b97aa27063c5c8743772a623eb0073ab8daf77e840d73eb1", + "version": "1.6.0" }, "push": { "name": "joomlatools/box", @@ -28,8 +28,9 @@ " keyboard-configuration/layout=USA", " keyboard-configuration/variant=USA", " locale=en_US", - " netcfg/get_hostname=joomlatools", - " netcfg/get_domain=vagrantup.com", + " netcfg/get_domain=vm", + " netcfg/get_hostname=vagrant", + " grub-installer/bootdev=/dev/sda", " noapic", " preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg", " -- ", @@ -41,9 +42,9 @@ "guest_additions_url": "{{user `guest_additions_url`}}", "guest_additions_sha256": "{{user `guest_additions_sha256`}}", "http_directory": "packer/http", - "iso_checksum": "07e4bb5569814eab41fafac882ba127893e3ff0bdb7ec931c9b2d040e3e94e7a", + "iso_checksum": "7d8e0055d663bffa27c1718685085626cb59346e7626ba3d3f476322271f573e", "iso_checksum_type": "sha256", - "iso_url": "http://old-releases.ubuntu.com/releases/14.04.4/ubuntu-14.04.4-server-amd64.iso", + "iso_url": "http://cdimage.ubuntu.com/ubuntu/releases/bionic/release/ubuntu-18.04.3-server-amd64.iso", "ssh_username": "vagrant", "ssh_password": "vagrant", "ssh_port": 22, @@ -68,14 +69,15 @@ }, { "type": "file", - "source": "puppet/hiera", + "source": "puppet/environments", "destination": "/tmp/" }, { "type": "puppet-masterless", - "manifest_file": "puppet/manifests", - "module_paths": ["puppet/modules/common", "puppet/modules/custom"], - "hiera_config_path": "puppet/hiera-packer.yaml", + "manifest_file": "puppet/environments/box/manifests", + "module_paths": ["puppet/modules", "puppet/environments/box/modules"], + "extra_arguments": ["--environmentpath=/tmp/environments/", "--environment=box"], + "hiera_config_path": "puppet/environments/box/hiera.yaml", "facter": { "fqdn": "joomlatools.box" } @@ -84,6 +86,7 @@ "type": "shell", "execute_command": "echo 'vagrant'|sudo -S sh '{{.Path}}'", "scripts": [ + "packer/scripts/update.sh", "packer/scripts/cleanup.sh", "packer/scripts/zerodisk.sh" ] diff --git a/packer/http/preseed.cfg b/packer/http/preseed.cfg index 202c851..39a3dc3 100644 --- a/packer/http/preseed.cfg +++ b/packer/http/preseed.cfg @@ -5,11 +5,11 @@ d-i clock-setup/utc-auto boolean true d-i finish-install/reboot_in_progress note d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean true +d-i partman-auto/disk string /dev/sda d-i partman-auto-lvm/guided_size string max d-i partman-auto/choose_recipe select atomic d-i partman-auto/method string lvm d-i partman-lvm/confirm boolean true -d-i partman-lvm/confirm boolean true d-i partman-lvm/confirm_nooverwrite boolean true d-i partman-lvm/device_remove_lvm boolean true d-i partman/choose_partition select finish @@ -17,20 +17,26 @@ d-i partman/confirm boolean true d-i partman/confirm_nooverwrite boolean true d-i partman/confirm_write_new_label boolean true +d-i console-setup/ask_detect boolean false +d-i keyboard-configuration/layoutcode string us +d-i keyboard-configuration/modelcode string pc105 +d-i debian-installer/locale string en_US.UTF-8 + # Default user d-i passwd/user-fullname string vagrant d-i passwd/username string vagrant d-i passwd/user-password password vagrant d-i passwd/user-password-again password vagrant -d-i passwd/username string vagrant +d-i user-setup/allow-password-weak boolean true +d-i user-setup/encrypt-home boolean false +d-i passwd/user-default-groups vagrant sudo +d-i passwd/user-uid string 900 -# Minimum packages (see postinstall.sh) -d-i pkgsel/include string openssh-server +# Minimum packages +d-i pkgsel/include string openssh-server nfs-common d-i pkgsel/install-language-support boolean false d-i pkgsel/update-policy select none -d-i pkgsel/upgrade select none +d-i pkgsel/upgrade select full-upgrade d-i time/zone string UTC -d-i user-setup/allow-password-weak boolean true -d-i user-setup/encrypt-home boolean false -tasksel tasksel/first multiselect standard, ubuntu-server +tasksel tasksel/first multiselect standard, ubuntu-server \ No newline at end of file diff --git a/packer/scripts/cleanup.sh b/packer/scripts/cleanup.sh index 5fcf47b..316c58a 100644 --- a/packer/scripts/cleanup.sh +++ b/packer/scripts/cleanup.sh @@ -1,7 +1,7 @@ #!/bin/bash echo "removing puppet" -sudo apt-get -y purge --auto-remove puppet-common +sudo apt-get -y purge --auto-remove puppet-agent echo "cleaning up apt" apt-get -y autoremove diff --git a/packer/scripts/puppet.sh b/packer/scripts/puppet.sh index c17dd37..9e35336 100644 --- a/packer/scripts/puppet.sh +++ b/packer/scripts/puppet.sh @@ -2,11 +2,14 @@ set -e -apt-get install -y software-properties-common python-software-properties +apt-get install -y software-properties-common cd /tmp -wget http://apt.puppetlabs.com/puppetlabs-release-trusty.deb -dpkg -i puppetlabs-release-trusty.deb +wget https://apt.puppetlabs.com/puppet5-release-bionic.deb +dpkg -i puppet5-release-bionic.deb apt-get update -apt-get install -y puppet-common +apt-get install -y puppet + +# Disable Puppet Agent +systemctl disable puppet diff --git a/packer/scripts/serverspec.sh b/packer/scripts/serverspec.sh index 779e913..051783e 100644 --- a/packer/scripts/serverspec.sh +++ b/packer/scripts/serverspec.sh @@ -2,14 +2,9 @@ set -e -if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then - source "$HOME/.rvm/scripts/rvm" -else - echo "ERROR: An RVM installation was not found for user $USER" - exit 1 -fi +export PATH=$PATH:/home/vagrant/.gem/ruby/2.5.0/bin/ -gem install bundler --no-ri --no-rdoc +sudo gem install bundler --no-document cd /tmp/tests @@ -17,4 +12,4 @@ sudo chown vagrant:www-data /var/www sudo chmod a=rx,ug+w /var/www bundle install -BACKEND=exec bundle exec rake spec \ No newline at end of file +BACKEND=exec bundle exec rake spec diff --git a/packer/scripts/update.sh b/packer/scripts/update.sh new file mode 100644 index 0000000..b073c8a --- /dev/null +++ b/packer/scripts/update.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +echo "installing package updates" +sudo apt-get -y upgrade \ No newline at end of file diff --git a/puppet/Puppetfile b/puppet/Puppetfile index da9e697..09a4156 100644 --- a/puppet/Puppetfile +++ b/puppet/Puppetfile @@ -1,6 +1,7 @@ forge 'https://forgeapi.puppetlabs.com' mod 'camptocamp-openssl', '1.10.0' +mod 'jdowning-rbenv', '2.5.0' mod 'petems-swap_file', '4.0.0' mod 'puppetlabs-apache', '5.0.0' mod 'puppetlabs-apt', '6.2.1' @@ -9,4 +10,4 @@ mod 'puppetlabs-mysql', '7.0.0' mod 'puppetlabs-stdlib', '4.25.1' mod 'puppet-nodejs', '7.0.1' mod 'puppet-php', '6.0.2' -mod 'puppet-ssh_keygen', '3.0.1' \ No newline at end of file +mod 'puppet-ssh_keygen', '3.0.1' diff --git a/puppet/Puppetfile.lock b/puppet/Puppetfile.lock index 69b533b..b889d3f 100644 --- a/puppet/Puppetfile.lock +++ b/puppet/Puppetfile.lock @@ -7,6 +7,8 @@ FORGE puppetlabs-stdlib (< 6.0.0, >= 3.2.0) herculesteam-augeasproviders_sysctl (2.3.1) herculesteam-augeasproviders_core (< 3.0.0, >= 2.4.0) + jdowning-rbenv (2.5.0) + puppetlabs-stdlib (< 7.0.0, >= 4.1.0) petems-swap_file (4.0.0) herculesteam-augeasproviders_core (< 3.0.0, >= 2.1.0) herculesteam-augeasproviders_sysctl (< 3.0.0, >= 2.1.0) @@ -42,6 +44,7 @@ FORGE DEPENDENCIES camptocamp-openssl (= 1.10.0) + jdowning-rbenv (= 2.5.0) petems-swap_file (= 4.0.0) puppet-nodejs (= 7.0.1) puppet-php (= 6.0.2) diff --git a/puppet/environments/box/manifests/default.pp b/puppet/environments/box/manifests/default.pp index 28fc6b3..fc8261c 100644 --- a/puppet/environments/box/manifests/default.pp +++ b/puppet/environments/box/manifests/default.pp @@ -2,4 +2,4 @@ Exec { path => [ '/bin/', '/sbin/', '/usr/bin/', '/usr/sbin/', '/usr/local/bin/' ], timeout => 900 } File { owner => 0, group => 0, backup => false } -$box_version = '1.5.1' \ No newline at end of file +$box_version = '1.6.0' \ No newline at end of file diff --git a/puppet/environments/box/modules/profiles/files/box/phpmanager/scripts/phpmanager b/puppet/environments/box/modules/profiles/files/box/phpmanager/scripts/phpmanager index 90229ab..c84caa0 100755 --- a/puppet/environments/box/modules/profiles/files/box/phpmanager/scripts/phpmanager +++ b/puppet/environments/box/modules/profiles/files/box/phpmanager/scripts/phpmanager @@ -132,7 +132,7 @@ command_use() { command_install $VERSION fi - sudo service php-fpm stop > /dev/null 2>&1 + sudo systemctl stop php-fpm > /dev/null 2>&1 # Install the binaries for BINARY in "${BINARIES[@]}" @@ -148,7 +148,7 @@ command_use() { sudo rm -f /opt/php/php-fpm.sock sudo ln -s "/run/php/${VERSION}-fpm.sock" /opt/php/php-fpm.sock - sudo service php-fpm start > /dev/null 2>&1 + sudo systemctl start php-fpm > /dev/null 2>&1 echo -e "Installed binaries. PHP version is now:\n" php -v @@ -295,7 +295,7 @@ command_restore() { exit 0 fi - sudo service php-fpm stop > /dev/null 2>&1 + sudo systemctl stop php-fpm > /dev/null 2>&1 for BINARY in "${BINARIES[@]}" do @@ -309,7 +309,7 @@ command_restore() { sudo rm -f /opt/php/php-fpm.sock sudo ln -s "/run/php/php7.3-fpm.sock" /opt/php/php-fpm.sock - sudo service php-fpm start > /dev/null 2>&1 + sudo systemctl start php-fpm > /dev/null 2>&1 echo -e "Restored PHP, version is now: \n" php -v diff --git a/puppet/environments/box/modules/profiles/files/box/scripts/data/navigation.php b/puppet/environments/box/modules/profiles/files/box/scripts/data/navigation.php index f82947d..66eb55c 100644 --- a/puppet/environments/box/modules/profiles/files/box/scripts/data/navigation.php +++ b/puppet/environments/box/modules/profiles/files/box/scripts/data/navigation.php @@ -54,5 +54,5 @@ $navigation['cockpit']['title'] = 'Cockpit'; $navigation['cockpit']['source'] = 'http://joomla.box/cockpit'; -$navigation['cockpit']['type'] = 'iframe'; +$navigation['cockpit']['type'] = 'page'; $navigation['cockpit']['status'] = 'active'; diff --git a/puppet/environments/box/modules/profiles/files/cockpit/login.min.html b/puppet/environments/box/modules/profiles/files/cockpit/login.min.html new file mode 100644 index 0000000..3819611 --- /dev/null +++ b/puppet/environments/box/modules/profiles/files/cockpit/login.min.html @@ -0,0 +1,776 @@ + + + + Loading... + + + + + + + + + + + + + +
+
+
+
+
+
+ + + +
+

+ +

+ +
+ + + + + + + +
+
+ + + + + + + \ No newline at end of file diff --git a/puppet/environments/box/modules/profiles/files/pimpmylog/config/config.user.d/syslog.json b/puppet/environments/box/modules/profiles/files/pimpmylog/config/config.user.d/syslog.json deleted file mode 100644 index 765d207..0000000 --- a/puppet/environments/box/modules/profiles/files/pimpmylog/config/config.user.d/syslog.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "syslog": { - "display": "syslog", - "tags": ["System Logs"], - "path": "/var/log/syslog", - "refresh": 10, - "max": 50, - "format": { - "regex": "|(.*?) ([0-9]{1,2}) ([0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}) ([a-zA-Z0-9_\\-\\.]{1,256}) ([A-Za-z0-9_\\-\/\\.]{1,32})\\[(.*?)\\]:(.*)|", - "match": { - "Date": 3, - "Source": 4, - "Tag_ID": 5, - "PID": 6, - "Message": 7 - }, - "types": { - "Date": "date:H:i:s", - "Source": "txt", - "Tag_ID": "txt", - "PID": "numeral", - "Message": "txt" - } - } - } -} \ No newline at end of file diff --git a/puppet/environments/box/modules/profiles/files/wetty/wetty.service b/puppet/environments/box/modules/profiles/files/wetty/wetty.service index 25e6b54..8ae7a25 100644 --- a/puppet/environments/box/modules/profiles/files/wetty/wetty.service +++ b/puppet/environments/box/modules/profiles/files/wetty/wetty.service @@ -8,6 +8,8 @@ User=vagrant Group=vagrant WorkingDirectory=/home/vagrant/ ExecStart=/usr/local/bin/wetty -p 3000 --sshauth publickey,password --sshuser vagrant +Restart=on-failure +RestartSec=3 [Install] WantedBy=multi-user.target \ No newline at end of file diff --git a/puppet/environments/box/modules/profiles/manifests/box.pp b/puppet/environments/box/modules/profiles/manifests/box.pp index 843bc81..c88e050 100644 --- a/puppet/environments/box/modules/profiles/manifests/box.pp +++ b/puppet/environments/box/modules/profiles/manifests/box.pp @@ -24,6 +24,7 @@ override => 'All', additional_includes => ['/etc/apache2/joomla.box-include.conf'], access_log_env_var => '!dontlog', + notify => Service['httpd'], require => File['/etc/apache2/joomla.box-include.conf'] } @@ -41,6 +42,7 @@ override => 'All', additional_includes => ['/etc/apache2/joomla.box-include.conf'], access_log_env_var => '!dontlog', + notify => Service['httpd'], require => File['/etc/apache2/joomla.box-include.conf'] } diff --git a/puppet/environments/box/modules/profiles/manifests/box/cockpit.pp b/puppet/environments/box/modules/profiles/manifests/box/cockpit.pp index 7b4841f..4567603 100644 --- a/puppet/environments/box/modules/profiles/manifests/box/cockpit.pp +++ b/puppet/environments/box/modules/profiles/manifests/box/cockpit.pp @@ -1,6 +1,13 @@ class profiles::box::cockpit { - package { 'cockpit': } + file { ['/etc/cockpit', '/etc/cockpit/ws-certs.d']: + ensure => directory + } + + package { ['cockpit', 'cockpit-ws', 'cockpit-bridge', 'cockpit-dashboard', 'cockpit-networkmanager', 'cockpit-packagekit', 'cockpit-storaged', 'cockpit-system']: + ensure => '211-1~ubuntu18.04.1', + notify => [Service['cockpit'], File['/usr/share/cockpit/static/login.min.html']] + } ini_setting { 'Cockpit LoginTitle': ensure => present, @@ -9,7 +16,7 @@ setting => 'LoginTitle', value => $::fqdn, show_diff => true, - require => Package['cockpit'], + require => File['/etc/cockpit'], notify => Service['cockpit'] } @@ -20,7 +27,7 @@ setting => 'MaxStartups', value => 10, show_diff => true, - require => Package['cockpit'], + require => File['/etc/cockpit'], notify => Service['cockpit'] } @@ -31,13 +38,22 @@ setting => 'AllowUnencrypted', value => true, show_diff => true, - require => Package['cockpit'], + require => File['/etc/cockpit'], notify => Service['cockpit'] } service { 'cockpit': - ensure => 'running', - enable => true, - require => Package['cockpit'] + name => 'cockpit.socket', + ensure => 'running', + enable => true, + provider => 'systemd', + require => [Package['cockpit'], File['/etc/cockpit/ws-certs.d']] } + + file { '/usr/share/cockpit/static/login.min.html': + ensure => file, + source => "puppet:///modules/profiles/cockpit/login.min.html", + notify => Service['cockpit'] + } + } \ No newline at end of file diff --git a/puppet/environments/box/modules/profiles/manifests/box/tools.pp b/puppet/environments/box/modules/profiles/manifests/box/tools.pp index e1fb4a1..91d5c52 100644 --- a/puppet/environments/box/modules/profiles/manifests/box/tools.pp +++ b/puppet/environments/box/modules/profiles/manifests/box/tools.pp @@ -1,33 +1,9 @@ class profiles::box::tools { - exec {'install-capistrano-gem': - user => vagrant, - command => '/usr/bin/gem install --user-install --no-ri --no-rdoc capistrano', - environment => ['HOME=/home/vagrant'], - unless => 'test -x /home/vagrant/.gem/ruby/2.5.0/bin/cap', - path => ['/usr/bin/', '/bin/', '/home/vagrant/.gem/ruby/2.5.0/bin/'], - timeout => 900, - tag => ['rubygem'] - } - - exec {'install-bundler-gem': - user => vagrant, - command => 'gem install --user-install --no-ri --no-rdoc bundler', - environment => ['HOME=/home/vagrant'], - unless => 'test -x /home/vagrant/.gem/ruby/2.5.0/bin/bundle', - path => ['/usr/bin/', '/bin/', '/home/vagrant/.gem/ruby/2.5.0/bin/'], - timeout => 900, - tag => ['rubygem'] - } - - exec {'install-sass-gem': - user => vagrant, - command => '/usr/bin/gem install --user-install --no-ri --no-rdoc sass compass', - environment => ['HOME=/home/vagrant'], - unless => 'test -x /home/vagrant/.gem/ruby/2.5.0/bin/sass', - path => ['/usr/bin/', '/bin/', '/home/vagrant/.gem/ruby/2.5.0/bin/'], - timeout => 900, - tag => ['rubygem'] + rbenv::gem { ['capistrano', 'sass']: + ruby_version => $::profiles::ruby::version, + skip_docs => true, + timeout => 900 } package { ['yarn', 'less', 'autoless', 'uglify-js']: diff --git a/puppet/environments/box/modules/profiles/manifests/mysql.pp b/puppet/environments/box/modules/profiles/manifests/mysql.pp index 70aa6e3..d5e6dcd 100644 --- a/puppet/environments/box/modules/profiles/manifests/mysql.pp +++ b/puppet/environments/box/modules/profiles/manifests/mysql.pp @@ -13,10 +13,24 @@ $mysqld_options = merge($default_mysqld_config, $mysqld_config) + # Little workaround to deal with apt failing to retrieve + # GPG keys from the keyservers. + # It fails randomly on different machines and using a different + # key server didn't solve it either. + # + # Errors received are either + # - gpg: keyserver receive failed: Invalid argument + # - gpg: keyserver receive failed: Server indicated a failure + exec { 'download-mariadb-gpg-key': + command => '/usr/bin/wget https://keyserver.ubuntu.com/pks/lookup?op=get\&search=0x177F4010FE56CA3336300305F1656F24C74CD1D8 -O /tmp/mariadb.gpg.key && apt-key add /tmp/mariadb.gpg.key', + unless => 'apt-key list 2> /dev/null | grep mariadb' + } + apt::source { 'mariadb': - location => 'http://mariadb.mirror.nucleus.be/repo/10.4/ubuntu', + location => 'http://ams2.mirrors.digitalocean.com/mariadb/repo/10.4/ubuntu', repos => 'main', - key => '177F4010FE56CA3336300305F1656F24C74CD1D8' + architecture => 'amd64', + require => Exec['download-mariadb-gpg-key'] } class { '::mysql::server': diff --git a/puppet/environments/box/modules/profiles/manifests/nodejs.pp b/puppet/environments/box/modules/profiles/manifests/nodejs.pp index c838af7..b4c940f 100644 --- a/puppet/environments/box/modules/profiles/manifests/nodejs.pp +++ b/puppet/environments/box/modules/profiles/manifests/nodejs.pp @@ -3,7 +3,7 @@ ) { class { '::nodejs': - repo_url_suffix => '10.x', + repo_url_suffix => '12.x', } } \ No newline at end of file diff --git a/puppet/environments/box/modules/profiles/manifests/phpmyadmin.pp b/puppet/environments/box/modules/profiles/manifests/phpmyadmin.pp index 7cacd42..d20d193 100644 --- a/puppet/environments/box/modules/profiles/manifests/phpmyadmin.pp +++ b/puppet/environments/box/modules/profiles/manifests/phpmyadmin.pp @@ -13,8 +13,9 @@ } exec { 'install-phpmyadmin': - command => 'composer create-project phpmyadmin/phpmyadmin /usr/share/phpmyadmin "^4.7.0" -q --repository-url=https://www.phpmyadmin.net/packages.json --no-dev --no-interaction', + command => 'composer create-project phpmyadmin/phpmyadmin . "^4.7.0" -q --repository-url=https://www.phpmyadmin.net/packages.json --no-dev --no-interaction', unless => 'test -f /usr/share/phpmyadmin/composer.json', + cwd => '/usr/share/phpmyadmin/', path => ['/usr/local/bin', '/usr/bin'], user => vagrant, environment => 'COMPOSER_HOME=/home/vagrant/.composer', diff --git a/puppet/environments/box/modules/profiles/manifests/pimpmylog.pp b/puppet/environments/box/modules/profiles/manifests/pimpmylog.pp index 64b01fd..5445fd6 100644 --- a/puppet/environments/box/modules/profiles/manifests/pimpmylog.pp +++ b/puppet/environments/box/modules/profiles/manifests/pimpmylog.pp @@ -10,11 +10,12 @@ } exec { 'install-pimpmylog': - command => 'composer create-project potsky/pimp-my-log:1.7.* /usr/share/pimpmylog/ --no-interaction', - cwd => '/usr/share/pimpmylog', + command => 'composer create-project potsky/pimp-my-log:1.7.14 . --no-interaction', + cwd => '/usr/share/pimpmylog/', unless => 'test -d /usr/share/pimpmylog/vendor', path => ['/usr/local/bin', '/usr/bin'], user => vagrant, + timeout => 3600, environment => 'COMPOSER_HOME=/home/vagrant/.composer', require => [File['/usr/share/pimpmylog'], Anchor['php::end']] } @@ -66,11 +67,4 @@ mode => '0644' } - file { '/var/log/syslog': - ensure => file, - mode => '0644', - owner => syslog, - group => adm - } - } diff --git a/puppet/environments/box/modules/profiles/manifests/ruby.pp b/puppet/environments/box/modules/profiles/manifests/ruby.pp index 6448181..5e52246 100644 --- a/puppet/environments/box/modules/profiles/manifests/ruby.pp +++ b/puppet/environments/box/modules/profiles/manifests/ruby.pp @@ -1,21 +1,29 @@ -class profiles::ruby { +class profiles::ruby( + $version = '2.6.5' +) { - Package <| tag == 'ruby' |> - -> Exec <| tag == 'rubygem' |> + Package <| title == 'git' |> + -> Exec <| title == 'git-clone-rbenv' |> + -> Rbenv::Plugin <| |> + -> Rbenv::Gem <| |> - package { 'ruby': - ensure => '1:2.5.1', - tag => ['ruby'] + Package <| title == 'git' |> + -> Rbenv::Plugin <| |> + + class { '::rbenv': } + + rbenv::plugin { 'rbenv/ruby-build': + latest => true } - package { 'ruby-dev': - ensure => installed, - tag => ['ruby'] + rbenv::build { $version: + global => true, + bundler_version => '>2.0' } file_line { 'add-gem-bin-dir-to-path': path => '/home/vagrant/.bashrc', - line => 'export PATH=$PATH:/home/vagrant/.gem/ruby/2.5.0/bin/' + line => "export PATH=/usr/local/rbenv/versions/${version}/bin:\$PATH" } } \ No newline at end of file diff --git a/puppet/environments/box/modules/profiles/manifests/system/hostname.pp b/puppet/environments/box/modules/profiles/manifests/system/hostname.pp index aa26d72..2cfca95 100644 --- a/puppet/environments/box/modules/profiles/manifests/system/hostname.pp +++ b/puppet/environments/box/modules/profiles/manifests/system/hostname.pp @@ -17,7 +17,7 @@ "$hostname" => undef, default => $alias }, - before => Exec['service hostname restart'], + before => Exec['set-hostname'], } file { '/etc/mailname': @@ -34,10 +34,11 @@ group => 'root', mode => '0644', content => "${name}\n", - notify => Exec['service hostname restart'], + notify => Exec['set-hostname'], } - exec { 'service hostname restart': + exec { 'set-hostname': + command => "/usr/bin/hostnamectl set-hostname ${name}", refreshonly => true } } \ No newline at end of file diff --git a/puppet/environments/box/modules/profiles/manifests/wetty.pp b/puppet/environments/box/modules/profiles/manifests/wetty.pp index 6a02ad6..87c9f31 100644 --- a/puppet/environments/box/modules/profiles/manifests/wetty.pp +++ b/puppet/environments/box/modules/profiles/manifests/wetty.pp @@ -3,10 +3,11 @@ include ::profiles::nodejs include ::profiles::systemd::reload - + exec { 'yarn-install-wetty': - command => '/usr/bin/yarn global add wetty.js', + command => '/usr/bin/yarn global add wetty', unless => 'which wetty', + notify => Service['wetty'], require => Package['yarn'] } @@ -29,4 +30,10 @@ require => Ssh_keygen['vagrant'] } + file { '/home/vagrant/.ssh/config': + content => "Host localhost\n\tStrictHostKeyChecking no\n", + owner => vagrant, + group => vagrant + } + } \ No newline at end of file diff --git a/tests/Gemfile.lock b/tests/Gemfile.lock index 5565e28..362f3d8 100644 --- a/tests/Gemfile.lock +++ b/tests/Gemfile.lock @@ -12,25 +12,25 @@ GEM rspec-core (~> 3.9.0) rspec-expectations (~> 3.9.0) rspec-mocks (~> 3.9.0) - rspec-core (3.9.0) - rspec-support (~> 3.9.0) + rspec-core (3.9.1) + rspec-support (~> 3.9.1) rspec-expectations (3.9.0) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.9.0) rspec-its (1.3.0) rspec-core (>= 3.0.0) rspec-expectations (>= 3.0.0) - rspec-mocks (3.9.0) + rspec-mocks (3.9.1) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.9.0) - rspec-support (3.9.0) + rspec-support (3.9.2) serverspec (2.41.5) multi_json rspec (~> 3.0) rspec-its specinfra (~> 2.72) sfl (2.3) - specinfra (2.82.4) + specinfra (2.82.5) net-scp net-ssh (>= 2.7) net-telnet (= 0.1.1) @@ -44,4 +44,4 @@ DEPENDENCIES serverspec BUNDLED WITH - 2.0.2 + 2.1.3 diff --git a/tests/spec/default/cli.rb b/tests/spec/default/cli.rb index c97a1db..dc008e5 100644 --- a/tests/spec/default/cli.rb +++ b/tests/spec/default/cli.rb @@ -30,11 +30,10 @@ it { should be_installed } end - describe command('ls -lah /home/vagrant/.gem/ruby/2.5.0/gems/') do - its(:stdout) { should match /capistrano-3\.\d+\.\d+/ } - its(:stdout) { should match /sass-\d+\.\d+\.\d+/ } - its(:stdout) { should match /compass-core-\d+\.\d+\.\d+/ } - its(:stdout) { should match /bundler-\d+\.\d+\.\d+/ } + describe command('gem list') do + its(:stdout) { should match /capistrano \(3\.\d+\.\d+/ } + its(:stdout) { should match /sass \(\d+\.\d+\.\d+/ } + its(:stdout) { should match /bundler \(\d+\.\d+\.\d+/ } end describe package('git') do @@ -43,7 +42,6 @@ describe file('/home/vagrant/.bashrc') do it { should exist } - its(:content) { should match '/home/vagrant/.gem/ruby/2.5.0/bin' } its(:content) { should match '/home/vagrant/.composer/vendor/bin' } its(:content) { should match '/home/vagrant/box' } its(:content) { should match '/home/vagrant/phpmanager' } diff --git a/tests/spec/default/cockpit.rb b/tests/spec/default/cockpit.rb new file mode 100644 index 0000000..65027bf --- /dev/null +++ b/tests/spec/default/cockpit.rb @@ -0,0 +1,18 @@ +require 'spec_helper' + +describe '## Cockpit' do + describe service('cockpit.socket'), :if => os[:family] == 'ubuntu' do + it { should be_enabled } + it { should be_running } + end + + describe port(9090) do + it { should be_listening } + end + + describe file('/etc/cockpit/cockpit.conf') do + it { should exist } + its(:content) { should match /joomlatools.box/ } + its(:content) { should match /AllowUnencrypted = true/ } + end +end \ No newline at end of file diff --git a/tests/spec/default/foliolabs.rb b/tests/spec/default/foliolabs.rb new file mode 100644 index 0000000..92a9ea8 --- /dev/null +++ b/tests/spec/default/foliolabs.rb @@ -0,0 +1,28 @@ +require 'spec_helper' + +describe '## Foliolabs' do + let(:sudo_options) { '-u vagrant -i' } # Simulate a login as the user, so that the PATH variable is loaded + + describe '### joomlatools-folioshell' do + + describe command('/home/vagrant/.composer/vendor/bin/folioshell -V') do + its(:stdout) { should match /FolioShell - WordPress Console tools \d\.\d+\.\d+/ } + end + + describe command('/home/vagrant/.composer/vendor/bin/folioshell site:create serverspectest-wp') do + its(:exit_status) { should eq 0 } + + describe command('mysql -s -N -uroot -proot -e "SHOW DATABASES;"') do + its(:stdout) { should match /sites_serverspectest-wp/ } + end + + describe command('curl -s http://joomla.box/sites.php') do + its(:stdout) { should match /serverspectest-wp/ } + end + end + + describe command('/home/vagrant/.composer/vendor/bin/folioshell site:delete serverspectest-wp') do + its(:exit_status) { should eq 0 } + end + end +end \ No newline at end of file diff --git a/tests/spec/default/joomlatools.rb b/tests/spec/default/joomlatools.rb index 69360e3..e840e2a 100644 --- a/tests/spec/default/joomlatools.rb +++ b/tests/spec/default/joomlatools.rb @@ -9,19 +9,19 @@ its(:stdout) { should match /Joomla Console tools \d\.\d+\.\d+/ } end - describe command('/home/vagrant/.composer/vendor/bin/joomla site:create serverspectest') do + describe command('/home/vagrant/.composer/vendor/bin/joomla site:create serverspectest-joomla') do its(:exit_status) { should eq 0 } describe command('mysql -s -N -uroot -proot -e "SHOW DATABASES;"') do - its(:stdout) { should match /sites_serverspectest/ } + its(:stdout) { should match /sites_serverspectest-joomla/ } end describe command('curl -s http://joomla.box/sites.php') do - its(:stdout) { should match /serverspectest/ } + its(:stdout) { should match /serverspectest-joomla/ } end end - describe command('/home/vagrant/.composer/vendor/bin/joomla site:delete serverspectest') do + describe command('/home/vagrant/.composer/vendor/bin/joomla site:delete serverspectest-joomla') do its(:exit_status) { should eq 0 } end end diff --git a/tests/spec/default/mailcatcher.rb b/tests/spec/default/mailhog.rb similarity index 57% rename from tests/spec/default/mailcatcher.rb rename to tests/spec/default/mailhog.rb index cad69bb..9b4d1eb 100644 --- a/tests/spec/default/mailcatcher.rb +++ b/tests/spec/default/mailhog.rb @@ -1,7 +1,7 @@ require 'spec_helper' -describe '## MailCatcher' do - describe service('mailcatcher'), :if => os[:family] == 'ubuntu' do +describe '## Mailhog' do + describe service('mailhog'), :if => os[:family] == 'ubuntu' do it { should be_enabled } it { should be_running } end @@ -12,10 +12,10 @@ describe file('/etc/apache2/joomla.box-include.conf') do it { should exist } - its(:content) { should match /Redirect permanent \/mailcatcher http:\/\/joomla.box:1080/ } + its(:content) { should match /Redirect permanent \/mailhog http:\/\/joomla.box:8025/ } end - describe port(1080) do + describe port(8025) do it { should be_listening } end end \ No newline at end of file diff --git a/tests/spec/default/misc.rb b/tests/spec/default/misc.rb index 79d8e97..799389b 100644 --- a/tests/spec/default/misc.rb +++ b/tests/spec/default/misc.rb @@ -34,12 +34,16 @@ describe command('sudo yarn global list') do its(:exit_status) { should eq 0 } - its(:stdout) { should match /wetty.js@\d\.\d+\.\d+/ } + its(:stdout) { should match /wetty@\d\.\d+\.\d+/ } end describe file('/etc/apache2/joomla.box-include.conf') do its(:content) { should match /Redirect permanent \/terminal http:\/\/joomla.box\/wetty/ } end + + describe file('/home/vagrant/.ssh/config') do + its(:content) { should match /StrictHostKeyChecking no/ } + end end describe '### PimpMyLog' do @@ -52,17 +56,11 @@ its(:content) { should match /pimpmylog/ } end - ['apache2', 'mysql', 'syslog'].each do |conf| + ['apache2', 'mysql'].each do |conf| describe file("/usr/share/pimpmylog/config.user.d/#{conf}.json") do it { should exist } end end - - ['/var/log/syslog'].each do |log| - describe file(log) do - it { should be_mode 644 } - end - end end end \ No newline at end of file diff --git a/tests/spec/default/mysql.rb b/tests/spec/default/mysql.rb index fb24847..aef15f5 100644 --- a/tests/spec/default/mysql.rb +++ b/tests/spec/default/mysql.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe '## MySQL' do - describe package('mariadb-server-10.3'), :if => os[:family] == 'ubuntu' do + describe package('mariadb-server-10.4'), :if => os[:family] == 'ubuntu' do it { should be_installed } end diff --git a/tests/spec/default/php.rb b/tests/spec/default/php.rb index e6a4be4..605568c 100644 --- a/tests/spec/default/php.rb +++ b/tests/spec/default/php.rb @@ -21,7 +21,7 @@ describe '### PHP config parameters' do context php_config('sendmail_path') do - its(:value) { should match /\/usr\/bin\/env catchmail -fnoreply@example.com/ } + its(:value) { should match /\/usr\/local\/bin\/mhsendmail/ } end context php_config('xdebug.profiler_output_dir') do diff --git a/tests/spec/default/ruby.rb b/tests/spec/default/ruby.rb index a3eb083..447e26c 100644 --- a/tests/spec/default/ruby.rb +++ b/tests/spec/default/ruby.rb @@ -1,13 +1,16 @@ require 'spec_helper' -rvm_default_ruby = 'ruby-2.5.1' - describe '## Ruby' do let(:sudo_options) { '-u vagrant -i' } describe command("ruby --version") do - its(:stdout) { should match rvm_default_ruby.split('-')[-1].to_s } + its(:stdout) { should match '2.6.5' } + end + + describe file("/etc/profile.d/rbenv.sh") do + it { should exist } + its(:content) { should match 'rbenv init' } end end \ No newline at end of file