From cbe531608531cca1926bdecf51bc7197b0598bfc Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Mon, 20 Nov 2017 21:53:02 +1300 Subject: [PATCH 01/44] Adding script customizations. --- Vagrantfile | 191 +++++++++++------- code/.gitignore | 3 + project_setup_scripts/.gitignore | 0 .../example_project_setup.txt | 51 +++++ .../freebtc.website.new.localhost.sh | 49 +++++ readme.md | 8 +- scripts/install_phpmyadmin.sh | 75 +++++++ setup_projects.sh | 12 ++ 8 files changed, 314 insertions(+), 75 deletions(-) create mode 100644 code/.gitignore create mode 100644 project_setup_scripts/.gitignore create mode 100644 project_setup_scripts/example_project_setup.txt create mode 100644 project_setup_scripts/freebtc.website.new.localhost.sh create mode 100644 scripts/install_phpmyadmin.sh create mode 100644 setup_projects.sh diff --git a/Vagrantfile b/Vagrantfile index 6eaa6169..b462b0aa 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -2,11 +2,14 @@ # vi: set ft=ruby : # Config Github Settings -github_username = "fideloper" +github_username = "rattfieldnz" github_repo = "Vaprobash" -github_branch = "1.4.2" +github_branch = "1.4.3" github_url = "https://raw.githubusercontent.com/#{github_username}/#{github_repo}/#{github_branch}" +vm_synced_folder_host = "code" +vm_synced_folder_guest = "/home/vagrant" + # Because this:https://developer.github.com/changes/2014-12-08-removing-authorizations-token/ # https://github.com/settings/tokens github_pat = "" @@ -22,33 +25,34 @@ hostname = "vaprobash.dev" # 172.16.0.1 - 172.31.255.254 # 192.168.0.1 - 192.168.255.254 server_ip = "192.168.22.10" -server_cpus = "1" # Cores -server_memory = "384" # MB -server_swap = "768" # Options: false | int (MB) - Guideline: Between one or two times the server_memory +server_cpus = "4" # Cores +server_memory = "4096" # MB +server_swap = "8192" # Options: false | int (MB) - Guideline: Between one or two times the server_memory # UTC for Universal Coordinated Time # EST for Eastern Standard Time # CET for Central European Time # US/Central for American Central # US/Eastern for American Eastern -server_timezone = "UTC" +server_timezone = "Pacific/Auckland" # Database Configuration mysql_root_password = "root" # We'll assume user "root" -mysql_version = "5.5" # Options: 5.5 | 5.6 +mysql_version = "5.7" # Options: 5.5 | 5.6 | 5.7 mysql_enable_remote = "false" # remote access enabled when true pgsql_root_password = "root" # We'll assume user "root" -mongo_version = "2.6" # Options: 2.6 | 3.0 +mongo_version = "3.2" # Options: 2.6 | 3.0 | 3.2 mongo_enable_remote = "false" # remote access enabled when true # Languages and Packages -php_timezone = "UTC" # http://php.net/manual/en/timezones.php -php_version = "5.6" # Options: 5.5 | 5.6 | 7.0 | 7.1 +php_timezone = "Pacific/Auckland" # http://php.net/manual/en/timezones.php +php_version = "7.1" # Options: 5.5 | 5.6 | 7.0 | 7.1 ruby_version = "latest" # Choose what ruby version should be installed (will also be the default version) ruby_gems = [ # List any Ruby Gems that you want to install - #"jekyll", - #"sass", - #"compass", + "sass", + "compass", + "capistrano", + "capistrano-laravel" ] go_version = "latest" # Example: go1.4 (latest equals the latest stable version) @@ -58,27 +62,40 @@ hhvm = "false" # PHP Options composer_packages = [ # List any global Composer packages that you want to install - #"phpunit/phpunit:4.0.*", - #"codeception/codeception=*", - #"phpspec/phpspec:2.0.*@dev", - #"squizlabs/php_codesniffer:1.5.*", + "phpunit/phpunit:~6.4", + "phpunit/php-invoker:^1.1", + "codeception/codeception:~2.3", + "phpspec/phpspec:~4.2", + "squizlabs/php_codesniffer:^3.0", + "unitgen/unitgen:dev-master" ] # Default web server document root # Symfony's public directory is assumed "web" # Laravel's public directory is assumed "public" -public_folder = "/vagrant" +public_folder = "/home/vagrant/code" -laravel_root_folder = "/vagrant/laravel" # Where to install Laravel. Will `composer install` if a composer.json file exists +laravel_root_folder = vm_synced_folder_guest + "/code/laravel-test" # Where to install Laravel. Will `composer install` if a composer.json file exists laravel_version = "latest-stable" # If you need a specific version of Laravel, set it here -symfony_root_folder = "/vagrant/symfony" # Where to install Symfony. +symfony_root_folder = vm_synced_folder_guest + "/code/symfony-test" # Where to install Symfony. nodejs_version = "latest" # By default "latest" will equal the latest stable version nodejs_packages = [ # List any global NodeJS packages that you want to install - #"grunt-cli", - #"gulp", - #"bower", - #"yo", + "grunt-cli", + "gulp", + "bower", + "yo", + "gulp-concat-css", + "gulp-minify-css", + "gulp-rename", + "gulp-ruby-sass", + "gulp-sourcemaps", + "gulp-uglify", + "notify-send", + "sw-precache-webpack-plugin", + "cross-env", + "cross-env", + "laravel-mix" ] # RabbitMQ settings @@ -91,8 +108,8 @@ elasticsearch_version = "2.3.1" # 5.0.0-alpha1, 2.3.1, 2.2.2, 2.1.2, 1.7.5 Vagrant.configure("2") do |config| - # Set server to Ubuntu 14.04 - config.vm.box = "ubuntu/trusty64" + # Set server to Ubuntu 16.04 + config.vm.box = "ubuntu/xenial64" config.vm.define "Vaprobash" do |vapro| end @@ -121,7 +138,7 @@ Vagrant.configure("2") do |config| config.ssh.forward_agent = true # Use NFS for the shared folder - config.vm.synced_folder ".", "/vagrant", + config.vm.synced_folder vm_synced_folder_host, vm_synced_folder_guest id: "core", :nfs => true, :mount_options => ['nolock,vers=3,udp,noatime,actimeo=2,fsc'] @@ -154,43 +171,45 @@ Vagrant.configure("2") do |config| end # If using VMWare Fusion - config.vm.provider "vmware_fusion" do |vb, override| - override.vm.box_url = "http://files.vagrantup.com/precise64_vmware.box" - - # Set server memory - vb.vmx["memsize"] = server_memory - - end + #config.vm.provider "vmware_fusion" do |vb, override| + # override.vm.box_url = "http://files.vagrantup.com/precise64_vmware.box" + # + ## Set server memory + # vb.vmx["memsize"] = server_memory + # + #end # If using Vagrant-Cachier # http://fgrehm.viewdocs.io/vagrant-cachier - if Vagrant.has_plugin?("vagrant-cachier") - # Configure cached packages to be shared between instances of the same base box. - # Usage docs: http://fgrehm.viewdocs.io/vagrant-cachier/usage - config.cache.scope = :box - - config.cache.synced_folder_opts = { - type: :nfs, - mount_options: ['rw', 'vers=3', 'tcp', 'nolock'] - } - end + #if Vagrant.has_plugin?("vagrant-cachier") + # # Configure cached packages to be shared between instances of the same base box. + # # Usage docs: http://fgrehm.viewdocs.io/vagrant-cachier/usage + # config.cache.scope = :box + # + # config.cache.synced_folder_opts = { + # type: :nfs, + # mount_options: ['rw', 'vers=3', 'tcp', 'nolock'] + # } + #end # Adding vagrant-digitalocean provider - https://github.com/smdahlen/vagrant-digitalocean # Needs to ensure that the vagrant plugin is installed - config.vm.provider :digital_ocean do |provider, override| - override.ssh.private_key_path = '~/.ssh/id_rsa' - override.ssh.username = 'vagrant' - override.vm.box = 'digital_ocean' - override.vm.box_url = "https://github.com/smdahlen/vagrant-digitalocean/raw/master/box/digital_ocean.box" - - provider.token = 'YOUR TOKEN' - provider.image = 'ubuntu-14-04-x64' - provider.region = 'nyc2' - provider.size = '512mb' - end + #config.vm.provider :digital_ocean do |provider, override| + # override.ssh.private_key_path = '~/.ssh/id_rsa' + # override.ssh.username = 'vagrant' + # override.vm.box = 'digital_ocean' + # override.vm.box_url = "https://github.com/smdahlen/vagrant-digitalocean/raw/master/box/digital_ocean.box" + # + # provider.token = 'YOUR TOKEN' + # provider.image = 'ubuntu-14-04-x64' + # provider.region = 'nyc2' + # provider.size = '512mb' + #end #### # Base Items + # + # NOTE!: Comment out lines for scripts you don't want to run! ########## # Provision Base Packages @@ -206,17 +225,19 @@ Vagrant.configure("2") do |config| # config.vm.provision "shell", path: "#{github_url}/scripts/mssql.sh" # Provision Vim - # config.vm.provision "shell", path: "#{github_url}/scripts/vim.sh", args: github_url + config.vm.provision "shell", path: "#{github_url}/scripts/vim.sh", args: github_url # Provision Docker # config.vm.provision "shell", path: "#{github_url}/scripts/docker.sh", args: "permissions" #### # Web Servers + # + # NOTE!: Comment out lines for scripts you don't want to run! ########## # Provision Apache Base - # config.vm.provision "shell", path: "#{github_url}/scripts/apache.sh", args: [server_ip, public_folder, hostname, github_url] + config.vm.provision "shell", path: "#{github_url}/scripts/apache.sh", args: [server_ip, public_folder, hostname, github_url] # Provision Nginx Base # config.vm.provision "shell", path: "#{github_url}/scripts/nginx.sh", args: [server_ip, public_folder, hostname, github_url, php_version] @@ -224,16 +245,18 @@ Vagrant.configure("2") do |config| #### # Databases + # + # NOTE!: Comment out lines for scripts you don't want to run! ########## # Provision MySQL - # config.vm.provision "shell", path: "#{github_url}/scripts/mysql.sh", args: [mysql_root_password, mysql_version, mysql_enable_remote] + config.vm.provision "shell", path: "#{github_url}/scripts/mysql.sh", args: [mysql_root_password, mysql_version, mysql_enable_remote] # Provision PostgreSQL - # config.vm.provision "shell", path: "#{github_url}/scripts/pgsql.sh", args: pgsql_root_password + config.vm.provision "shell", path: "#{github_url}/scripts/pgsql.sh", args: pgsql_root_password # Provision SQLite - # config.vm.provision "shell", path: "#{github_url}/scripts/sqlite.sh" + config.vm.provision "shell", path: "#{github_url}/scripts/sqlite.sh" # Provision RethinkDB # config.vm.provision "shell", path: "#{github_url}/scripts/rethinkdb.sh", args: pgsql_root_password @@ -245,7 +268,7 @@ Vagrant.configure("2") do |config| # config.vm.provision "shell", path: "#{github_url}/scripts/couchdb.sh" # Provision MongoDB - # config.vm.provision "shell", path: "#{github_url}/scripts/mongodb.sh", args: [mongo_enable_remote, mongo_version] + config.vm.provision "shell", path: "#{github_url}/scripts/mongodb.sh", args: [mongo_enable_remote, mongo_version] # Provision MariaDB # config.vm.provision "shell", path: "#{github_url}/scripts/mariadb.sh", args: [mysql_root_password, mysql_enable_remote] @@ -255,6 +278,8 @@ Vagrant.configure("2") do |config| #### # Search Servers + # + # NOTE!: Comment out lines for scripts you don't want to run! ########## # Install Elasticsearch @@ -265,6 +290,8 @@ Vagrant.configure("2") do |config| #### # Search Server Administration (web-based) + # + # NOTE!: Comment out lines for scripts you don't want to run! ########## # Install ElasticHQ @@ -275,21 +302,25 @@ Vagrant.configure("2") do |config| #### # In-Memory Stores + # + # NOTE!: Comment out lines for scripts you don't want to run! ########## # Install Memcached - # config.vm.provision "shell", path: "#{github_url}/scripts/memcached.sh" + config.vm.provision "shell", path: "#{github_url}/scripts/memcached.sh" # Provision Redis (without journaling and persistence) # config.vm.provision "shell", path: "#{github_url}/scripts/redis.sh" # Provision Redis (with journaling and persistence) - # config.vm.provision "shell", path: "#{github_url}/scripts/redis.sh", args: "persistent" + config.vm.provision "shell", path: "#{github_url}/scripts/redis.sh", args: "persistent" # NOTE: It is safe to run this to add persistence even if originally provisioned without persistence #### # Utility (queue) + # + # NOTE!: Comment out lines for scripts you don't want to run! ########## # Install Beanstalkd @@ -312,36 +343,40 @@ Vagrant.configure("2") do |config| #### # Additional Languages + # + # NOTE!: Comment out lines for scripts you don't want to run! ########## # Install Nodejs - # config.vm.provision "shell", path: "#{github_url}/scripts/nodejs.sh", privileged: false, args: nodejs_packages.unshift(nodejs_version, github_url) + config.vm.provision "shell", path: "#{github_url}/scripts/nodejs.sh", privileged: false, args: nodejs_packages.unshift(nodejs_version, github_url) # Install Ruby Version Manager (RVM) - # config.vm.provision "shell", path: "#{github_url}/scripts/rvm.sh", privileged: false, args: ruby_gems.unshift(ruby_version) + config.vm.provision "shell", path: "#{github_url}/scripts/rvm.sh", privileged: false, args: ruby_gems.unshift(ruby_version) # Install Go Version Manager (GVM) # config.vm.provision "shell", path: "#{github_url}/scripts/go.sh", privileged: false, args: [go_version] #### # Frameworks and Tooling + # + # NOTE!: Comment out lines for scripts you don't want to run! ########## # Provision Composer # You may pass a github auth token as the first argument - # config.vm.provision "shell", path: "#{github_url}/scripts/composer.sh", privileged: false, args: [github_pat, composer_packages.join(" ")] + config.vm.provision "shell", path: "#{github_url}/scripts/composer.sh", privileged: false, args: [github_pat, composer_packages.join(" ")] # Provision Laravel - # config.vm.provision "shell", path: "#{github_url}/scripts/laravel.sh", privileged: false, args: [server_ip, laravel_root_folder, public_folder, laravel_version] + config.vm.provision "shell", path: "#{github_url}/scripts/laravel.sh", privileged: false, args: [server_ip, laravel_root_folder, public_folder, laravel_version] # Provision Symfony - # config.vm.provision "shell", path: "#{github_url}/scripts/symfony.sh", privileged: false, args: [server_ip, symfony_root_folder, public_folder] + config.vm.provision "shell", path: "#{github_url}/scripts/symfony.sh", privileged: false, args: [server_ip, symfony_root_folder, public_folder] # Install Screen - # config.vm.provision "shell", path: "#{github_url}/scripts/screen.sh" + config.vm.provision "shell", path: "#{github_url}/scripts/screen.sh" # Install Mailcatcher - # config.vm.provision "shell", path: "#{github_url}/scripts/mailcatcher.sh", args: [php_version] + config.vm.provision "shell", path: "#{github_url}/scripts/mailcatcher.sh", args: [php_version] # Install git-ftp # config.vm.provision "shell", path: "#{github_url}/scripts/git-ftp.sh", privileged: false @@ -357,6 +392,20 @@ Vagrant.configure("2") do |config| # Any local scripts you may want to run post-provisioning. # Add these to the same directory as the Vagrantfile. ########## - # config.vm.provision "shell", path: "./local-script.sh" + # config.vm.provision "shell", path: "./your_script_name.sh" + config.vm.provision "shell", path: "./install_phpmyadmin.sh" + + ##### + # Optional + # If you want to set-up your custom projects, + # add a bash script file (project_name.sh) in + # the 'project_setup_scripts' directory which + # contains the necessary functionality to set it/them up. + # + # The bash script referenced below will loop over + # and execute scripts (with .sh extension) in the + # mentioned directory. + ########## + config.vm.provision "shell", path: "./setup_projects.sh" end diff --git a/code/.gitignore b/code/.gitignore new file mode 100644 index 00000000..e7a210ec --- /dev/null +++ b/code/.gitignore @@ -0,0 +1,3 @@ +* +*/ +!.gitignore \ No newline at end of file diff --git a/project_setup_scripts/.gitignore b/project_setup_scripts/.gitignore new file mode 100644 index 00000000..e69de29b diff --git a/project_setup_scripts/example_project_setup.txt b/project_setup_scripts/example_project_setup.txt new file mode 100644 index 00000000..c17d48b6 --- /dev/null +++ b/project_setup_scripts/example_project_setup.txt @@ -0,0 +1,51 @@ +# !/usr/bin/env bash +# Add above to your project set-up script. +# Remove space between first 'hash' and exclamation mark! + +PROJECT_LOG_FILE=./EXAMPLE_WEB_PROJECT.build.log; +echo "" > $PROJECT_LOG_FILE; + +echo "Moving into /home/vagrant/code/EXAMPLE_WEB_PROJECT_FOLDER.\n" >> $PROJECT_LOG_FILE; +cd /home/vagrant/code/EXAMPLE_WEB_PROJECT_FOLDER >> $PROJECT_LOG_FILE; + +echo "Update global Composer first, befire installing/updating packages.\n" +composer self-update >> $PROJECT_LOG_FILE; + +echo "Install Composer packages for project.\n" >> $PROJECT_LOG_FILE; +composer install >> $PROJECT_LOG_FILE; + +echo "If Composer packages are already installed for project, let's update them.\n" >> $PROJECT_LOG_FILE; +composer update >> $PROJECT_LOG_FILE; + +echo "Compile back-end assets.\n" >> $PROJECT_LOG_FILE; +composer dump-autoload --optimize && +php artisan optimize && +php artisan clear-compiled && +php artisan cache:clear && +php artisan view:clear && +php artisan laroute:generate && +php artisan key:generate >> $PROJECT_LOG_FILE; + +echo "Run database migrations, and seed with data (errors will be logged).\n" >> $PROJECT_LOG_FILE; +php artisan migrate --seed >> $PROJECT_LOG_FILE; + +echo "Install NPM packages for project.\n" >> $PROJECT_LOG_FILE; +npm install --force --save >> $PROJECT_LOG_FILE + +echo "Install front-end packages via Bower.\n" >> $PROJECT_LOG_FILE; +bower install --save --force >> $PROJECT_LOG_FILE; + +echo "Compile front-end assets.\n" >> $PROJECT_LOG_FILE; +gulp copyfiles && +gulp && +gulp minifycss && +gulp minifyjs >> $PROJECT_LOG_FILE; + +echo "Chown storage directory for Apache user:group (www-data:www-data).\n" +chown -R www-data:www-data /home/vagrant/code/EXAMPLE_WEB_PROJECT_FOLDER/storage + +echo "Make storage directory readable/writeable.\n" +chmod -R 755 /home/vagrant/code/EXAMPLE_WEB_PROJECT_FOLDER/storage + +echo "Now create Apache Vhost file and enable site.\n" +sudo vhost -s EXAMPLE_WEB_PROJECT_VHOST_NAME -d /home/vagrant/code/EXAMPLE_WEB_PROJECT_FOLDER/public \ No newline at end of file diff --git a/project_setup_scripts/freebtc.website.new.localhost.sh b/project_setup_scripts/freebtc.website.new.localhost.sh new file mode 100644 index 00000000..b27b446e --- /dev/null +++ b/project_setup_scripts/freebtc.website.new.localhost.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash + +PROJECT_LOG_FILE=./freebtc.website.new.localhost.build.log; +echo "" > $PROJECT_LOG_FILE; + +echo "Moving into /home/vagrant/code/freebtc.website.new.localhost.\n" >> $PROJECT_LOG_FILE; +cd /home/vagrant/code/freebtc.website.new.localhost >> $PROJECT_LOG_FILE; + +echo "Update global Composer first, befire installing/updating packages.\n" +composer self-update >> $PROJECT_LOG_FILE; + +echo "Install Composer packages for project.\n" >> $PROJECT_LOG_FILE; +composer install >> $PROJECT_LOG_FILE; + +echo "If Composer packages are already installed for project, let's update them.\n" >> $PROJECT_LOG_FILE; +composer update >> $PROJECT_LOG_FILE; + +echo "Compile back-end assets.\n" >> $PROJECT_LOG_FILE; +composer dump-autoload --optimize && +php artisan optimize && +php artisan clear-compiled && +php artisan cache:clear && +php artisan view:clear && +php artisan laroute:generate && +php artisan key:generate >> $PROJECT_LOG_FILE; + +echo "Run database migrations, and seed with data (errors will be logged).\n" >> $PROJECT_LOG_FILE; +php artisan migrate --seed >> $PROJECT_LOG_FILE; + +echo "Install NPM packages for project.\n" >> $PROJECT_LOG_FILE; +npm install --force --save >> $PROJECT_LOG_FILE + +echo "Install front-end packages via Bower.\n" >> $PROJECT_LOG_FILE; +bower install --save --force >> $PROJECT_LOG_FILE; + +echo "Compile front-end assets.\n" >> $PROJECT_LOG_FILE; +gulp copyfiles && +gulp && +gulp minifycss && +gulp minifyjs >> $PROJECT_LOG_FILE; + +echo "Chown storage directory for Apache user:group (www-data:www-data).\n" +chown -R www-data:www-data /home/vagrant/code/freebtc.website.new.localhost/storage + +echo "Make storage directory readable/writeable.\n" +chmod -R 755 /home/vagrant/code/freebtc.website.new.localhost/storage + +echo "Now create Apache Vhost file and enable site.\n" +sudo vhost -s freebtc.website.new.localhost -d /home/vagrant/code/freebtc.website.new.localhost/public \ No newline at end of file diff --git a/readme.md b/readme.md index f3a065f6..9d1decec 100644 --- a/readme.md +++ b/readme.md @@ -2,9 +2,9 @@ **Va**​grant **Pro**​visioning **Bash** Scripts -[View the site and extended docs.](http://fideloper.github.io/Vaprobash/index.html) +[View the site and extended docs](http://fideloper.github.io/Vaprobash/index.html). -[![Build Status](https://travis-ci.org/fideloper/Vaprobash.png?branch=master)](https://travis-ci.org/fideloper/Vaprobash) +[![Build Status](https://travis-ci.org/rattfieldnz/Vaprobash.png?branch=master)](https://travis-ci.org/rattfieldnz/Vaprobash) ## Goal @@ -31,10 +31,10 @@ Some further assumptions and self-imposed restrictions. If you find yourself nee ```bash # curl -$ curl -L http://bit.ly/vaprobash > Vagrantfile +$ curl -L http://bit.ly/rattfieldnz-vaprobash > Vagrantfile # wget -$ wget -O Vagrantfile http://bit.ly/vaprobash +$ wget -O Vagrantfile http://bit.ly/rattfieldnz-vaprobash ``` > The `bit.ly` link will always point to the master branch version of the Vagrantfile. diff --git a/scripts/install_phpmyadmin.sh b/scripts/install_phpmyadmin.sh new file mode 100644 index 00000000..58b09dfc --- /dev/null +++ b/scripts/install_phpmyadmin.sh @@ -0,0 +1,75 @@ +#!/usr/bin/env bash + +unset UCF_FORCE_CONFFOLD; +export UCF_FORCE_CONFFNEW=YES; +ucf --purge /boot/grub/menu.lst; + +export DEBIAN_FRONTEND=noninteractive; + +echo "Lets update our packages list, and currently installed packages...\n"; +sudo apt-get update; +sudo DEBIAN_FRONTEND=noninteractive apt-get -f -y -o DPkg::options::="--force-confdef" -o DPkg::options::="--force-confold" --force-yes -fuy upgrade; +sudo DEBIAN_FRONTEND=noninteractive apt-get -f -y -o DPkg::options::="--force-confdef" -o DPkg::options::="--force-confold" --force-yes -fuy dist-upgrade; + +echo "Set-up MySQL and phpMyAdmin (for development purposes ONLY).\n" +DBHOST=localhost +DBUSER=root +DBPASSWD=root +echo 'mysql-server mysql-server/root_password password $DBPASSWD' | debconf-set-selections; +echo 'mysql-server mysql-server/root_password_again password $DBPASSWD' | debconf-set-selections; +echo 'phpmyadmin phpmyadmin/dbconfig-install boolean true' | debconf-set-selections; +echo 'phpmyadmin phpmyadmin/app-password-confirm password $DBPASSWD' | debconf-set-selections; +echo 'phpmyadmin phpmyadmin/mysql/admin-pass password $DBPASSWD' | debconf-set-selections; +echo 'phpmyadmin phpmyadmin/mysql/app-pass password $DBPASSWD' | debconf-set-selections; +echo 'phpmyadmin phpmyadmin/reconfigure-webserver multiselect none' | debconf-set-selections; +sudo DEBIAN_FRONTEND=noninteractive apt-get -f -y -o DPkg::options::="--force-confdef" -o DPkg::options::="--force-confold" install phpmyadmin; + +echo "Set-up Apache Vhost file (assuming phpMyAdmin has been installed to /usr/share/phpmyadmin.\n" +if [ -d "/usr/share/phpmyadmin" ]; then +sudo echo ' + ServerName $ServerName + $ServerAlias + DocumentRoot /usr/share/phpmyadmin + + Options FollowSymLinks + DirectoryIndex index.php + + + AddType application/x-httpd-php .php + + + SetHandler application/x-httpd-php + + php_flag magic_quotes_gpc Off + php_flag track_vars On + php_flag register_globals Off + php_admin_flag allow_url_fopen On + php_value include_path . + php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp + php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/php-gettext/:/usr/share/javascript/:/usr/share/php/tcpdf/:/usr/share/doc/phpmyadmin/:/usr/share/php/phpseclib/ + + + + # Authorize for setup + + + + AuthType Basic + AuthName \"phpMyAdmin Setup\" + AuthUserFile /etc/phpmyadmin/htpasswd.setup + + Require valid-user + + + + # Disallow web access to directories that don\''t need it + + Require all denied + + + Require all denied + +' > /etc/apache2/sites-available/phpmyadmin.localhost.conf +sudo a2ensite phpmyadmin.localhost.conf +sudo service apache2 reload +fi diff --git a/setup_projects.sh b/setup_projects.sh new file mode 100644 index 00000000..0536b354 --- /dev/null +++ b/setup_projects.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +# Loop over bash scripts to set-up projects. +# +# See notes/references below: +# +# http://mywiki.wooledge.org/BashPitfalls#line-80 +# https://stackoverflow.com/a/43606356 +for FILE $(find ./project_setup_scripts -name '*.sh'); do + [ -e "$FILE" ] || continue + (bash -n $file) & +done \ No newline at end of file From a4c5098337677fc0472d743bd24f5725e4fe244d Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Mon, 20 Nov 2017 21:56:50 +1300 Subject: [PATCH 02/44] Added .gitignore file. --- project_setup_scripts/.gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/project_setup_scripts/.gitignore b/project_setup_scripts/.gitignore index e69de29b..e7a210ec 100644 --- a/project_setup_scripts/.gitignore +++ b/project_setup_scripts/.gitignore @@ -0,0 +1,3 @@ +* +*/ +!.gitignore \ No newline at end of file From 6431a80c62f00a5dc9da1e06c137ac3f0219b243 Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Mon, 20 Nov 2017 21:58:32 +1300 Subject: [PATCH 03/44] Modified readme to reflect newer version of Ubuntu. --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 9d1decec..3cf0b714 100644 --- a/readme.md +++ b/readme.md @@ -10,7 +10,7 @@ The goal of this project is to create easy to use bash scripts in order to provision a Vagrant server. -1. This targets Ubuntu LTS releases, currently 14.04.* +1. This targets Ubuntu LTS releases, currently 16.04.* 2. This project will give users various popular options such as LAMP, LEMP 3. This project will attempt some modularity. For example, users might choose to install a Vim setup, or not. From 0353d1149ecff08560c1e7608cb1ae928ecb7e16 Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Mon, 20 Nov 2017 22:07:14 +1300 Subject: [PATCH 04/44] Commented out NFS block - encountered some performance issues on Win 10 (home). --- Vagrantfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index b462b0aa..75cdab5d 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -138,10 +138,10 @@ Vagrant.configure("2") do |config| config.ssh.forward_agent = true # Use NFS for the shared folder - config.vm.synced_folder vm_synced_folder_host, vm_synced_folder_guest - id: "core", - :nfs => true, - :mount_options => ['nolock,vers=3,udp,noatime,actimeo=2,fsc'] + #config.vm.synced_folder vm_synced_folder_host, vm_synced_folder_guest + # id: "core" + # :nfs => true, + # :mount_options => ['nolock,vers=3,udp,noatime,actimeo=2,fsc'] # Replicate local .gitconfig file if it exists if File.file?(File.expand_path("~/.gitconfig")) From 0ad1ac0ddf1d3e4013cb4ed78435d1d247f41860 Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Tue, 21 Nov 2017 18:47:27 +1300 Subject: [PATCH 05/44] Updating scripts to reflect newer ubuntu version (ubuntu/xenial64) and also versions of other packages. --- .gitignore | 2 + Vagrantfile | 98 ++++++++++--------- helpers/ngxcb.sh | 8 +- helpers/nvm_install.sh | 7 +- helpers/vimrc | 34 +++---- project_setup_scripts/.gitignore | 2 + .../example_project_setup.txt | 10 +- .../freebtc.website.new.localhost.sh | 49 ---------- readme.md | 1 + scripts/android.sh | 20 ++-- scripts/apache.sh | 11 ++- scripts/base.sh | 18 ++-- scripts/composer.sh | 14 +-- scripts/couchbase.sh | 14 +-- scripts/docker.sh | 6 +- scripts/elastichq.sh | 10 +- scripts/git-ftp.sh | 4 +- scripts/go.sh | 6 +- scripts/install_phpmyadmin.sh | 12 +-- scripts/laravel.sh | 6 +- scripts/mongodb.sh | 10 +- scripts/mssql.sh | 6 +- scripts/mysql.sh | 11 +++ scripts/nginx.sh | 14 +-- scripts/nodejs.sh | 8 +- scripts/pgsql.sh | 12 +-- scripts/php.sh | 15 +-- scripts/redis.sh | 2 +- scripts/rvm.sh | 6 +- scripts/screen.sh | 4 +- scripts/symfony.sh | 6 +- scripts/vim.sh | 16 +-- scripts/zeromq.sh | 2 +- setup_projects.sh | 4 +- 34 files changed, 210 insertions(+), 238 deletions(-) delete mode 100644 project_setup_scripts/freebtc.website.new.localhost.sh diff --git a/.gitignore b/.gitignore index ee794cfa..8d51c2f5 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,8 @@ notes.md .vagrant play +*.log +project_setup_scripts/*.sh # editor backup files *~ diff --git a/Vagrantfile b/Vagrantfile index 75cdab5d..bd31b281 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -2,13 +2,14 @@ # vi: set ft=ruby : # Config Github Settings -github_username = "rattfieldnz" -github_repo = "Vaprobash" -github_branch = "1.4.3" -github_url = "https://raw.githubusercontent.com/#{github_username}/#{github_repo}/#{github_branch}" +#github_username = "rattfieldnz" +#github_repo = "Vaprobash" +#github_branch = "1.4.3" +#github_url = "https://raw.githubusercontent.com/#{github_username}/#{github_repo}/#{github_branch}" +github_url="" vm_synced_folder_host = "code" -vm_synced_folder_guest = "/home/vagrant" +vm_synced_folder_guest = "/home/ubuntu" # Because this:https://developer.github.com/changes/2014-12-08-removing-authorizations-token/ # https://github.com/settings/tokens @@ -28,6 +29,7 @@ server_ip = "192.168.22.10" server_cpus = "4" # Cores server_memory = "4096" # MB server_swap = "8192" # Options: false | int (MB) - Guideline: Between one or two times the server_memory +disk_space = "25GB" # UTC for Universal Coordinated Time # EST for Eastern Standard Time @@ -67,17 +69,18 @@ composer_packages = [ # List any global Composer packages that you wa "codeception/codeception:~2.3", "phpspec/phpspec:~4.2", "squizlabs/php_codesniffer:^3.0", - "unitgen/unitgen:dev-master" + "unitgen/unitgen:dev-master", + "theseer/phpdox:^0.1" ] # Default web server document root # Symfony's public directory is assumed "web" # Laravel's public directory is assumed "public" -public_folder = "/home/vagrant/code" +public_folder = "/home/ubuntu/code" -laravel_root_folder = vm_synced_folder_guest + "/code/laravel-test" # Where to install Laravel. Will `composer install` if a composer.json file exists +laravel_root_folder = "#{public_folder}/laravel-test" # Where to install Laravel. Will `composer install` if a composer.json file exists laravel_version = "latest-stable" # If you need a specific version of Laravel, set it here -symfony_root_folder = vm_synced_folder_guest + "/code/symfony-test" # Where to install Symfony. +symfony_root_folder = "#{public_folder}/code/symfony-test" # Where to install Symfony. nodejs_version = "latest" # By default "latest" will equal the latest stable version nodejs_packages = [ # List any global NodeJS packages that you want to install @@ -167,6 +170,11 @@ Vagrant.configure("2") do |config| # Prevent VMs running on Ubuntu to lose internet connection # vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] # vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"] + + # Set initial disk size + if Vagrant.has_plugin?("vagrant-disksize") + config.disksize.size = "#{disk_space}" + end end @@ -196,7 +204,7 @@ Vagrant.configure("2") do |config| # Needs to ensure that the vagrant plugin is installed #config.vm.provider :digital_ocean do |provider, override| # override.ssh.private_key_path = '~/.ssh/id_rsa' - # override.ssh.username = 'vagrant' + # override.ssh.username = 'ubuntu' # override.vm.box = 'digital_ocean' # override.vm.box_url = "https://github.com/smdahlen/vagrant-digitalocean/raw/master/box/digital_ocean.box" # @@ -213,22 +221,22 @@ Vagrant.configure("2") do |config| ########## # Provision Base Packages - config.vm.provision "shell", path: "#{github_url}/scripts/base.sh", args: [github_url, server_swap, server_timezone] + config.vm.provision "shell", path: "./scripts/base.sh", privileged: true, args: [github_url, server_swap, server_timezone] # optimize base box - config.vm.provision "shell", path: "#{github_url}/scripts/base_box_optimizations.sh", privileged: true + config.vm.provision "shell", path: "./scripts/base_box_optimizations.sh", privileged: true # Provision PHP - config.vm.provision "shell", path: "#{github_url}/scripts/php.sh", args: [php_timezone, hhvm, php_version] + config.vm.provision "shell", path: "./scripts/php.sh", args: [php_timezone, hhvm, php_version] # Enable MSSQL for PHP - # config.vm.provision "shell", path: "#{github_url}/scripts/mssql.sh" + # config.vm.provision "shell", path: "./scripts/mssql.sh" # Provision Vim - config.vm.provision "shell", path: "#{github_url}/scripts/vim.sh", args: github_url + config.vm.provision "shell", path: "./scripts/vim.sh", args: github_url # Provision Docker - # config.vm.provision "shell", path: "#{github_url}/scripts/docker.sh", args: "permissions" + # config.vm.provision "shell", path: "./scripts/docker.sh", args: "permissions" #### # Web Servers @@ -237,7 +245,7 @@ Vagrant.configure("2") do |config| ########## # Provision Apache Base - config.vm.provision "shell", path: "#{github_url}/scripts/apache.sh", args: [server_ip, public_folder, hostname, github_url] + config.vm.provision "shell", path: "./scripts/apache.sh", args: [server_ip, public_folder, hostname, github_url] # Provision Nginx Base # config.vm.provision "shell", path: "#{github_url}/scripts/nginx.sh", args: [server_ip, public_folder, hostname, github_url, php_version] @@ -250,13 +258,13 @@ Vagrant.configure("2") do |config| ########## # Provision MySQL - config.vm.provision "shell", path: "#{github_url}/scripts/mysql.sh", args: [mysql_root_password, mysql_version, mysql_enable_remote] + config.vm.provision "shell", path: "./scripts/mysql.sh", args: [mysql_root_password, mysql_version, mysql_enable_remote] # Provision PostgreSQL - config.vm.provision "shell", path: "#{github_url}/scripts/pgsql.sh", args: pgsql_root_password + config.vm.provision "shell", path: "./scripts/pgsql.sh", args: pgsql_root_password # Provision SQLite - config.vm.provision "shell", path: "#{github_url}/scripts/sqlite.sh" + config.vm.provision "shell", path: "./scripts/sqlite.sh" # Provision RethinkDB # config.vm.provision "shell", path: "#{github_url}/scripts/rethinkdb.sh", args: pgsql_root_password @@ -268,13 +276,13 @@ Vagrant.configure("2") do |config| # config.vm.provision "shell", path: "#{github_url}/scripts/couchdb.sh" # Provision MongoDB - config.vm.provision "shell", path: "#{github_url}/scripts/mongodb.sh", args: [mongo_enable_remote, mongo_version] + config.vm.provision "shell", path: "./scripts/mongodb.sh", args: [mongo_enable_remote, mongo_version] # Provision MariaDB - # config.vm.provision "shell", path: "#{github_url}/scripts/mariadb.sh", args: [mysql_root_password, mysql_enable_remote] + # config.vm.provision "shell", path: "./scripts/mariadb.sh", args: [mysql_root_password, mysql_enable_remote] # Provision Neo4J - # config.vm.provision "shell", path: "#{github_url}/scripts/neo4j.sh" + # config.vm.provision "shell", path: "./scripts/neo4j.sh" #### # Search Servers @@ -283,10 +291,10 @@ Vagrant.configure("2") do |config| ########## # Install Elasticsearch - # config.vm.provision "shell", path: "#{github_url}/scripts/elasticsearch.sh", args: [elasticsearch_version] + # config.vm.provision "shell", path: "./scripts/elasticsearch.sh", args: [elasticsearch_version] # Install SphinxSearch - # config.vm.provision "shell", path: "#{github_url}/scripts/sphinxsearch.sh", args: [sphinxsearch_version] + # config.vm.provision "shell", path: "./scripts/sphinxsearch.sh", args: [sphinxsearch_version] #### # Search Server Administration (web-based) @@ -297,7 +305,7 @@ Vagrant.configure("2") do |config| # Install ElasticHQ # Admin for: Elasticsearch # Works on: Apache2, Nginx - # config.vm.provision "shell", path: "#{github_url}/scripts/elastichq.sh" + # config.vm.provision "shell", path: "./scripts/elastichq.sh" #### @@ -307,13 +315,13 @@ Vagrant.configure("2") do |config| ########## # Install Memcached - config.vm.provision "shell", path: "#{github_url}/scripts/memcached.sh" + config.vm.provision "shell", path: "./scripts/memcached.sh" # Provision Redis (without journaling and persistence) # config.vm.provision "shell", path: "#{github_url}/scripts/redis.sh" # Provision Redis (with journaling and persistence) - config.vm.provision "shell", path: "#{github_url}/scripts/redis.sh", args: "persistent" + config.vm.provision "shell", path: "./scripts/redis.sh", args: "persistent" # NOTE: It is safe to run this to add persistence even if originally provisioned without persistence @@ -324,22 +332,22 @@ Vagrant.configure("2") do |config| ########## # Install Beanstalkd - # config.vm.provision "shell", path: "#{github_url}/scripts/beanstalkd.sh" + # config.vm.provision "shell", path: "./scripts/beanstalkd.sh" # Install Heroku Toolbelt # config.vm.provision "shell", path: "https://toolbelt.heroku.com/install-ubuntu.sh" # Install Supervisord - # config.vm.provision "shell", path: "#{github_url}/scripts/supervisord.sh" + # config.vm.provision "shell", path: "./scripts/supervisord.sh" # Install Kibana - # config.vm.provision "shell", path: "#{github_url}/scripts/kibana.sh" + # config.vm.provision "shell", path: "./scripts/kibana.sh" # Install ØMQ - # config.vm.provision "shell", path: "#{github_url}/scripts/zeromq.sh", args: [php_version] + # config.vm.provision "shell", path: "./scripts/zeromq.sh", args: [php_version] # Install RabbitMQ - # config.vm.provision "shell", path: "#{github_url}/scripts/rabbitmq.sh", args: [rabbitmq_user, rabbitmq_password] + # config.vm.provision "shell", path: "./scripts/rabbitmq.sh", args: [rabbitmq_user, rabbitmq_password] #### # Additional Languages @@ -348,13 +356,13 @@ Vagrant.configure("2") do |config| ########## # Install Nodejs - config.vm.provision "shell", path: "#{github_url}/scripts/nodejs.sh", privileged: false, args: nodejs_packages.unshift(nodejs_version, github_url) + config.vm.provision "shell", path: "./scripts/nodejs.sh", privileged: false, args: nodejs_packages.unshift(nodejs_version, github_url) # Install Ruby Version Manager (RVM) - config.vm.provision "shell", path: "#{github_url}/scripts/rvm.sh", privileged: false, args: ruby_gems.unshift(ruby_version) + config.vm.provision "shell", path: "./scripts/rvm.sh", privileged: false, args: ruby_gems.unshift(ruby_version) # Install Go Version Manager (GVM) - # config.vm.provision "shell", path: "#{github_url}/scripts/go.sh", privileged: false, args: [go_version] + # config.vm.provision "shell", path: "./scripts/go.sh", privileged: false, args: [go_version] #### # Frameworks and Tooling @@ -364,28 +372,28 @@ Vagrant.configure("2") do |config| # Provision Composer # You may pass a github auth token as the first argument - config.vm.provision "shell", path: "#{github_url}/scripts/composer.sh", privileged: false, args: [github_pat, composer_packages.join(" ")] + config.vm.provision "shell", path: "./scripts/composer.sh", privileged: false, args: [github_pat, composer_packages.join(" ")] # Provision Laravel - config.vm.provision "shell", path: "#{github_url}/scripts/laravel.sh", privileged: false, args: [server_ip, laravel_root_folder, public_folder, laravel_version] + config.vm.provision "shell", path: "./scripts/laravel.sh", privileged: false, args: [server_ip, laravel_root_folder, public_folder, laravel_version] # Provision Symfony - config.vm.provision "shell", path: "#{github_url}/scripts/symfony.sh", privileged: false, args: [server_ip, symfony_root_folder, public_folder] + config.vm.provision "shell", path: "./scripts/symfony.sh", privileged: false, args: [server_ip, symfony_root_folder, public_folder] # Install Screen - config.vm.provision "shell", path: "#{github_url}/scripts/screen.sh" + config.vm.provision "shell", path: "./scripts/screen.sh" # Install Mailcatcher - config.vm.provision "shell", path: "#{github_url}/scripts/mailcatcher.sh", args: [php_version] + config.vm.provision "shell", path: "./scripts/mailcatcher.sh", args: [php_version] # Install git-ftp - # config.vm.provision "shell", path: "#{github_url}/scripts/git-ftp.sh", privileged: false + # config.vm.provision "shell", path: "./scripts/git-ftp.sh", privileged: false # Install Ansible - # config.vm.provision "shell", path: "#{github_url}/scripts/ansible.sh" + # config.vm.provision "shell", path: "./scripts/ansible.sh" # Install Android - # config.vm.provision "shell", path: "#{github_url}/scripts/android.sh" + # config.vm.provision "shell", path: "./scripts/android.sh" #### # Local Scripts @@ -393,7 +401,7 @@ Vagrant.configure("2") do |config| # Add these to the same directory as the Vagrantfile. ########## # config.vm.provision "shell", path: "./your_script_name.sh" - config.vm.provision "shell", path: "./install_phpmyadmin.sh" + config.vm.provision "shell", path: "./scripts/install_phpmyadmin.sh" ##### # Optional diff --git a/helpers/ngxcb.sh b/helpers/ngxcb.sh index 15f01e0d..2163cca8 100644 --- a/helpers/ngxcb.sh +++ b/helpers/ngxcb.sh @@ -44,7 +44,7 @@ function create_server_block { # Nginx Server Block config for PHP (without using SSL) read -d '' PHP_NO_SSL </dev/null; then echo >&2 "!!! You need to install git" @@ -13,11 +13,12 @@ if [ -d "$NVM_DIR" ]; then cd $NVM_DIR && git pull else # Cloning to $NVM_DIR + mkdir $NVM_DIR git clone https://github.com/creationix/nvm.git $NVM_DIR fi -PROFILE="/home/vagrant/.profile" -SOURCE_STR="\n# This loads NVM\n[[ -s /home/vagrant/.nvm/nvm.sh ]] && . /home/vagrant/.nvm/nvm.sh" +PROFILE="/home/ubuntu/.profile" +SOURCE_STR="\n# This loads NVM\n[[ -s /home/ubuntu/.nvm/nvm.sh ]] && source /home/ubuntu/.nvm/nvm.sh" # Append NVM script to ~/.profile if ! grep -qsc 'nvm.sh' $PROFILE; then diff --git a/helpers/vimrc b/helpers/vimrc index 1aac4583..15900d5f 100644 --- a/helpers/vimrc +++ b/helpers/vimrc @@ -3,31 +3,31 @@ filetype off set encoding=utf-8 set rtp+=~/.vim/bundle/vundle/ -call vundle#rc() +call vundle#begin() " let Vundle manage Vundle -Bundle 'gmarik/vundle' +Plugin 'VundleVim/Vundle.vim' " Bundles Here -Bundle 'altercation/vim-colors-solarized' -Bundle 'plasticboy/vim-markdown' -Bundle 'othree/html5.vim' -Bundle 'scrooloose/nerdtree' -Bundle 'kien/ctrlp.vim' -Bundle 'bling/vim-airline' -Bundle 'airblade/vim-gitgutter' -Bundle 'tpope/vim-fugitive' +Plugin 'altercation/vim-colors-solarized' +Plugin 'plasticboy/vim-markdown' +Plugin 'othree/html5.vim' +Plugin 'scrooloose/nerdtree' +Plugin 'kien/ctrlp.vim' +Plugin 'bling/vim-airline' +Plugin 'airblade/vim-gitgutter' +Plugin 'tpope/vim-fugitive' filetype plugin indent on " "" Brief help -" :BundleList - list configured bundles -" " :BundleInstall(!) - install (update) bundles -" " :BundleSearch(!) foo - search (or refresh cache first) for foo -" " :BundleClean(!) - confirm (or auto-approve) removal of unused bundles -" " -" " see :h vundle for more details or wiki for FAQ -" " NOTE: comments after Bundle commands are not allowed. +" :PluginList - lists configured plugins +" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate +" :PluginSearch foo - searches for foo; append `!` to refresh local cache +" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal +" +" see :h vundle for more details or wiki for FAQ +" Put your non-Plugin stuff after this line " Settings diff --git a/project_setup_scripts/.gitignore b/project_setup_scripts/.gitignore index e7a210ec..2d59fd5d 100644 --- a/project_setup_scripts/.gitignore +++ b/project_setup_scripts/.gitignore @@ -1,3 +1,5 @@ * */ +*.sh +*.log !.gitignore \ No newline at end of file diff --git a/project_setup_scripts/example_project_setup.txt b/project_setup_scripts/example_project_setup.txt index c17d48b6..6b1a32bd 100644 --- a/project_setup_scripts/example_project_setup.txt +++ b/project_setup_scripts/example_project_setup.txt @@ -5,8 +5,8 @@ PROJECT_LOG_FILE=./EXAMPLE_WEB_PROJECT.build.log; echo "" > $PROJECT_LOG_FILE; -echo "Moving into /home/vagrant/code/EXAMPLE_WEB_PROJECT_FOLDER.\n" >> $PROJECT_LOG_FILE; -cd /home/vagrant/code/EXAMPLE_WEB_PROJECT_FOLDER >> $PROJECT_LOG_FILE; +echo "Moving into /home/ubuntu/code/EXAMPLE_WEB_PROJECT_FOLDER.\n" >> $PROJECT_LOG_FILE; +cd /home/ubuntu/code/EXAMPLE_WEB_PROJECT_FOLDER >> $PROJECT_LOG_FILE; echo "Update global Composer first, befire installing/updating packages.\n" composer self-update >> $PROJECT_LOG_FILE; @@ -42,10 +42,10 @@ gulp minifycss && gulp minifyjs >> $PROJECT_LOG_FILE; echo "Chown storage directory for Apache user:group (www-data:www-data).\n" -chown -R www-data:www-data /home/vagrant/code/EXAMPLE_WEB_PROJECT_FOLDER/storage +chown -R www-data:www-data /home/ubuntu/code/EXAMPLE_WEB_PROJECT_FOLDER/storage echo "Make storage directory readable/writeable.\n" -chmod -R 755 /home/vagrant/code/EXAMPLE_WEB_PROJECT_FOLDER/storage +chmod -R 755 /home/ubuntu/code/EXAMPLE_WEB_PROJECT_FOLDER/storage echo "Now create Apache Vhost file and enable site.\n" -sudo vhost -s EXAMPLE_WEB_PROJECT_VHOST_NAME -d /home/vagrant/code/EXAMPLE_WEB_PROJECT_FOLDER/public \ No newline at end of file +sudo vhost -s EXAMPLE_WEB_PROJECT_VHOST_NAME -d /home/ubuntu/code/EXAMPLE_WEB_PROJECT_FOLDER/public \ No newline at end of file diff --git a/project_setup_scripts/freebtc.website.new.localhost.sh b/project_setup_scripts/freebtc.website.new.localhost.sh deleted file mode 100644 index b27b446e..00000000 --- a/project_setup_scripts/freebtc.website.new.localhost.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env bash - -PROJECT_LOG_FILE=./freebtc.website.new.localhost.build.log; -echo "" > $PROJECT_LOG_FILE; - -echo "Moving into /home/vagrant/code/freebtc.website.new.localhost.\n" >> $PROJECT_LOG_FILE; -cd /home/vagrant/code/freebtc.website.new.localhost >> $PROJECT_LOG_FILE; - -echo "Update global Composer first, befire installing/updating packages.\n" -composer self-update >> $PROJECT_LOG_FILE; - -echo "Install Composer packages for project.\n" >> $PROJECT_LOG_FILE; -composer install >> $PROJECT_LOG_FILE; - -echo "If Composer packages are already installed for project, let's update them.\n" >> $PROJECT_LOG_FILE; -composer update >> $PROJECT_LOG_FILE; - -echo "Compile back-end assets.\n" >> $PROJECT_LOG_FILE; -composer dump-autoload --optimize && -php artisan optimize && -php artisan clear-compiled && -php artisan cache:clear && -php artisan view:clear && -php artisan laroute:generate && -php artisan key:generate >> $PROJECT_LOG_FILE; - -echo "Run database migrations, and seed with data (errors will be logged).\n" >> $PROJECT_LOG_FILE; -php artisan migrate --seed >> $PROJECT_LOG_FILE; - -echo "Install NPM packages for project.\n" >> $PROJECT_LOG_FILE; -npm install --force --save >> $PROJECT_LOG_FILE - -echo "Install front-end packages via Bower.\n" >> $PROJECT_LOG_FILE; -bower install --save --force >> $PROJECT_LOG_FILE; - -echo "Compile front-end assets.\n" >> $PROJECT_LOG_FILE; -gulp copyfiles && -gulp && -gulp minifycss && -gulp minifyjs >> $PROJECT_LOG_FILE; - -echo "Chown storage directory for Apache user:group (www-data:www-data).\n" -chown -R www-data:www-data /home/vagrant/code/freebtc.website.new.localhost/storage - -echo "Make storage directory readable/writeable.\n" -chmod -R 755 /home/vagrant/code/freebtc.website.new.localhost/storage - -echo "Now create Apache Vhost file and enable site.\n" -sudo vhost -s freebtc.website.new.localhost -d /home/vagrant/code/freebtc.website.new.localhost/public \ No newline at end of file diff --git a/readme.md b/readme.md index 3cf0b714..d5321f24 100644 --- a/readme.md +++ b/readme.md @@ -24,6 +24,7 @@ Some further assumptions and self-imposed restrictions. If you find yourself nee * Vagrant `1.5.0`+ * Use `vagrant -v` to check your version * Vitualbox or VMWare Fusion +* Vagrant plugin `vagrant-disksize` ## Instructions diff --git a/scripts/android.sh b/scripts/android.sh index 913b1fa9..6c8d07a1 100644 --- a/scripts/android.sh +++ b/scripts/android.sh @@ -12,25 +12,25 @@ sudo apt-get install -y openjdk-7-jdk ant expect curl -O $ANDROID_SDK tar -xzvf $ANDROID_SDK_FILENAME -# Add permissions for vagrant user and removing .tgz file -sudo chown -R vagrant android-sdk-linux/ +# Add permissions for ubuntu user and removing .tgz file +sudo chown -R ubuntu android-sdk-linux/ sudo rm -rf $ANDROID_SDK_FILENAME # Add new values of variables environment in .bashrc -echo "" >> /home/vagrant/.bashrc -echo "JAVA_HOME=/usr/lib/jvm/java-7-openjdk-i386/jre/bin/java" >> /home/vagrant/.bashrc -echo "ANDROID_HOME=~/android-sdk-linux" >> /home/vagrant/.bashrc -echo "export PATH=\$PATH:~/android-sdk-linux/tools:~/android-sdk-linux/platform-tools" >> /home/vagrant/.bashrc +echo "" >> /home/ubuntu/.bashrc +echo "JAVA_HOME=/usr/lib/jvm/java-7-openjdk-i386/jre/bin/java" >> /home/ubuntu/.bashrc +echo "ANDROID_HOME=~/android-sdk-linux" >> /home/ubuntu/.bashrc +echo "export PATH=\$PATH:~/android-sdk-linux/tools:~/android-sdk-linux/platform-tools" >> /home/ubuntu/.bashrc expect -c ' set timeout -1 ; -spawn /home/vagrant/android-sdk-linux/tools/android update sdk -u --all --filter platform-tool,android-19,build-tools-19.1.0 +spawn /home/ubuntu/android-sdk-linux/tools/android update sdk -u --all --filter platform-tool,android-19,build-tools-19.1.0 expect { "Do you accept the license" { exp_send "y\r" ; exp_continue } eof } ' -sudo /home/vagrant/android-sdk-linux/platform-tools/adb kill-server -sudo /home/vagrant/android-sdk-linux/platform-tools/adb start-server -sudo /home/vagrant/android-sdk-linux/platform-tools/adb devices +sudo /home/ubuntu/android-sdk-linux/platform-tools/adb kill-server +sudo /home/ubuntu/android-sdk-linux/platform-tools/adb start-server +sudo /home/ubuntu/android-sdk-linux/platform-tools/adb devices diff --git a/scripts/apache.sh b/scripts/apache.sh index f52c4450..8bbeafce 100644 --- a/scripts/apache.sh +++ b/scripts/apache.sh @@ -16,13 +16,13 @@ echo ">>> Installing Apache Server" [[ -z $1 ]] && { echo "!!! IP address not set. Check the Vagrant file."; exit 1; } if [[ -z $2 ]]; then - public_folder="/vagrant" + public_folder="/home/ubuntu/code" else public_folder="$2" fi if [[ -z $4 ]]; then - github_url="https://raw.githubusercontent.com/fideloper/Vaprobash/master" + github_url="https://raw.githubusercontent.com/rattfieldnz/Vaprobash/master" else github_url="$4" fi @@ -42,14 +42,14 @@ sudo apt-get install -qq apache2 echo ">>> Configuring Apache" -# Add vagrant user to www-data group -sudo usermod -a -G www-data vagrant +# Add ubuntu user to www-data group +sudo usermod -a -G www-data ubuntu # Apache Config # On separate lines since some may cause an error # if not installed sudo a2dismod mpm_prefork mpm_worker -sudo a2dismod php5 +sudo a2dismod php7.1 sudo a2enmod rewrite actions ssl curl --silent -L $github_url/helpers/vhost.sh > vhost sudo chmod guo+x vhost @@ -70,4 +70,5 @@ else sudo sed -i "s@ProxyPassMatch@#ProxyPassMatch@" /etc/apache2/sites-available/$1.xip.io.conf fi +sudo a2enmod php7.1 sudo service apache2 restart diff --git a/scripts/base.sh b/scripts/base.sh index 803ac059..d74d7353 100644 --- a/scripts/base.sh +++ b/scripts/base.sh @@ -1,26 +1,26 @@ #!/usr/bin/env bash -echo "Setting Timezone & Locale to $3 & en_US.UTF-8" +echo "Setting Timezone & Locale to $3 & en_NZ.UTF-8" sudo ln -sf /usr/share/zoneinfo/$3 /etc/localtime sudo apt-get install -qq language-pack-en -sudo locale-gen en_US -sudo update-locale LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 +sudo locale-gen en_NZ +sudo update-locale LANG=en_NZ.UTF-8 LC_CTYPE=en_NZ.UTF-8 echo ">>> Installing Base Packages" if [[ -z $1 ]]; then - github_url="https://raw.githubusercontent.com/fideloper/Vaprobash/master" + github_url="https://raw.githubusercontent.com/rattfieldnz/Vaprobash/master" else github_url="$1" fi # Update -sudo apt-get update +sudo apt-get update && sudo apt-get -f -y upgrade && sudo apt-get -f -y dist-upgrade # Install base packages # -qq implies -y --force-yes -sudo apt-get install -qq curl unzip git-core ack-grep software-properties-common build-essential cachefilesd +sudo apt-get install -qq vim build-essential python-software-properties git zip unzip tcl curl git-core ack-grep software-properties-common cachefilesd virtualbox-guest-dkms echo ">>> Installing *.xip.io self-signed SSL" @@ -30,10 +30,10 @@ DOMAIN="*.xip.io" PASSPHRASE="vaprobash" SUBJ=" -C=US -ST=Connecticut +C=NZ +ST=Otago O=Vaprobash -localityName=New Haven +localityName=Dunedin commonName=$DOMAIN organizationalUnitName= emailAddress= diff --git a/scripts/composer.sh b/scripts/composer.sh index 63638916..96bda7cb 100644 --- a/scripts/composer.sh +++ b/scripts/composer.sh @@ -32,11 +32,11 @@ if [[ $COMPOSER_IS_INSTALLED -ne 0 ]]; then printf "\n# Add an alias for sudo\n%s\n# Use HHVM when using Composer\n%s" \ "alias sudo=\"sudo \"" \ "alias composer=\"hhvm -v ResourceLimit.SocketDefaultTimeout=30 -v Http.SlowQueryThreshold=30000 -v Eval.Jit=false /usr/local/bin/composer\"" \ - >> "/home/vagrant/.profile" + >> "/home/ubuntu/.profile" # Resource .profile # Doesn't seem to work do! The alias is only usefull from the moment you log in: vagrant ssh - . /home/vagrant/.profile + . /home/ubuntu/.profile else # Install Composer curl -sS https://getcomposer.org/installer | php @@ -66,15 +66,15 @@ if [[ ! -z $COMPOSER_PACKAGES ]]; then echo " " ${COMPOSER_PACKAGES[@]} # Add Composer's Global Bin to ~/.profile path - if [[ -f "/home/vagrant/.profile" ]]; then - if ! grep -qsc 'COMPOSER_HOME=' /home/vagrant/.profile; then + if [[ -f "/home/ubuntu/.profile" ]]; then + if ! grep -qsc 'COMPOSER_HOME=' /home/ubuntu/.profile; then # Ensure COMPOSER_HOME variable is set. This isn't set by Composer automatically - printf "\n\nCOMPOSER_HOME=\"/home/vagrant/.composer\"" >> /home/vagrant/.profile + printf "\n\nCOMPOSER_HOME=\"/home/ubuntu/.composer\"" >> /home/ubuntu/.profile # Add composer home vendor bin dir to PATH to run globally installed executables - printf "\n# Add Composer Global Bin to PATH\n%s" 'export PATH=$PATH:$COMPOSER_HOME/vendor/bin' >> /home/vagrant/.profile + printf "\n# Add Composer Global Bin to PATH\n%s" 'export PATH=$PATH:$COMPOSER_HOME/ubuntu/bin' >> /home/ubuntu/.profile # Source the .profile to pick up changes - . /home/vagrant/.profile + . /home/ubuntu/.profile fi fi diff --git a/scripts/couchbase.sh b/scripts/couchbase.sh index 3ddd5a95..df7bfe90 100644 --- a/scripts/couchbase.sh +++ b/scripts/couchbase.sh @@ -4,7 +4,7 @@ echo ">>> Installing Couchbase Server" # Set some variables COUCHBASE_EDITION=community -COUCHBASE_VERSION=2.2.0 # Check http://http://www.couchbase.com/download/ for latest version +COUCHBASE_VERSION=5.0 # Check https://www.couchbase.com/downloads for latest version COUCHBASE_ARCH=x86_64 @@ -18,7 +18,7 @@ PHP_IS_INSTALLED=$? dpkg -s php-pear PEAR_IS_INSTALLED=$? -dpkg -s php5-dev +dpkg -s php7.1-dev PHPDEV_IS_INSTALLED=$? if [ ${PHP_IS_INSTALLED} -eq 0 ]; then @@ -28,7 +28,7 @@ if [ ${PHP_IS_INSTALLED} -eq 0 ]; then fi if [ ${PHPDEV_IS_INSTALLED} -eq 1 ]; then - sudo apt-get -qq install php5-dev + sudo apt-get -qq install php7.1-dev fi sudo wget --quiet -O/etc/apt/sources.list.d/couchbase.list http://packages.couchbase.com/ubuntu/couchbase-ubuntu1204.list @@ -36,12 +36,12 @@ if [ ${PHP_IS_INSTALLED} -eq 0 ]; then sudo apt-get update sudo apt-get -qq install libcouchbase2-libevent libcouchbase-dev - sudo pecl install couchbase-1.2.2 - sudo cat > /etc/php5/mods-available/couchbase.ini << EOF + sudo pecl install couchbase-${COUCHBASE_VERSION} + sudo cat > /etc/php/7.1/mods-available/couchbase.ini << EOF ; configuration for php couchbase module ; priority=30 extension=couchbase.so EOF - sudo php5enmod couchbase - sudo service php5-fpm restart + sudo php7.1enmod couchbase + sudo service php7.1-fpm restart fi \ No newline at end of file diff --git a/scripts/docker.sh b/scripts/docker.sh index 2a51764b..e0e8a283 100644 --- a/scripts/docker.sh +++ b/scripts/docker.sh @@ -13,12 +13,12 @@ sudo apt-get update # -qq implies -y --force-yes sudo apt-get install -qq lxc-docker -# Make the vagrant user able to interact with docker without sudo +# Make the ubuntu user able to interact with docker without sudo if [ ! -z "$1" ]; then if [ "$1" == "permissions" ]; then - echo ">>> Adding vagrant user to docker group" + echo ">>> Adding ubuntu user to docker group" - sudo usermod -a -G docker vagrant + sudo usermod -a -G docker ubuntu fi # permissions fi # arg check diff --git a/scripts/elastichq.sh b/scripts/elastichq.sh index 687e5b1a..652cbc6e 100644 --- a/scripts/elastichq.sh +++ b/scripts/elastichq.sh @@ -37,9 +37,9 @@ fi # Set and enable configuration for Nginx if [ $NGINX_IS_INSTALLED -eq 0 ]; then - sudo ngxdis vagrant - sudo sed -i '$ d' /etc/nginx/sites-available/vagrant -sudo tee -a /etc/nginx/sites-available/vagrant > /dev/null <<'EOF' + sudo ngxdis ubuntu + sudo sed -i '$ d' /etc/nginx/sites-available/ubuntu +sudo tee -a /etc/nginx/sites-available/ubuntu > /dev/null <<'EOF' location /elastichq { root /usr/share/; @@ -47,7 +47,7 @@ sudo tee -a /etc/nginx/sites-available/vagrant > /dev/null <<'EOF' location ~ ^/elastichq/(.+\.php)$ { try_files $uri =404; root /usr/share/; - fastcgi_pass unix:/var/run/php5-fpm.sock; + fastcgi_pass unix:/var/run/php7.1-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include /etc/nginx/fastcgi_params; @@ -62,7 +62,7 @@ sudo tee -a /etc/nginx/sites-available/vagrant > /dev/null <<'EOF' } } EOF - sudo ngxen vagrant + sudo ngxen ubuntu # Reload Nginx to load in configuration sudo service nginx reload diff --git a/scripts/git-ftp.sh b/scripts/git-ftp.sh index 4cf6abe1..a95447b4 100644 --- a/scripts/git-ftp.sh +++ b/scripts/git-ftp.sh @@ -21,10 +21,10 @@ fi echo ">>> Installing git-ftp"; # Clone git-ftp into .git-ftp folder -git clone https://github.com/git-ftp/git-ftp.git /home/vagrant/.git-ftp +git clone https://github.com/git-ftp/git-ftp.git /home/ubuntu/.git-ftp # Move to the .git-ftp folder -cd /home/vagrant/.git-ftp +cd /home/ubuntu/.git-ftp # Install git-ftp sudo make install diff --git a/scripts/go.sh b/scripts/go.sh index d8ab9dcb..9cc32371 100755 --- a/scripts/go.sh +++ b/scripts/go.sh @@ -2,9 +2,9 @@ # check if a go version is set if [[ -z $1 ]]; then - GO_VERSION="latest" + GO_VERSION="latest" else - GO_VERSION=$1 + GO_VERSION=$1 fi # Check if gvm is installed @@ -18,7 +18,7 @@ else echo "Installing Go version manager" sudo apt-get install -qq curl git mercurial make binutils bison build-essential bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer) - source /home/vagrant/.gvm/scripts/gvm + source /home/ubuntu/.gvm/scripts/gvm if [[ $GO_VERSION -eq "latest" ]]; then GO_VERSION=`curl -L 'https://golang.org/' | grep 'Build version' | awk '{print $3}' | awk -F\< '{ print $1 }' | rev | cut -c 2- | rev` diff --git a/scripts/install_phpmyadmin.sh b/scripts/install_phpmyadmin.sh index 58b09dfc..3feb7e6a 100644 --- a/scripts/install_phpmyadmin.sh +++ b/scripts/install_phpmyadmin.sh @@ -1,15 +1,9 @@ #!/usr/bin/env bash -unset UCF_FORCE_CONFFOLD; -export UCF_FORCE_CONFFNEW=YES; -ucf --purge /boot/grub/menu.lst; - -export DEBIAN_FRONTEND=noninteractive; - echo "Lets update our packages list, and currently installed packages...\n"; sudo apt-get update; -sudo DEBIAN_FRONTEND=noninteractive apt-get -f -y -o DPkg::options::="--force-confdef" -o DPkg::options::="--force-confold" --force-yes -fuy upgrade; -sudo DEBIAN_FRONTEND=noninteractive apt-get -f -y -o DPkg::options::="--force-confdef" -o DPkg::options::="--force-confold" --force-yes -fuy dist-upgrade; +sudo apt-get -f -y upgrade; +sudo apt-get -f -y dist-upgrade; echo "Set-up MySQL and phpMyAdmin (for development purposes ONLY).\n" DBHOST=localhost @@ -22,7 +16,7 @@ echo 'phpmyadmin phpmyadmin/app-password-confirm password $DBPASSWD' | debconf-s echo 'phpmyadmin phpmyadmin/mysql/admin-pass password $DBPASSWD' | debconf-set-selections; echo 'phpmyadmin phpmyadmin/mysql/app-pass password $DBPASSWD' | debconf-set-selections; echo 'phpmyadmin phpmyadmin/reconfigure-webserver multiselect none' | debconf-set-selections; -sudo DEBIAN_FRONTEND=noninteractive apt-get -f -y -o DPkg::options::="--force-confdef" -o DPkg::options::="--force-confold" install phpmyadmin; +sudo apt-get -f -y install phpmyadmin; echo "Set-up Apache Vhost file (assuming phpMyAdmin has been installed to /usr/share/phpmyadmin.\n" if [ -d "/usr/share/phpmyadmin" ]; then diff --git a/scripts/laravel.sh b/scripts/laravel.sh index 3298e805..a8ef9b91 100644 --- a/scripts/laravel.sh +++ b/scripts/laravel.sh @@ -20,7 +20,7 @@ composer -v > /dev/null 2>&1 || { printf "!!! Composer is not installed.\n In # Check if Laravel root is set. If not set use default if [[ -z $2 ]]; then - laravel_root_folder="/vagrant/laravel" + laravel_root_folder="/home/ubuntu/code/laravel-test" else laravel_root_folder="$2" fi @@ -58,7 +58,7 @@ if [[ ! -f "$laravel_root_folder/composer.json" ]]; then fi fi else - # Go to vagrant folder + # Go to ubuntu folder cd $laravel_root_folder if [[ $HHVM_IS_INSTALLED -eq 0 ]]; then @@ -74,7 +74,7 @@ fi if [[ $NGINX_IS_INSTALLED -eq 0 ]]; then # Change default vhost created - sudo sed -i "s@root /vagrant@root $laravel_public_folder@" /etc/nginx/sites-available/vagrant + sudo sed -i "s@root /ubuntu@root $laravel_public_folder@" /etc/nginx/sites-available/ubuntu sudo service nginx reload fi diff --git a/scripts/mongodb.sh b/scripts/mongodb.sh index d245ab7f..30c02b29 100644 --- a/scripts/mongodb.sh +++ b/scripts/mongodb.sh @@ -33,7 +33,7 @@ PHP_IS_INSTALLED=$? if [ $PHP_IS_INSTALLED -eq 0 ]; then # install dependencies - sudo apt-get -y install php-pear php5-dev + sudo apt-get -y install php-pear php7.1-dev # install php extension echo "no" > answers.txt @@ -41,9 +41,9 @@ if [ $PHP_IS_INSTALLED -eq 0 ]; then rm answers.txt # add extension file and restart service - echo 'extension=mongo.so' | sudo tee /etc/php5/mods-available/mongo.ini + echo 'extension=mongo.so' | sudo tee /etc/php/7.1/mods-available/mongo.ini - ln -s /etc/php5/mods-available/mongo.ini /etc/php5/fpm/conf.d/mongo.ini - ln -s /etc/php5/mods-available/mongo.ini /etc/php5/cli/conf.d/mongo.ini - sudo service php5-fpm restart + ln -s /etc/php/7.1/mods-available/mongo.ini /etc/php/7.1/fpm/conf.d/mongo.ini + ln -s /etc/php/7.1/mods-available/mongo.ini /etc/php/7.1/cli/conf.d/mongo.ini + sudo service php7.1-fpm restart fi diff --git a/scripts/mssql.sh b/scripts/mssql.sh index 48c3986c..f97f7ed5 100644 --- a/scripts/mssql.sh +++ b/scripts/mssql.sh @@ -9,7 +9,7 @@ sudo apt-get update # Install PHP MSSQL # -qq implies -y --force-yes -sudo apt-get install -qq php5-mssql +sudo apt-get install -qq php7.1-mssql echo ">>> Installing freeTDS for MSSQL" @@ -21,5 +21,5 @@ echo ">>> Installing UnixODBC for MSSQL" # Install unixodbc sudo apt-get install -qq unixodbc unixodbc-dev -# Restart php5-fpm -sudo service php5-fpm restart \ No newline at end of file +# Restart php7.1-fpm +sudo service php7.1-fpm restart \ No newline at end of file diff --git a/scripts/mysql.sh b/scripts/mysql.sh index 755e5191..860bcca3 100644 --- a/scripts/mysql.sh +++ b/scripts/mysql.sh @@ -17,6 +17,17 @@ if [ $2 == "5.6" ]; then mysql_package=mysql-server-5.6 fi +if [ $2 == "5.7" ]; then + # Add repo for MySQL 5.7 + sudo add-apt-repository -y ppa:ondrej/mysql-5.7 + + # Update Again + sudo apt-get update + + # Change package + mysql_package=mysql-server-5.7 +fi + # Install MySQL without password prompt # Set username and password to 'root' sudo debconf-set-selections <<< "mysql-server mysql-server/root_password password $1" diff --git a/scripts/nginx.sh b/scripts/nginx.sh index dcc94668..c9911b2f 100644 --- a/scripts/nginx.sh +++ b/scripts/nginx.sh @@ -16,7 +16,7 @@ echo ">>> Installing Nginx" [[ -z $1 ]] && { echo "!!! IP address not set. Check the Vagrant file."; exit 1; } if [[ -z $2 ]]; then - public_folder="/vagrant" + public_folder="/home/ubuntu/code" else public_folder="$2" fi @@ -29,7 +29,7 @@ else fi if [[ -z $4 ]]; then - github_url="https://raw.githubusercontent.com/fideloper/Vaprobash/master" + github_url="https://raw.githubusercontent.com/rattfieldnz/Vaprobash/master" else github_url="$4" fi @@ -49,13 +49,13 @@ sudo apt-get install -qq nginx # Turn off sendfile to be more compatible with Windows, which can't use NFS sed -i 's/sendfile on;/sendfile off;/' /etc/nginx/nginx.conf -# Set run-as user for PHP5-FPM processes to user/group "vagrant" +# Set run-as user for PHP5-FPM processes to user/group "ubuntu" # to avoid permission errors from apps writing to files -sed -i "s/user www-data;/user vagrant;/" /etc/nginx/nginx.conf +sed -i "s/user www-data;/user ubuntu;/" /etc/nginx/nginx.conf sed -i "s/# server_names_hash_bucket_size.*/server_names_hash_bucket_size 64;/" /etc/nginx/nginx.conf -# Add vagrant user to www-data group -usermod -a -G www-data vagrant +# Add ubuntu user to www-data group +usermod -a -G www-data ubuntu # Nginx enabling and disabling virtual hosts curl --silent -L $github_url/helpers/ngxen.sh > ngxen @@ -64,7 +64,7 @@ curl --silent -L $github_url/helpers/ngxcb.sh > ngxcb sudo chmod guo+x ngxen ngxdis ngxcb sudo mv ngxen ngxdis ngxcb /usr/local/bin -# Create Nginx Server Block named "vagrant" and enable it +# Create Nginx Server Block named "ubuntu" and enable it sudo ngxcb -d $public_folder -s "$1.xip.io$hostname" -e # Disable "default" diff --git a/scripts/nodejs.sh b/scripts/nodejs.sh index b801384c..b9ebda2f 100644 --- a/scripts/nodejs.sh +++ b/scripts/nodejs.sh @@ -23,7 +23,7 @@ elif [[ $NUMBER_OF_ARG -eq 2 ]]; then else # Default Nodejs version when nothing is given NODEJS_VERSION=latest - GITHUB_URL="https://raw.githubusercontent.com/fideloper/Vaprobash/master" + GITHUB_URL="https://raw.githubusercontent.com/rattfieldnz/Vaprobash/master" fi # True, if Node is not installed @@ -32,12 +32,12 @@ if [[ $NODE_IS_INSTALLED -ne 0 ]]; then echo ">>> Installing Node Version Manager" # Install NVM - curl --silent -L $GITHUB_URL/helpers/nvm_install.sh | sh + curl --silent -L $GITHUB_URL/helpers/nvm_install.sh | sh # Re-source user profiles # if they exist - if [[ -f "/home/vagrant/.profile" ]]; then - . /home/vagrant/.profile + if [[ -f "/home/ubuntu/.profile" ]]; then + source /home/ubuntu/.profile fi echo ">>> Installing Node.js version $NODEJS_VERSION" diff --git a/scripts/pgsql.sh b/scripts/pgsql.sh index 53834e16..cd315a48 100644 --- a/scripts/pgsql.sh +++ b/scripts/pgsql.sh @@ -5,7 +5,7 @@ echo ">>> Installing PostgreSQL" [[ -z "$1" ]] && { echo "!!! PostgreSQL root password not set. Check the Vagrant file."; exit 1; } # Set some variables -POSTGRE_VERSION=9.4 +POSTGRE_VERSION=10 # Add PostgreSQL GPG public key # to get latest stable @@ -14,7 +14,7 @@ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt- # Add PostgreSQL Apt repository # to get latest stable sudo touch /etc/apt/sources.list.d/pgdg.list -sudo echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list +sudo echo "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list # Update Apt repos sudo apt-get update @@ -35,12 +35,12 @@ sudo sed -i "s/#listen_addresses = 'localhost'/listen_addresses = '*'/g" /etc/po echo "host all all 0.0.0.0/0 md5" | sudo tee -a /etc/postgresql/$POSTGRE_VERSION/main/pg_hba.conf sudo service postgresql start -# Create new superuser "vagrant" -sudo -u postgres createuser -s vagrant +# Create new superuser "ubuntu" +sudo -u postgres createuser -s ubuntu # Create new user "root" w/ defined password -# Not a superuser, just tied to new db "vagrant" -sudo -u postgres psql -c "CREATE ROLE root LOGIN UNENCRYPTED PASSWORD '$1' NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION;" +# Not a superuser, just tied to new db "ubuntu" +sudo -u postgres psql -c "CREATE ROLE root LOGIN PASSWORD '$1' NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION;" # Make sure changes are reflected by restarting sudo service postgresql restart diff --git a/scripts/php.sh b/scripts/php.sh index 8a1cd814..cbbc7fc9 100644 --- a/scripts/php.sh +++ b/scripts/php.sh @@ -12,7 +12,7 @@ if [[ $HHVM == "true" ]]; then # Get key and add to sources wget --quiet -O - http://dl.hhvm.com/conf/hhvm.gpg.key | sudo apt-key add - - echo deb http://dl.hhvm.com/ubuntu trusty main | sudo tee /etc/apt/sources.list.d/hhvm.list + echo deb http://dl.hhvm.com/ubuntu xenial main | sudo tee /etc/apt/sources.list.d/hhvm.list # Update sudo apt-get update @@ -39,7 +39,8 @@ else # Install PHP # -qq implies -y --force-yes - sudo apt-get install -qq php${PHP_VERSION}-cli php${PHP_VERSION}-fpm php${PHP_VERSION}-mysql php${PHP_VERSION}-pgsql php${PHP_VERSION}-sqlite php${PHP_VERSION}-curl php${PHP_VERSION}-gd php${PHP_VERSION}-gmp php${PHP_VERSION}-mcrypt php${PHP_VERSION}-memcached php${PHP_VERSION}-imagick php${PHP_VERSION}-intl php${PHP_VERSION}-mbstring php${PHP_VERSION}-xml php-xdebug + # Install PHP module for Apache + sudo apt-get install -qq libapache2-mod-php${PHP_VERSION} php${PHP_VERSION}-cli php${PHP_VERSION}-fpm php${PHP_VERSION}-mysql php${PHP_VERSION}-pgsql php${PHP_VERSION}-sqlite php${PHP_VERSION}-curl php${PHP_VERSION}-gd php${PHP_VERSION}-gmp php${PHP_VERSION}-mcrypt php${PHP_VERSION}-memcached php${PHP_VERSION}-imagick php${PHP_VERSION}-intl php${PHP_VERSION}-mbstring php${PHP_VERSION}-xml php-xdebug # Set PHP FPM to listen on TCP instead of Socket sudo sed -i "s/listen =.*/listen = 127.0.0.1:9000/" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf @@ -47,13 +48,13 @@ else # Set PHP FPM allowed clients IP address sudo sed -i "s/;listen.allowed_clients/listen.allowed_clients/" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf - # Set run-as user for PHP5-FPM processes to user/group "vagrant" + # Set run-as user for PHP5-FPM processes to user/group "ubuntu" # to avoid permission errors from apps writing to files - sudo sed -i "s/user = www-data/user = vagrant/" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf - sudo sed -i "s/group = www-data/group = vagrant/" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf + sudo sed -i "s/user = www-data/user = ubuntu/" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf + sudo sed -i "s/group = www-data/group = ubuntu/" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf - sudo sed -i "s/listen\.owner.*/listen.owner = vagrant/" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf - sudo sed -i "s/listen\.group.*/listen.group = vagrant/" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf + sudo sed -i "s/listen\.owner.*/listen.owner = ubuntu/" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf + sudo sed -i "s/listen\.group.*/listen.group = ubuntu/" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf sudo sed -i "s/listen\.mode.*/listen.mode = 0666/" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf diff --git a/scripts/redis.sh b/scripts/redis.sh index 436e7cf4..9c2983ca 100644 --- a/scripts/redis.sh +++ b/scripts/redis.sh @@ -3,7 +3,7 @@ echo ">>> Installing Redis" # Add repository -sudo apt-add-repository ppa:rwky/redis -y +sudo apt-add-repository ppa:chris-lea/redis-server -y # Install Redis # -qq implies -y --force-yes diff --git a/scripts/rvm.sh b/scripts/rvm.sh index 99707e77..029d5594 100644 --- a/scripts/rvm.sh +++ b/scripts/rvm.sh @@ -45,11 +45,11 @@ else fi # Re-source RVM - . /home/vagrant/.rvm/scripts/rvm + . /home/ubuntu/.rvm/scripts/rvm # Re-source .profile if exists - if [[ -f "/home/vagrant/.profile" ]]; then - . /home/vagrant/.profile + if [[ -f "/home/ubuntu/.profile" ]]; then + . /home/ubuntu/.profile fi fi diff --git a/scripts/screen.sh b/scripts/screen.sh index 76fef791..1b7aaee0 100644 --- a/scripts/screen.sh +++ b/scripts/screen.sh @@ -5,5 +5,5 @@ echo ">>> Installing Screen" # Screen # -qq implies -y --force-yes sudo apt-get install -qq screen -sudo touch /home/vagrant/.screenrc -sudo echo -e "startup_message off\ncaption always '%{= dg} %H %{G}%=%?%{d}%-w%?%{r}(%{d}%n %t%? {%u} %?%{r})%{d}%?%+w%?%=%{G} %{B}%M %d %c:%s '" >> /home/vagrant/.screenrc +sudo touch /home/ubuntu/.screenrc +sudo echo -e "startup_message off\ncaption always '%{= dg} %H %{G}%=%?%{d}%-w%?%{r}(%{d}%n %t%? {%u} %?%{r})%{d}%?%+w%?%=%{G} %{B}%M %d %c:%s '" >> /home/ubuntu/.screenrc diff --git a/scripts/symfony.sh b/scripts/symfony.sh index e540c747..5034a200 100755 --- a/scripts/symfony.sh +++ b/scripts/symfony.sh @@ -13,7 +13,7 @@ composer -v > /dev/null 2>&1 || { printf "!!! Composer is not installed.\n In # Check if Symfony root is set. If not set use default if [ -z "$2" ]; then - symfony_root_folder="/vagrant/symfony" + symfony_root_folder="/home/ubuntu/code/symfony-test" else symfony_root_folder="$2" fi @@ -47,7 +47,7 @@ if [ ! -f "$symfony_root_folder/composer.json" ]; then composer create-project --prefer-dist symfony/framework-standard-edition $symfony_root_folder fi else - # Go to vagrant folder + # Go to ubuntu folder cd $symfony_root_folder # Install Symfony @@ -70,7 +70,7 @@ sed -i "s/'127.0.0.1',$/'127.0.0.1', '$host_ip',/" $symfony_public_folder/config if [ $NGINX_IS_INSTALLED -eq 0 ]; then # Change default vhost created - sudo sed -i "s@root /vagrant@root $symfony_public_folder@" /etc/nginx/sites-available/vagrant + sudo sed -i "s@root /ubuntu@root $symfony_public_folder@" /etc/nginx/sites-available/ubuntu sudo service nginx reload fi diff --git a/scripts/vim.sh b/scripts/vim.sh index ca349819..5c81eca3 100644 --- a/scripts/vim.sh +++ b/scripts/vim.sh @@ -3,22 +3,22 @@ echo ">>> Setting up Vim" if [[ -z $1 ]]; then - github_url="https://raw.githubusercontent.com/fideloper/Vaprobash/master" + github_url="https://raw.githubusercontent.com/rattfieldnz/Vaprobash/master" else github_url="$1" fi # Create directories needed for some .vimrc settings -mkdir -p /home/vagrant/.vim/backup -mkdir -p /home/vagrant/.vim/swap +mkdir -p /home/ubuntu/.vim/backup +mkdir -p /home/ubuntu/.vim/swap # Install Vundle and set owner of .vim files -git clone https://github.com/gmarik/vundle.git /home/vagrant/.vim/bundle/vundle -sudo chown -R vagrant:vagrant /home/vagrant/.vim +git clone https://github.com/VundleVim/Vundle.vim.git /home/ubuntu/.vim/bundle/vundle +sudo chown -R ubuntu:ubuntu /home/ubuntu/.vim # Grab .vimrc and set owner -curl --silent -L $github_url/helpers/vimrc > /home/vagrant/.vimrc -sudo chown vagrant:vagrant /home/vagrant/.vimrc +curl --silent -L $github_url/helpers/vimrc > /home/ubuntu/.vimrc +sudo chown ubuntu:ubuntu /home/ubuntu/.vimrc # Install Vundle Bundles -sudo su - vagrant -c 'vim +BundleInstall +qall' +sudo su - ubuntu -c 'vim +BundleInstall +qall' diff --git a/scripts/zeromq.sh b/scripts/zeromq.sh index 21ea1cb8..390aeb82 100644 --- a/scripts/zeromq.sh +++ b/scripts/zeromq.sh @@ -12,7 +12,7 @@ echo ">>> Installing ØMQ" sudo add-apt-repository -qq pp:chris-lea/zeromq sudo apt-get update -qq -sudo apt-get install -qq libtool autoconf automake uuid uuid-dev uuid-runtime build-essential php5-dev pkg-config libzmq3-dbg libzmq3-dev libzmq3 +sudo apt-get install -qq libtool autoconf automake uuid uuid-dev uuid-runtime build-essential php7.1-dev pkg-config libzmq3-dbg libzmq3-dev libzmq3 echo "" | sudo pecl install zmq-beta > /dev/null diff --git a/setup_projects.sh b/setup_projects.sh index 0536b354..c089c0b0 100644 --- a/setup_projects.sh +++ b/setup_projects.sh @@ -6,7 +6,7 @@ # # http://mywiki.wooledge.org/BashPitfalls#line-80 # https://stackoverflow.com/a/43606356 -for FILE $(find ./project_setup_scripts -name '*.sh'); do +for FILE in project_setup_scripts/*.sh); do [ -e "$FILE" ] || continue - (bash -n $file) & + (bash -n $FILE) & done \ No newline at end of file From 61a2a704b4223da0c8fb52d90058cc42c397b7b1 Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Tue, 21 Nov 2017 20:38:59 +1300 Subject: [PATCH 06/44] Updating scripts during troubleshooting of NVM and other installations. --- helpers/nvm_install.sh | 29 +++++++++++++------ helpers/vimrc | 5 ++++ scripts/base_box_optimizations.sh | 2 +- scripts/composer.sh | 48 ++++++++++++++++++++++++------- scripts/nodejs.sh | 12 ++++++-- scripts/rvm.sh | 14 +++++++-- scripts/screen.sh | 7 +++-- 7 files changed, 89 insertions(+), 28 deletions(-) diff --git a/helpers/nvm_install.sh b/helpers/nvm_install.sh index 7aaff309..993b868f 100644 --- a/helpers/nvm_install.sh +++ b/helpers/nvm_install.sh @@ -10,20 +10,31 @@ fi if [ -d "$NVM_DIR" ]; then echo ">>> NVM is already installed in $NVM_DIR, trying to update" echo -ne "\r=> " - cd $NVM_DIR && git pull + cd $NVM_DIR && git pull origin master else # Cloning to $NVM_DIR - mkdir $NVM_DIR git clone https://github.com/creationix/nvm.git $NVM_DIR + cd $NVM_DIR + git checkout master + . nvm.sh fi PROFILE="/home/ubuntu/.profile" -SOURCE_STR="\n# This loads NVM\n[[ -s /home/ubuntu/.nvm/nvm.sh ]] && source /home/ubuntu/.nvm/nvm.sh" +BASHRC="/home/ubuntu/.bashrc" -# Append NVM script to ~/.profile -if ! grep -qsc 'nvm.sh' $PROFILE; then - echo ">>> Appending source string to $PROFILE" - printf "$SOURCE_STR" >> "$PROFILE" -else - echo ">>> Source string already in $PROFILE" +SOURCE_CONTENT='export NVM_DIR="$HOME/.nvm" +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm +[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion' + +echo $SOURCE_CONTENT >> $PROFILE +echo $SOURCE_CONTENT >> $BASHRC + +# Re-source .profile if exists +if [ -f ${PROFILE} ]; then + . ${PROFILE} +fi + +# Re-source .bashrc if exists +if [ -f ${BASHRC} ]; then + . ${BASHRC} fi \ No newline at end of file diff --git a/helpers/vimrc b/helpers/vimrc index 15900d5f..db61a151 100644 --- a/helpers/vimrc +++ b/helpers/vimrc @@ -1,6 +1,7 @@ set nocompatible filetype off set encoding=utf-8 +syntax enable set rtp+=~/.vim/bundle/vundle/ call vundle#begin() @@ -18,6 +19,10 @@ Plugin 'bling/vim-airline' Plugin 'airblade/vim-gitgutter' Plugin 'tpope/vim-fugitive' +call vundle#end() + +colorscheme solarized + filetype plugin indent on " "" Brief help diff --git a/scripts/base_box_optimizations.sh b/scripts/base_box_optimizations.sh index 97641fbc..0e2e4f4c 100644 --- a/scripts/base_box_optimizations.sh +++ b/scripts/base_box_optimizations.sh @@ -14,4 +14,4 @@ fi perl -pi -e 's@^\s*(deb(\-src)?)\s+http://us.archive.*?\s+@\1 mirror://mirrors.ubuntu.com/mirrors.txt @g' /etc/apt/sources.list # update repositories -apt-get update +sudo apt-get update diff --git a/scripts/composer.sh b/scripts/composer.sh index 96bda7cb..686fc51a 100644 --- a/scripts/composer.sh +++ b/scripts/composer.sh @@ -18,6 +18,9 @@ COMPOSER_IS_INSTALLED=$? GITHUB_OAUTH=$1 COMPOSER_PACKAGES=$2 +PROFILE="/home/ubuntu/.profile" +BASHRC="/home/ubuntu/.bashrc" + # True, if composer is not installed if [[ $COMPOSER_IS_INSTALLED -ne 0 ]]; then echo ">>> Installing Composer" @@ -28,15 +31,31 @@ if [[ $COMPOSER_IS_INSTALLED -ne 0 ]]; then sudo mv composer.phar /usr/local/bin/composer sudo rm installer - # Add an alias that will allow us to use composer without timeout's - printf "\n# Add an alias for sudo\n%s\n# Use HHVM when using Composer\n%s" \ - "alias sudo=\"sudo \"" \ - "alias composer=\"hhvm -v ResourceLimit.SocketDefaultTimeout=30 -v Http.SlowQueryThreshold=30000 -v Eval.Jit=false /usr/local/bin/composer\"" \ - >> "/home/ubuntu/.profile" - # Resource .profile # Doesn't seem to work do! The alias is only usefull from the moment you log in: vagrant ssh - . /home/ubuntu/.profile + + # Re-source .profile if exists + if [ -f ${PROFILE} ]; then + + # Add an alias that will allow us to use composer without timeout's + printf "\n# Add an alias for sudo\n%s\n# Use HHVM when using Composer\n%s" \ + "alias sudo=\"sudo \"" \ + "alias composer=\"hhvm -v ResourceLimit.SocketDefaultTimeout=30 -v Http.SlowQueryThreshold=30000 -v Eval.Jit=false /usr/local/bin/composer\"" \ + >> ${PROFILE} + + . ${PROFILE} + fi + + # Re-source .bashrc if exists + if [ -f ${BASHRC} ]; then + + # Add an alias that will allow us to use composer without timeout's + printf "\n# Add an alias for sudo\n%s\n# Use HHVM when using Composer\n%s" \ + "alias sudo=\"sudo \"" \ + "alias composer=\"hhvm -v ResourceLimit.SocketDefaultTimeout=30 -v Http.SlowQueryThreshold=30000 -v Eval.Jit=false /usr/local/bin/composer\"" \ + >> ${BASHRC} + . ${BASHRC} + fi else # Install Composer curl -sS https://getcomposer.org/installer | php @@ -73,10 +92,17 @@ if [[ ! -z $COMPOSER_PACKAGES ]]; then # Add composer home vendor bin dir to PATH to run globally installed executables printf "\n# Add Composer Global Bin to PATH\n%s" 'export PATH=$PATH:$COMPOSER_HOME/ubuntu/bin' >> /home/ubuntu/.profile - # Source the .profile to pick up changes - . /home/ubuntu/.profile - fi - fi + # Re-source .profile if exists + if [[ -f ${PROFILE} ]]; then + . ${PROFILE} + fi + + # Re-source .bashrc if exists + if [[ -f ${BASHRC} ]]; then + . ${BASHRC} + fi + fi + fi if [[ $HHVM_IS_INSTALLED -eq 0 ]]; then hhvm -v ResourceLimit.SocketDefaultTimeout=30 -v Http.SlowQueryThreshold=30000 -v Eval.Jit=false /usr/local/bin/composer global require ${COMPOSER_PACKAGES[@]} diff --git a/scripts/nodejs.sh b/scripts/nodejs.sh index b9ebda2f..07d39b4d 100644 --- a/scripts/nodejs.sh +++ b/scripts/nodejs.sh @@ -10,6 +10,9 @@ NODE_ARG=($@) # Number of arguments that are given NUMBER_OF_ARG=${#NODE_ARG[@]} +PROFILE="/home/ubuntu/.profile" +BASHRC="/home/ubuntu/.bashrc" + # Prepare the variables for installing specific Nodejs version and Global Node Packages if [[ $NUMBER_OF_ARG -gt 2 ]]; then # Nodejs version, github url and Global Node Packages are given @@ -36,8 +39,13 @@ if [[ $NODE_IS_INSTALLED -ne 0 ]]; then # Re-source user profiles # if they exist - if [[ -f "/home/ubuntu/.profile" ]]; then - source /home/ubuntu/.profile + if [ -f ${PROFILE} ]; then + . ${PROFILE} + fi + + # Re-source .bashrc if exists + if [ -f ${BASHRC} ]; then + . ${BASHRC} fi echo ">>> Installing Node.js version $NODEJS_VERSION" diff --git a/scripts/rvm.sh b/scripts/rvm.sh index 029d5594..9bcf72f2 100644 --- a/scripts/rvm.sh +++ b/scripts/rvm.sh @@ -10,6 +10,9 @@ RUBY_ARG=($@) # Number of arguments that are given NUMBER_OF_ARG=${#RUBY_ARG[@]} +PROFILE="/home/ubuntu/.profile" +BASHRC="/home/ubuntu/.bashrc" + # Prepare the variables for installing specific Ruby version and Gems if [[ $NUMBER_OF_ARG -gt 1 ]]; then # Both Ruby version and Gems are given @@ -48,13 +51,18 @@ else . /home/ubuntu/.rvm/scripts/rvm # Re-source .profile if exists - if [[ -f "/home/ubuntu/.profile" ]]; then - . /home/ubuntu/.profile + if [ -f ${PROFILE} ]; then + . ${PROFILE} + fi + + # Re-source .bashrc if exists + if [ -f ${BASHRC} ]; then + . ${BASHRC} fi fi # Install (optional) Ruby Gems -if [[ ! -z $RUBY_GEMS ]]; then +if [ ! -z $RUBY_GEMS ]; then echo ">>> Start installing Ruby Gems" gem install ${RUBY_GEMS[@]} diff --git a/scripts/screen.sh b/scripts/screen.sh index 1b7aaee0..df596b4d 100644 --- a/scripts/screen.sh +++ b/scripts/screen.sh @@ -5,5 +5,8 @@ echo ">>> Installing Screen" # Screen # -qq implies -y --force-yes sudo apt-get install -qq screen -sudo touch /home/ubuntu/.screenrc -sudo echo -e "startup_message off\ncaption always '%{= dg} %H %{G}%=%?%{d}%-w%?%{r}(%{d}%n %t%? {%u} %?%{r})%{d}%?%+w%?%=%{G} %{B}%M %d %c:%s '" >> /home/ubuntu/.screenrc +touch /home/ubuntu/.screenrc + +SCREENINFO="startup_message off\ncaption always '%{= dg} %H %{G}%=%?%{d}%-w%?%{r}(%{d}%n %t%? {%u} %?%{r})%{d}%?%+w%?%=%{G} %{B}%M %d %c:%s '" + +echo -e $SCREENINFO >> /home/ubuntu/.screenrc From 5298f7bf6366dced93da3e138e4dd7ef2293984b Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Tue, 21 Nov 2017 21:54:50 +1300 Subject: [PATCH 07/44] Updating scripts during troubleshooting of NVM installation. --- helpers/nvm_install.sh | 45 ++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/helpers/nvm_install.sh b/helpers/nvm_install.sh index 993b868f..143e7495 100644 --- a/helpers/nvm_install.sh +++ b/helpers/nvm_install.sh @@ -8,33 +8,36 @@ if ! hash git 2>/dev/null; then fi if [ -d "$NVM_DIR" ]; then - echo ">>> NVM is already installed in $NVM_DIR, trying to update" + echo ">>> NVM is already installed in $NVM_DIR." echo -ne "\r=> " - cd $NVM_DIR && git pull origin master -else - # Cloning to $NVM_DIR - git clone https://github.com/creationix/nvm.git $NVM_DIR - cd $NVM_DIR - git checkout master - . nvm.sh fi PROFILE="/home/ubuntu/.profile" BASHRC="/home/ubuntu/.bashrc" -SOURCE_CONTENT='export NVM_DIR="$HOME/.nvm" -[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm -[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion' - -echo $SOURCE_CONTENT >> $PROFILE -echo $SOURCE_CONTENT >> $BASHRC - -# Re-source .profile if exists -if [ -f ${PROFILE} ]; then - . ${PROFILE} +NVMSCRIPTURL="https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh" + +# The script clones the nvm repository to ~/.nvm and adds the source line to your profile (~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc). +curl -o- $NVMSCRIPTURL | bash + +# Source nvm in .profile / .bashrc +if [ $(command -v nvm) != "nvm" ]; then + + if [ ! -f $PROFILE ]; then + + touch $PROFILE + curl -o- $NVMSCRIPTURL | bash + fi + + if [ ! -f $BASHRC ]; then + + touch $BASHRC + curl -o- $NVMSCRIPTURL | bash + fi fi -# Re-source .bashrc if exists -if [ -f ${BASHRC} ]; then - . ${BASHRC} +# If nvm command still results in 'not found' error +if [ $(command -v nvm) != "nvm" ]; then + echo "\nsource $BASHRC" >> $PROFILE + . $PROFILE fi \ No newline at end of file From 8c8a05f67582e86e05c48b0d9f729eac30ad2d09 Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Tue, 21 Nov 2017 22:57:02 +1300 Subject: [PATCH 08/44] Updating scripts during troubleshooting of NVM installation. --- helpers/nvm_install.sh | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/helpers/nvm_install.sh b/helpers/nvm_install.sh index 143e7495..f665b34b 100644 --- a/helpers/nvm_install.sh +++ b/helpers/nvm_install.sh @@ -20,24 +20,11 @@ NVMSCRIPTURL="https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.s # The script clones the nvm repository to ~/.nvm and adds the source line to your profile (~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc). curl -o- $NVMSCRIPTURL | bash -# Source nvm in .profile / .bashrc -if [ $(command -v nvm) != "nvm" ]; then - - if [ ! -f $PROFILE ]; then - - touch $PROFILE - curl -o- $NVMSCRIPTURL | bash - fi - - if [ ! -f $BASHRC ]; then - - touch $BASHRC - curl -o- $NVMSCRIPTURL | bash - fi -fi - # If nvm command still results in 'not found' error if [ $(command -v nvm) != "nvm" ]; then - echo "\nsource $BASHRC" >> $PROFILE - . $PROFILE + EXPORT='export NVM_DIR="$HOME/.nvm" +[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm' + echo $EXPORT >> $BASHRC + source $BASHRC + . $BASHRC fi \ No newline at end of file From eff184638b74705ca118c79c2042b1d9ceb1ac75 Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Wed, 22 Nov 2017 00:45:08 +1300 Subject: [PATCH 09/44] Updating scripts during troubleshooting of NVM installation. --- helpers/nvm_install.sh | 28 +++++----------------------- scripts/composer.sh | 30 +++++++++++++++--------------- scripts/nodejs.sh | 12 ++++++------ scripts/rvm.sh | 14 +++++++------- 4 files changed, 33 insertions(+), 51 deletions(-) diff --git a/helpers/nvm_install.sh b/helpers/nvm_install.sh index f665b34b..578a5885 100644 --- a/helpers/nvm_install.sh +++ b/helpers/nvm_install.sh @@ -1,30 +1,12 @@ #!/usr/bin/env bash -NVM_DIR="/home/ubuntu/.nvm" - -if ! hash git 2>/dev/null; then - echo >&2 "!!! You need to install git" - exit 1 -fi - -if [ -d "$NVM_DIR" ]; then - echo ">>> NVM is already installed in $NVM_DIR." - echo -ne "\r=> " -fi - -PROFILE="/home/ubuntu/.profile" -BASHRC="/home/ubuntu/.bashrc" +PROFILE=/home/ubuntu/.profile +BASHRC=/home/ubuntu/.bashrc NVMSCRIPTURL="https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh" # The script clones the nvm repository to ~/.nvm and adds the source line to your profile (~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc). -curl -o- $NVMSCRIPTURL | bash +curl -sL $NVMSCRIPTURL -o install_nvm.sh +bash install_nvm.sh -# If nvm command still results in 'not found' error -if [ $(command -v nvm) != "nvm" ]; then - EXPORT='export NVM_DIR="$HOME/.nvm" -[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm' - echo $EXPORT >> $BASHRC - source $BASHRC - . $BASHRC -fi \ No newline at end of file +source $PROFILE && source $BASHRC \ No newline at end of file diff --git a/scripts/composer.sh b/scripts/composer.sh index 686fc51a..756e559f 100644 --- a/scripts/composer.sh +++ b/scripts/composer.sh @@ -18,8 +18,8 @@ COMPOSER_IS_INSTALLED=$? GITHUB_OAUTH=$1 COMPOSER_PACKAGES=$2 -PROFILE="/home/ubuntu/.profile" -BASHRC="/home/ubuntu/.bashrc" +PROFILE=/home/ubuntu/.profile +BASHRC=/home/ubuntu/.bashrc # True, if composer is not installed if [[ $COMPOSER_IS_INSTALLED -ne 0 ]]; then @@ -35,26 +35,26 @@ if [[ $COMPOSER_IS_INSTALLED -ne 0 ]]; then # Doesn't seem to work do! The alias is only usefull from the moment you log in: vagrant ssh # Re-source .profile if exists - if [ -f ${PROFILE} ]; then + if [[ -f $PROFILE ]]; then # Add an alias that will allow us to use composer without timeout's printf "\n# Add an alias for sudo\n%s\n# Use HHVM when using Composer\n%s" \ "alias sudo=\"sudo \"" \ "alias composer=\"hhvm -v ResourceLimit.SocketDefaultTimeout=30 -v Http.SlowQueryThreshold=30000 -v Eval.Jit=false /usr/local/bin/composer\"" \ - >> ${PROFILE} + >> $PROFILE - . ${PROFILE} + source $PROFILE fi # Re-source .bashrc if exists - if [ -f ${BASHRC} ]; then + if [[ -f $BASHRC ]]; then # Add an alias that will allow us to use composer without timeout's printf "\n# Add an alias for sudo\n%s\n# Use HHVM when using Composer\n%s" \ "alias sudo=\"sudo \"" \ "alias composer=\"hhvm -v ResourceLimit.SocketDefaultTimeout=30 -v Http.SlowQueryThreshold=30000 -v Eval.Jit=false /usr/local/bin/composer\"" \ - >> ${BASHRC} - . ${BASHRC} + >> $BASHRC + source $BASHRC fi else # Install Composer @@ -85,21 +85,21 @@ if [[ ! -z $COMPOSER_PACKAGES ]]; then echo " " ${COMPOSER_PACKAGES[@]} # Add Composer's Global Bin to ~/.profile path - if [[ -f "/home/ubuntu/.profile" ]]; then - if ! grep -qsc 'COMPOSER_HOME=' /home/ubuntu/.profile; then + if [[ -f $PROFILE ]]; then + if ! grep -qsc 'COMPOSER_HOME=' $PROFILE; then # Ensure COMPOSER_HOME variable is set. This isn't set by Composer automatically - printf "\n\nCOMPOSER_HOME=\"/home/ubuntu/.composer\"" >> /home/ubuntu/.profile + printf "\n\nCOMPOSER_HOME=\"/home/ubuntu/.composer\"" >> $PROFILE # Add composer home vendor bin dir to PATH to run globally installed executables printf "\n# Add Composer Global Bin to PATH\n%s" 'export PATH=$PATH:$COMPOSER_HOME/ubuntu/bin' >> /home/ubuntu/.profile # Re-source .profile if exists - if [[ -f ${PROFILE} ]]; then - . ${PROFILE} + if [[ -f $PROFILE ]]; then + source $PROFILE fi # Re-source .bashrc if exists - if [[ -f ${BASHRC} ]]; then - . ${BASHRC} + if [[ -f $BASHRC ]]; then + source $BASHRC fi fi fi diff --git a/scripts/nodejs.sh b/scripts/nodejs.sh index 07d39b4d..5d70276e 100644 --- a/scripts/nodejs.sh +++ b/scripts/nodejs.sh @@ -10,8 +10,8 @@ NODE_ARG=($@) # Number of arguments that are given NUMBER_OF_ARG=${#NODE_ARG[@]} -PROFILE="/home/ubuntu/.profile" -BASHRC="/home/ubuntu/.bashrc" +PROFILE=/home/ubuntu/.profile +BASHRC=/home/ubuntu/.bashrc # Prepare the variables for installing specific Nodejs version and Global Node Packages if [[ $NUMBER_OF_ARG -gt 2 ]]; then @@ -39,13 +39,13 @@ if [[ $NODE_IS_INSTALLED -ne 0 ]]; then # Re-source user profiles # if they exist - if [ -f ${PROFILE} ]; then - . ${PROFILE} + if [[ -f $PROFILE ]]; then + . $PROFILE fi # Re-source .bashrc if exists - if [ -f ${BASHRC} ]; then - . ${BASHRC} + if [[ -f $BASHRC ]]; then + . $BASHRC fi echo ">>> Installing Node.js version $NODEJS_VERSION" diff --git a/scripts/rvm.sh b/scripts/rvm.sh index 9bcf72f2..1265e515 100644 --- a/scripts/rvm.sh +++ b/scripts/rvm.sh @@ -10,8 +10,8 @@ RUBY_ARG=($@) # Number of arguments that are given NUMBER_OF_ARG=${#RUBY_ARG[@]} -PROFILE="/home/ubuntu/.profile" -BASHRC="/home/ubuntu/.bashrc" +PROFILE=/home/ubuntu/.profile +BASHRC=/home/ubuntu/.bashrc # Prepare the variables for installing specific Ruby version and Gems if [[ $NUMBER_OF_ARG -gt 1 ]]; then @@ -48,16 +48,16 @@ else fi # Re-source RVM - . /home/ubuntu/.rvm/scripts/rvm + source /home/ubuntu/.rvm/scripts/rvm # Re-source .profile if exists - if [ -f ${PROFILE} ]; then - . ${PROFILE} + if [[ -f $PROFILE ]]; then + source $PROFILE fi # Re-source .bashrc if exists - if [ -f ${BASHRC} ]; then - . ${BASHRC} + if [[ -f $BASHRC ]]; then + source $BASHRC fi fi From 510f90b0e29c36ea2b0cecd01df211a84590b477 Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Wed, 22 Nov 2017 11:11:49 +1300 Subject: [PATCH 10/44] Updating scripts during troubleshooting of NVM installation. --- helpers/nvm_install.sh | 4 ++-- scripts/composer.sh | 6 +++--- scripts/nodejs.sh | 4 ++-- scripts/rvm.sh | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/helpers/nvm_install.sh b/helpers/nvm_install.sh index 578a5885..375463d4 100644 --- a/helpers/nvm_install.sh +++ b/helpers/nvm_install.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash -PROFILE=/home/ubuntu/.profile -BASHRC=/home/ubuntu/.bashrc +PROFILE=~/.profile +BASHRC=~/.bashrc NVMSCRIPTURL="https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh" diff --git a/scripts/composer.sh b/scripts/composer.sh index 756e559f..026b4a22 100644 --- a/scripts/composer.sh +++ b/scripts/composer.sh @@ -18,8 +18,8 @@ COMPOSER_IS_INSTALLED=$? GITHUB_OAUTH=$1 COMPOSER_PACKAGES=$2 -PROFILE=/home/ubuntu/.profile -BASHRC=/home/ubuntu/.bashrc +PROFILE=~/.profile +BASHRC=~/.bashrc # True, if composer is not installed if [[ $COMPOSER_IS_INSTALLED -ne 0 ]]; then @@ -90,7 +90,7 @@ if [[ ! -z $COMPOSER_PACKAGES ]]; then # Ensure COMPOSER_HOME variable is set. This isn't set by Composer automatically printf "\n\nCOMPOSER_HOME=\"/home/ubuntu/.composer\"" >> $PROFILE # Add composer home vendor bin dir to PATH to run globally installed executables - printf "\n# Add Composer Global Bin to PATH\n%s" 'export PATH=$PATH:$COMPOSER_HOME/ubuntu/bin' >> /home/ubuntu/.profile + printf "\n# Add Composer Global Bin to PATH\n%s" 'export PATH=$PATH:$COMPOSER_HOME/ubuntu/bin' >> ~/.profile # Re-source .profile if exists if [[ -f $PROFILE ]]; then diff --git a/scripts/nodejs.sh b/scripts/nodejs.sh index 5d70276e..6426d926 100644 --- a/scripts/nodejs.sh +++ b/scripts/nodejs.sh @@ -10,8 +10,8 @@ NODE_ARG=($@) # Number of arguments that are given NUMBER_OF_ARG=${#NODE_ARG[@]} -PROFILE=/home/ubuntu/.profile -BASHRC=/home/ubuntu/.bashrc +PROFILE=~/.profile +BASHRC=~/.bashrc # Prepare the variables for installing specific Nodejs version and Global Node Packages if [[ $NUMBER_OF_ARG -gt 2 ]]; then diff --git a/scripts/rvm.sh b/scripts/rvm.sh index 1265e515..ab703253 100644 --- a/scripts/rvm.sh +++ b/scripts/rvm.sh @@ -10,8 +10,8 @@ RUBY_ARG=($@) # Number of arguments that are given NUMBER_OF_ARG=${#RUBY_ARG[@]} -PROFILE=/home/ubuntu/.profile -BASHRC=/home/ubuntu/.bashrc +PROFILE=~/.profile +BASHRC=~/.bashrc # Prepare the variables for installing specific Ruby version and Gems if [[ $NUMBER_OF_ARG -gt 1 ]]; then From b60417679cdc6d90cd143f9dbf553948c0f3be03 Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Wed, 22 Nov 2017 13:01:40 +1300 Subject: [PATCH 11/44] Updating scripts during troubleshooting of NVM installation. --- helpers/nvm_install.sh | 9 +++++++- scripts/composer.sh | 13 +++--------- scripts/nodejs.sh | 48 +++++++----------------------------------- scripts/rvm.sh | 14 +++++------- scripts/screen.sh | 4 ++-- 5 files changed, 26 insertions(+), 62 deletions(-) diff --git a/helpers/nvm_install.sh b/helpers/nvm_install.sh index 375463d4..6851e335 100644 --- a/helpers/nvm_install.sh +++ b/helpers/nvm_install.sh @@ -9,4 +9,11 @@ NVMSCRIPTURL="https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.s curl -sL $NVMSCRIPTURL -o install_nvm.sh bash install_nvm.sh -source $PROFILE && source $BASHRC \ No newline at end of file +printf '\n\nexport NVM_DIR=~/.nvm +[ -s "~/.nvm/nvm.sh" ] && . "~/.nvm/nvm.sh"' >> $PROFILE + +printf '\n\nexport NVM_DIR=~/.nvm +[ -s "~/.nvm/nvm.sh" ] && . "~/.nvm/nvm.sh"' >> $BASHRC + +source $PROFILE +source $BASHRC \ No newline at end of file diff --git a/scripts/composer.sh b/scripts/composer.sh index 026b4a22..31530f83 100644 --- a/scripts/composer.sh +++ b/scripts/composer.sh @@ -90,17 +90,10 @@ if [[ ! -z $COMPOSER_PACKAGES ]]; then # Ensure COMPOSER_HOME variable is set. This isn't set by Composer automatically printf "\n\nCOMPOSER_HOME=\"/home/ubuntu/.composer\"" >> $PROFILE # Add composer home vendor bin dir to PATH to run globally installed executables - printf "\n# Add Composer Global Bin to PATH\n%s" 'export PATH=$PATH:$COMPOSER_HOME/ubuntu/bin' >> ~/.profile + printf "\n# Add Composer Global Bin to PATH\n%s" 'export PATH=$PATH:$COMPOSER_HOME/ubuntu/bin' >> $PROFILE - # Re-source .profile if exists - if [[ -f $PROFILE ]]; then - source $PROFILE - fi - - # Re-source .bashrc if exists - if [[ -f $BASHRC ]]; then - source $BASHRC - fi + source $PROFILE + source $BASHRC fi fi diff --git a/scripts/nodejs.sh b/scripts/nodejs.sh index 6426d926..63d6c2fd 100644 --- a/scripts/nodejs.sh +++ b/scripts/nodejs.sh @@ -13,56 +13,24 @@ NUMBER_OF_ARG=${#NODE_ARG[@]} PROFILE=~/.profile BASHRC=~/.bashrc -# Prepare the variables for installing specific Nodejs version and Global Node Packages -if [[ $NUMBER_OF_ARG -gt 2 ]]; then - # Nodejs version, github url and Global Node Packages are given - NODEJS_VERSION=${NODE_ARG[0]} - GITHUB_URL=${NODE_ARG[1]} - NODE_PACKAGES=${NODE_ARG[@]:2} -elif [[ $NUMBER_OF_ARG -eq 2 ]]; then - # Only Nodejs version and github url are given - NODEJS_VERSION=${NODE_ARG[0]} - GITHUB_URL=${NODE_ARG[1]} -else - # Default Nodejs version when nothing is given - NODEJS_VERSION=latest - GITHUB_URL="https://raw.githubusercontent.com/rattfieldnz/Vaprobash/master" -fi - # True, if Node is not installed if [[ $NODE_IS_INSTALLED -ne 0 ]]; then - echo ">>> Installing Node Version Manager" + echo ">>> Installing latest stable Node LTS - 6.X" + sudo apt-get -qq install python-software-properties + # Install NVM - curl --silent -L $GITHUB_URL/helpers/nvm_install.sh | sh + curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - + sudo apt-get update + sudo apt-get -qq install nodejs # Re-source user profiles # if they exist - if [[ -f $PROFILE ]]; then - . $PROFILE - fi + source $PROFILE # Re-source .bashrc if exists - if [[ -f $BASHRC ]]; then - . $BASHRC - fi - - echo ">>> Installing Node.js version $NODEJS_VERSION" - echo " This will also be set as the default node version" - - # If set to latest, get the current node version from the home page - if [[ $NODEJS_VERSION -eq "latest" ]]; then - NODEJS_VERSION="node" - fi - - # Install Node - nvm install $NODEJS_VERSION - - # Set a default node version and start using it - nvm alias default $NODEJS_VERSION - - nvm use default + source $BASHRC fi diff --git a/scripts/rvm.sh b/scripts/rvm.sh index ab703253..1104b8d8 100644 --- a/scripts/rvm.sh +++ b/scripts/rvm.sh @@ -48,17 +48,13 @@ else fi # Re-source RVM - source /home/ubuntu/.rvm/scripts/rvm + source ~/.rvm/scripts/rvm - # Re-source .profile if exists - if [[ -f $PROFILE ]]; then - source $PROFILE - fi + # Re-source .profile + source $PROFILE - # Re-source .bashrc if exists - if [[ -f $BASHRC ]]; then - source $BASHRC - fi + # Re-source .bashrc + source $BASHRC fi # Install (optional) Ruby Gems diff --git a/scripts/screen.sh b/scripts/screen.sh index df596b4d..fc4e3d87 100644 --- a/scripts/screen.sh +++ b/scripts/screen.sh @@ -5,8 +5,8 @@ echo ">>> Installing Screen" # Screen # -qq implies -y --force-yes sudo apt-get install -qq screen -touch /home/ubuntu/.screenrc +touch ~/.screenrc SCREENINFO="startup_message off\ncaption always '%{= dg} %H %{G}%=%?%{d}%-w%?%{r}(%{d}%n %t%? {%u} %?%{r})%{d}%?%+w%?%=%{G} %{B}%M %d %c:%s '" -echo -e $SCREENINFO >> /home/ubuntu/.screenrc +echo -e $SCREENINFO >> ~/.screenrc From b5f083ab4bda15403fb910460558b5df96481261 Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Wed, 22 Nov 2017 13:50:29 +1300 Subject: [PATCH 12/44] Debugging errors in MongoDB installation (update with more recent details/version). --- Vagrantfile | 2 +- scripts/mongodb.sh | 37 +++++++++++++++++++++++++------------ scripts/nodejs.sh | 1 + 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index bd31b281..5e29c021 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -70,7 +70,7 @@ composer_packages = [ # List any global Composer packages that you wa "phpspec/phpspec:~4.2", "squizlabs/php_codesniffer:^3.0", "unitgen/unitgen:dev-master", - "theseer/phpdox:^0.1" + "theseer/phpdox:~0.10.1" ] # Default web server document root diff --git a/scripts/mongodb.sh b/scripts/mongodb.sh index 30c02b29..5d2fabb0 100644 --- a/scripts/mongodb.sh +++ b/scripts/mongodb.sh @@ -3,14 +3,9 @@ echo ">>> Installing MongoDB" # Get key and add to sources -sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 +sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927 -# Make MongoDB connectable from outside world without SSH tunnel -if [ $2 == "3.0" ]; then - echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list -else - echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list -fi +echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list # Update @@ -20,13 +15,31 @@ sudo apt-get update # -qq implies -y --force-yes sudo apt-get install -qq mongodb-org +# Create a unit file to manage the MongoDB service +sudo touch /etc/systemd/system/mongodb.service +sudo echo '[Unit] +Description=High-performance, schema-free document-oriented database +After=network.target + +[Service] +User=mongodb +ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf + +[Install] +WantedBy=multi-user.target' > /etc/systemd/system/mongodb.service + +sudo systemctl start mongodb + # Make MongoDB connectable from outside world without SSH tunnel if [ $1 == "true" ]; then # enable remote access # setting the mongodb bind_ip to allow connections from everywhere - sed -i "s/bind_ip = .*/bind_ip = 0.0.0.0/" /etc/mongod.conf + sudo sed -i "s/bind_ip = .*/bind_ip = 0.0.0.0/" /etc/mongod.conf fi +sudo systemctl restart mongodb +sudo systemctl enable mongodb + # Test if PHP is installed php -v > /dev/null 2>&1 PHP_IS_INSTALLED=$? @@ -37,13 +50,13 @@ if [ $PHP_IS_INSTALLED -eq 0 ]; then # install php extension echo "no" > answers.txt - sudo pecl install mongo < answers.txt + sudo pecl install mongodb < answers.txt rm answers.txt # add extension file and restart service - echo 'extension=mongo.so' | sudo tee /etc/php/7.1/mods-available/mongo.ini + sudo echo 'extension=mongodb.so' | sudo tee /etc/php/7.1/mods-available/mongo.ini - ln -s /etc/php/7.1/mods-available/mongo.ini /etc/php/7.1/fpm/conf.d/mongo.ini - ln -s /etc/php/7.1/mods-available/mongo.ini /etc/php/7.1/cli/conf.d/mongo.ini + sudo ln -s /etc/php/7.1/mods-available/mongo.ini /etc/php/7.1/fpm/conf.d/mongo.ini + sudo ln -s /etc/php/7.1/mods-available/mongo.ini /etc/php/7.1/cli/conf.d/mongo.ini sudo service php7.1-fpm restart fi diff --git a/scripts/nodejs.sh b/scripts/nodejs.sh index 63d6c2fd..f64fd440 100644 --- a/scripts/nodejs.sh +++ b/scripts/nodejs.sh @@ -18,6 +18,7 @@ if [[ $NODE_IS_INSTALLED -ne 0 ]]; then echo ">>> Installing latest stable Node LTS - 6.X" + sudo apt-get update sudo apt-get -qq install python-software-properties # Install NVM From d482b63e78c937842256e9bb82bda92bcf944d03 Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Wed, 22 Nov 2017 15:53:11 +1300 Subject: [PATCH 13/44] Troubleshooting Laravel and Symfony test projects, and phpMyAdmin install/setup. --- Vagrantfile | 16 ++++++++-------- helpers/vhost.sh | 2 +- scripts/install_phpmyadmin.sh | 8 ++++---- scripts/laravel.sh | 19 ++++++++++--------- scripts/symfony.sh | 9 +++------ 5 files changed, 26 insertions(+), 28 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 5e29c021..08c58fd4 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -78,9 +78,12 @@ composer_packages = [ # List any global Composer packages that you wa # Laravel's public directory is assumed "public" public_folder = "/home/ubuntu/code" -laravel_root_folder = "#{public_folder}/laravel-test" # Where to install Laravel. Will `composer install` if a composer.json file exists +laravel_server_name = "laravel-test.localhost" +laravel_root_folder = "/home/ubuntu/code/laravel-test" # Where to install Laravel. Will `composer install` if a composer.json file exists laravel_version = "latest-stable" # If you need a specific version of Laravel, set it here -symfony_root_folder = "#{public_folder}/code/symfony-test" # Where to install Symfony. + +symfony_server_name = "symfony-test.localhost" +symfony_root_folder = "/home/ubuntu/code/symfony-test" # Where to install Symfony. nodejs_version = "latest" # By default "latest" will equal the latest stable version nodejs_packages = [ # List any global NodeJS packages that you want to install @@ -141,10 +144,7 @@ Vagrant.configure("2") do |config| config.ssh.forward_agent = true # Use NFS for the shared folder - #config.vm.synced_folder vm_synced_folder_host, vm_synced_folder_guest - # id: "core" - # :nfs => true, - # :mount_options => ['nolock,vers=3,udp,noatime,actimeo=2,fsc'] + config.vm.synced_folder vm_synced_folder_host, vm_synced_folder_guest # Replicate local .gitconfig file if it exists if File.file?(File.expand_path("~/.gitconfig")) @@ -375,10 +375,10 @@ Vagrant.configure("2") do |config| config.vm.provision "shell", path: "./scripts/composer.sh", privileged: false, args: [github_pat, composer_packages.join(" ")] # Provision Laravel - config.vm.provision "shell", path: "./scripts/laravel.sh", privileged: false, args: [server_ip, laravel_root_folder, public_folder, laravel_version] + config.vm.provision "shell", path: "./scripts/laravel.sh", privileged: false, args: [laravel_server_name, laravel_root_folder, laravel_version] # Provision Symfony - config.vm.provision "shell", path: "./scripts/symfony.sh", privileged: false, args: [server_ip, symfony_root_folder, public_folder] + config.vm.provision "shell", path: "./scripts/symfony.sh", privileged: false, args: [symfony_server_name, symfony_root_folder] # Install Screen config.vm.provision "shell", path: "./scripts/screen.sh" diff --git a/helpers/vhost.sh b/helpers/vhost.sh index e07c4e97..916399b4 100644 --- a/helpers/vhost.sh +++ b/helpers/vhost.sh @@ -182,6 +182,6 @@ else fi # Enable Site - cd /etc/apache2/sites-available/ && a2ensite ${ServerName}.conf + a2ensite ${ServerName}.conf service apache2 reload fi \ No newline at end of file diff --git a/scripts/install_phpmyadmin.sh b/scripts/install_phpmyadmin.sh index 3feb7e6a..e4308544 100644 --- a/scripts/install_phpmyadmin.sh +++ b/scripts/install_phpmyadmin.sh @@ -20,7 +20,7 @@ sudo apt-get -f -y install phpmyadmin; echo "Set-up Apache Vhost file (assuming phpMyAdmin has been installed to /usr/share/phpmyadmin.\n" if [ -d "/usr/share/phpmyadmin" ]; then -sudo echo ' +sudo echo " ServerName $ServerName $ServerAlias DocumentRoot /usr/share/phpmyadmin @@ -31,7 +31,7 @@ sudo echo ' AddType application/x-httpd-php .php - + SetHandler application/x-httpd-php php_flag magic_quotes_gpc Off @@ -56,14 +56,14 @@ sudo echo ' - # Disallow web access to directories that don\''t need it + # Disallow web access to directories that don't need it Require all denied Require all denied -' > /etc/apache2/sites-available/phpmyadmin.localhost.conf +" > /etc/apache2/sites-available/phpmyadmin.localhost.conf sudo a2ensite phpmyadmin.localhost.conf sudo service apache2 reload fi diff --git a/scripts/laravel.sh b/scripts/laravel.sh index a8ef9b91..0f6040e0 100644 --- a/scripts/laravel.sh +++ b/scripts/laravel.sh @@ -15,8 +15,8 @@ HHVM_IS_INSTALLED=$? # Test if Composer is installed composer -v > /dev/null 2>&1 || { printf "!!! Composer is not installed.\n Installing Laravel aborted!"; exit 0; } -# Test if Server IP is set in Vagrantfile -[[ -z "$1" ]] && { printf "!!! IP address not set. Check the Vagrantfile.\n Installing Laravel aborted!\n"; exit 0; } +# Test if Server Name is set in Vagrantfile +[[ -z "$1" ]] && { printf "!!! Server name address not set. Check the Vagrantfile.\n Installing Laravel aborted!\n"; exit 0; } # Check if Laravel root is set. If not set use default if [[ -z $2 ]]; then @@ -74,17 +74,18 @@ fi if [[ $NGINX_IS_INSTALLED -eq 0 ]]; then # Change default vhost created - sudo sed -i "s@root /ubuntu@root $laravel_public_folder@" /etc/nginx/sites-available/ubuntu + sudo sed -i "s@root /ubuntu@root $laravel_public_folder@" /etc/nginx/sites-available/$1 sudo service nginx reload fi if [[ $APACHE_IS_INSTALLED -eq 0 ]]; then - # Find and replace to find public_folder and replace with laravel_public_folder - # Change DocumentRoot - # Change ProxyPassMatch fcgi path - # Change path - sudo sed -i "s@$3@$laravel_public_folder@" /etc/apache2/sites-available/$1.xip.io.conf + # Make Laravel storage folder readable and writeable, + # and accessable by Apache. + chown -R www-data:www-data $laravel_root_folder/storage + chmod -R 755 $laravel_root_folder/storage + + sudo vhost -s $1 -d $laravel_public_folder - sudo service apache2 reload + sudo service apache2 restart fi diff --git a/scripts/symfony.sh b/scripts/symfony.sh index 5034a200..ee7c9845 100755 --- a/scripts/symfony.sh +++ b/scripts/symfony.sh @@ -75,11 +75,8 @@ if [ $NGINX_IS_INSTALLED -eq 0 ]; then fi if [ $APACHE_IS_INSTALLED -eq 0 ]; then - # Find and replace to find public_folder and replace with laravel_public_folder - # Change DocumentRoot - # Change ProxyPassMatch fcgi path - # Change path - sudo sed -i "s@$3@$symfony_public_folder@" /etc/apache2/sites-available/$1.xip.io.conf + + sudo vhost -s $1 -d $symfony_public_folder - sudo service apache2 reload + sudo service apache2 restart fi From f4f487dd7457b45af826dc88858517b3e8495983 Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Wed, 22 Nov 2017 16:11:45 +1300 Subject: [PATCH 14/44] Troubleshooting phpMyAdmin and Laravel/Symfony test installs/setups. --- scripts/install_phpmyadmin.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install_phpmyadmin.sh b/scripts/install_phpmyadmin.sh index e4308544..19920251 100644 --- a/scripts/install_phpmyadmin.sh +++ b/scripts/install_phpmyadmin.sh @@ -21,8 +21,8 @@ sudo apt-get -f -y install phpmyadmin; echo "Set-up Apache Vhost file (assuming phpMyAdmin has been installed to /usr/share/phpmyadmin.\n" if [ -d "/usr/share/phpmyadmin" ]; then sudo echo " - ServerName $ServerName - $ServerAlias + ServerName phpmyadmin.localhost + ServerAlias phpmyadmin.localhost DocumentRoot /usr/share/phpmyadmin Options FollowSymLinks From f7332fcc766c69bd6d2903e6d71504f20d490fb5 Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Wed, 22 Nov 2017 17:52:39 +1300 Subject: [PATCH 15/44] Working on MongoDB driver issues, changing sync folder. --- Vagrantfile | 6 +++--- scripts/base.sh | 9 ++++----- scripts/couchbase.sh | 3 ++- scripts/mongodb.sh | 5 ++--- setup_projects.sh | 4 ++-- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 08c58fd4..6930dbb8 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -9,7 +9,7 @@ github_url="" vm_synced_folder_host = "code" -vm_synced_folder_guest = "/home/ubuntu" +vm_synced_folder_guest = "/var/www" # Because this:https://developer.github.com/changes/2014-12-08-removing-authorizations-token/ # https://github.com/settings/tokens @@ -79,11 +79,11 @@ composer_packages = [ # List any global Composer packages that you wa public_folder = "/home/ubuntu/code" laravel_server_name = "laravel-test.localhost" -laravel_root_folder = "/home/ubuntu/code/laravel-test" # Where to install Laravel. Will `composer install` if a composer.json file exists +laravel_root_folder = "/var/www/laravel-test" # Where to install Laravel. Will `composer install` if a composer.json file exists laravel_version = "latest-stable" # If you need a specific version of Laravel, set it here symfony_server_name = "symfony-test.localhost" -symfony_root_folder = "/home/ubuntu/code/symfony-test" # Where to install Symfony. +symfony_root_folder = "/var/www/symfony-test" # Where to install Symfony. nodejs_version = "latest" # By default "latest" will equal the latest stable version nodejs_packages = [ # List any global NodeJS packages that you want to install diff --git a/scripts/base.sh b/scripts/base.sh index d74d7353..ebefeaf5 100644 --- a/scripts/base.sh +++ b/scripts/base.sh @@ -2,6 +2,9 @@ echo "Setting Timezone & Locale to $3 & en_NZ.UTF-8" +# Update +sudo apt-get update && sudo apt-get -f -y upgrade && sudo apt-get -f -y dist-upgrade + sudo ln -sf /usr/share/zoneinfo/$3 /etc/localtime sudo apt-get install -qq language-pack-en sudo locale-gen en_NZ @@ -15,13 +18,9 @@ else github_url="$1" fi -# Update -sudo apt-get update && sudo apt-get -f -y upgrade && sudo apt-get -f -y dist-upgrade - # Install base packages # -qq implies -y --force-yes -sudo apt-get install -qq vim build-essential python-software-properties git zip unzip tcl curl git-core ack-grep software-properties-common cachefilesd virtualbox-guest-dkms - +sudo apt-get install -qq vim build-essential python-software-properties git zip unzip tcl curl git-core ack-grep software-properties-common cachefilesd virtualbox-guest-dkms openssl pkg-config libssl-dev libsslcommon2-dev echo ">>> Installing *.xip.io self-signed SSL" diff --git a/scripts/couchbase.sh b/scripts/couchbase.sh index df7bfe90..7a0fdf32 100644 --- a/scripts/couchbase.sh +++ b/scripts/couchbase.sh @@ -35,7 +35,8 @@ if [ ${PHP_IS_INSTALLED} -eq 0 ]; then wget --quiet -O- http://packages.couchbase.com/ubuntu/couchbase.key | sudo apt-key add - sudo apt-get update sudo apt-get -qq install libcouchbase2-libevent libcouchbase-dev - + + sudo pecl channel-update pecl.php.net sudo pecl install couchbase-${COUCHBASE_VERSION} sudo cat > /etc/php/7.1/mods-available/couchbase.ini << EOF ; configuration for php couchbase module diff --git a/scripts/mongodb.sh b/scripts/mongodb.sh index 5d2fabb0..6bf19faf 100644 --- a/scripts/mongodb.sh +++ b/scripts/mongodb.sh @@ -49,9 +49,8 @@ if [ $PHP_IS_INSTALLED -eq 0 ]; then sudo apt-get -y install php-pear php7.1-dev # install php extension - echo "no" > answers.txt - sudo pecl install mongodb < answers.txt - rm answers.txt + sudo pecl channel-update pecl.php.net + sudo pecl install mongodb # add extension file and restart service sudo echo 'extension=mongodb.so' | sudo tee /etc/php/7.1/mods-available/mongo.ini diff --git a/setup_projects.sh b/setup_projects.sh index c089c0b0..48a25f6f 100644 --- a/setup_projects.sh +++ b/setup_projects.sh @@ -6,7 +6,7 @@ # # http://mywiki.wooledge.org/BashPitfalls#line-80 # https://stackoverflow.com/a/43606356 -for FILE in project_setup_scripts/*.sh); do - [ -e "$FILE" ] || continue +for FILE in project_setup_scripts/*.sh; do + [ -e $FILE ] || continue (bash -n $FILE) & done \ No newline at end of file From 4553a7c5defb34f024fdd6ef1ef3ea6677d99340 Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Wed, 22 Nov 2017 21:06:17 +1300 Subject: [PATCH 16/44] Adding back implementation for xip.io, tidying up scripts, debugging project_setup_scripts. --- Vagrantfile | 27 ++++++++++++--------------- helpers/ngxdis.sh | 2 +- helpers/ngxen.sh | 2 +- helpers/nvm_install.sh | 2 +- helpers/vhost.sh | 2 +- scripts/couchbase.sh | 2 +- scripts/couchdb.sh | 2 +- scripts/laravel.sh | 2 +- scripts/mssql.sh | 2 +- scripts/neo4j.sh | 2 +- scripts/sphinxsearch.sh | 2 +- scripts/symfony.sh | 4 ++-- scripts/zeromq.sh | 1 - setup_projects.sh | 15 +++++---------- 14 files changed, 29 insertions(+), 38 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 6930dbb8..e297615f 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -2,11 +2,10 @@ # vi: set ft=ruby : # Config Github Settings -#github_username = "rattfieldnz" -#github_repo = "Vaprobash" -#github_branch = "1.4.3" -#github_url = "https://raw.githubusercontent.com/#{github_username}/#{github_repo}/#{github_branch}" -github_url="" +github_username = "rattfieldnz" +github_repo = "Vaprobash" +github_branch = "1.4.3" +github_url = "https://raw.githubusercontent.com/#{github_username}/#{github_repo}/#{github_branch}" vm_synced_folder_host = "code" vm_synced_folder_guest = "/var/www" @@ -17,7 +16,7 @@ github_pat = "" # Server Configuration -hostname = "vaprobash.dev" +hostname = "vaprobash.localhost" # Set a local private network IP address. # See http://en.wikipedia.org/wiki/Private_network for explanation @@ -78,11 +77,13 @@ composer_packages = [ # List any global Composer packages that you wa # Laravel's public directory is assumed "public" public_folder = "/home/ubuntu/code" -laravel_server_name = "laravel-test.localhost" +laravel_server_name = "laravel-test." + server_ip + ".xip.io" +laravel_alias = "laravel-test.localhost" laravel_root_folder = "/var/www/laravel-test" # Where to install Laravel. Will `composer install` if a composer.json file exists laravel_version = "latest-stable" # If you need a specific version of Laravel, set it here -symfony_server_name = "symfony-test.localhost" +symfony_server_name = "symfony-test." + server_ip + ".xip.io" +symfony_alias = "symfony-test.localhost" symfony_root_folder = "/var/www/symfony-test" # Where to install Symfony. nodejs_version = "latest" # By default "latest" will equal the latest stable version @@ -245,7 +246,7 @@ Vagrant.configure("2") do |config| ########## # Provision Apache Base - config.vm.provision "shell", path: "./scripts/apache.sh", args: [server_ip, public_folder, hostname, github_url] + config.vm.provision "shell", path: "./scripts/apache.sh", args: [server_ip, "/var/www/html", hostname, github_url] # Provision Nginx Base # config.vm.provision "shell", path: "#{github_url}/scripts/nginx.sh", args: [server_ip, public_folder, hostname, github_url, php_version] @@ -375,10 +376,10 @@ Vagrant.configure("2") do |config| config.vm.provision "shell", path: "./scripts/composer.sh", privileged: false, args: [github_pat, composer_packages.join(" ")] # Provision Laravel - config.vm.provision "shell", path: "./scripts/laravel.sh", privileged: false, args: [laravel_server_name, laravel_root_folder, laravel_version] + config.vm.provision "shell", path: "./scripts/laravel.sh", privileged: false, args: [laravel_server_name, laravel_alias, laravel_root_folder, laravel_version] # Provision Symfony - config.vm.provision "shell", path: "./scripts/symfony.sh", privileged: false, args: [symfony_server_name, symfony_root_folder] + config.vm.provision "shell", path: "./scripts/symfony.sh", privileged: false, args: [symfony_server_name, symfony_alias, symfony_root_folder] # Install Screen config.vm.provision "shell", path: "./scripts/screen.sh" @@ -409,10 +410,6 @@ Vagrant.configure("2") do |config| # add a bash script file (project_name.sh) in # the 'project_setup_scripts' directory which # contains the necessary functionality to set it/them up. - # - # The bash script referenced below will loop over - # and execute scripts (with .sh extension) in the - # mentioned directory. ########## config.vm.provision "shell", path: "./setup_projects.sh" diff --git a/helpers/ngxdis.sh b/helpers/ngxdis.sh index 922ff5cc..7ad706a9 100644 --- a/helpers/ngxdis.sh +++ b/helpers/ngxdis.sh @@ -61,4 +61,4 @@ else exit 0 fi -fi \ No newline at end of file +fi diff --git a/helpers/ngxen.sh b/helpers/ngxen.sh index bec5379d..cf6fa48d 100644 --- a/helpers/ngxen.sh +++ b/helpers/ngxen.sh @@ -65,4 +65,4 @@ else exit 0 fi fi -fi \ No newline at end of file +fi diff --git a/helpers/nvm_install.sh b/helpers/nvm_install.sh index 6851e335..9c47dcc5 100644 --- a/helpers/nvm_install.sh +++ b/helpers/nvm_install.sh @@ -16,4 +16,4 @@ printf '\n\nexport NVM_DIR=~/.nvm [ -s "~/.nvm/nvm.sh" ] && . "~/.nvm/nvm.sh"' >> $BASHRC source $PROFILE -source $BASHRC \ No newline at end of file +source $BASHRC diff --git a/helpers/vhost.sh b/helpers/vhost.sh index 916399b4..6110d149 100644 --- a/helpers/vhost.sh +++ b/helpers/vhost.sh @@ -184,4 +184,4 @@ else # Enable Site a2ensite ${ServerName}.conf service apache2 reload -fi \ No newline at end of file +fi diff --git a/scripts/couchbase.sh b/scripts/couchbase.sh index 7a0fdf32..4fac9b3e 100644 --- a/scripts/couchbase.sh +++ b/scripts/couchbase.sh @@ -45,4 +45,4 @@ extension=couchbase.so EOF sudo php7.1enmod couchbase sudo service php7.1-fpm restart -fi \ No newline at end of file +fi diff --git a/scripts/couchdb.sh b/scripts/couchdb.sh index fc0ed243..53dcbd2f 100755 --- a/scripts/couchdb.sh +++ b/scripts/couchdb.sh @@ -7,4 +7,4 @@ echo ">>> Installing CouchDB" sudo apt-get install -qq couchdb # Make Futon Available -sudo sed -i 's/;bind_address = 127.0.0.1/bind_address = 0.0.0.0/' /etc/couchdb/local.ini \ No newline at end of file +sudo sed -i 's/;bind_address = 127.0.0.1/bind_address = 0.0.0.0/' /etc/couchdb/local.ini diff --git a/scripts/laravel.sh b/scripts/laravel.sh index 0f6040e0..f0a55d78 100644 --- a/scripts/laravel.sh +++ b/scripts/laravel.sh @@ -85,7 +85,7 @@ if [[ $APACHE_IS_INSTALLED -eq 0 ]]; then chown -R www-data:www-data $laravel_root_folder/storage chmod -R 755 $laravel_root_folder/storage - sudo vhost -s $1 -d $laravel_public_folder + sudo vhost -s $laravel_server_name -a $laravel_alias -d $laravel_public_folder sudo service apache2 restart fi diff --git a/scripts/mssql.sh b/scripts/mssql.sh index f97f7ed5..b74950a3 100644 --- a/scripts/mssql.sh +++ b/scripts/mssql.sh @@ -22,4 +22,4 @@ echo ">>> Installing UnixODBC for MSSQL" sudo apt-get install -qq unixodbc unixodbc-dev # Restart php7.1-fpm -sudo service php7.1-fpm restart \ No newline at end of file +sudo service php7.1-fpm restart diff --git a/scripts/neo4j.sh b/scripts/neo4j.sh index ab43ba8e..51554b67 100644 --- a/scripts/neo4j.sh +++ b/scripts/neo4j.sh @@ -20,4 +20,4 @@ apt-get update apt-get install -qq neo4j # Start the server -service neo4j-service restart \ No newline at end of file +service neo4j-service restart diff --git a/scripts/sphinxsearch.sh b/scripts/sphinxsearch.sh index 16c3f6f3..62df3d3d 100644 --- a/scripts/sphinxsearch.sh +++ b/scripts/sphinxsearch.sh @@ -26,4 +26,4 @@ searchd --stop sudo sed -i 's/sphinxsearch\/searchd.pid/searchd.pid/' /etc/sphinxsearch/sphinx.conf # Start searchd -searchd \ No newline at end of file +searchd diff --git a/scripts/symfony.sh b/scripts/symfony.sh index ee7c9845..06fabc8e 100755 --- a/scripts/symfony.sh +++ b/scripts/symfony.sh @@ -13,7 +13,7 @@ composer -v > /dev/null 2>&1 || { printf "!!! Composer is not installed.\n In # Check if Symfony root is set. If not set use default if [ -z "$2" ]; then - symfony_root_folder="/home/ubuntu/code/symfony-test" + symfony_root_folder="/var/www/symfony-test" else symfony_root_folder="$2" fi @@ -76,7 +76,7 @@ fi if [ $APACHE_IS_INSTALLED -eq 0 ]; then - sudo vhost -s $1 -d $symfony_public_folder + sudo vhost -s $symfony_server_name -a $symfony_alias -d $symfony_public_folder sudo service apache2 restart fi diff --git a/scripts/zeromq.sh b/scripts/zeromq.sh index 390aeb82..49810127 100644 --- a/scripts/zeromq.sh +++ b/scripts/zeromq.sh @@ -19,4 +19,3 @@ echo "" | sudo pecl install zmq-beta > /dev/null sudo echo "extension=zmq.so" >> /etc/php/${PHP_VERSION}/mods-available/zmq.ini sudo phpenmod zmq > /dev/null sudo service php${PHP_VERSION}-fpm restart > /dev/null - diff --git a/setup_projects.sh b/setup_projects.sh index 48a25f6f..684d0fe0 100644 --- a/setup_projects.sh +++ b/setup_projects.sh @@ -1,12 +1,7 @@ #!/usr/bin/env bash -# Loop over bash scripts to set-up projects. -# -# See notes/references below: -# -# http://mywiki.wooledge.org/BashPitfalls#line-80 -# https://stackoverflow.com/a/43606356 -for FILE in project_setup_scripts/*.sh; do - [ -e $FILE ] || continue - (bash -n $FILE) & -done \ No newline at end of file +chmod -R u+x ./project_setup_scripts + +for file in ./project_setup_scripts/*.sh; do + [ -f "$file" ] && [ -x "$file" ] && "$file"; +done From ff32c9221177e2508ecc3a6687ba6f8f484b6598 Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Wed, 22 Nov 2017 22:38:55 +1300 Subject: [PATCH 17/44] Troubleshooting test Laravel/Symfony projects, and custom projects in 'scripts/projects'. --- .gitignore | 1 - Vagrantfile | 13 +++-- .../example_project_setup.txt | 51 ------------------- scripts/laravel.sh | 14 ++--- .../projects}/.gitignore | 1 + scripts/setup_projects.sh | 7 +++ scripts/symfony.sh | 11 ++-- setup_projects.sh | 7 --- 8 files changed, 27 insertions(+), 78 deletions(-) delete mode 100644 project_setup_scripts/example_project_setup.txt rename {project_setup_scripts => scripts/projects}/.gitignore (65%) create mode 100644 scripts/setup_projects.sh delete mode 100644 setup_projects.sh diff --git a/.gitignore b/.gitignore index 8d51c2f5..b74b5c29 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,6 @@ notes.md .vagrant play *.log -project_setup_scripts/*.sh # editor backup files *~ diff --git a/Vagrantfile b/Vagrantfile index e297615f..196dfb1a 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -77,12 +77,12 @@ composer_packages = [ # List any global Composer packages that you wa # Laravel's public directory is assumed "public" public_folder = "/home/ubuntu/code" -laravel_server_name = "laravel-test." + server_ip + ".xip.io" +laravel_server_name = "laravel-test.#{server_ip}.xip.io" laravel_alias = "laravel-test.localhost" laravel_root_folder = "/var/www/laravel-test" # Where to install Laravel. Will `composer install` if a composer.json file exists laravel_version = "latest-stable" # If you need a specific version of Laravel, set it here -symfony_server_name = "symfony-test." + server_ip + ".xip.io" +symfony_server_name = "symfony-test.#{server_ip}.xip.io" symfony_alias = "symfony-test.localhost" symfony_root_folder = "/var/www/symfony-test" # Where to install Symfony. @@ -379,7 +379,7 @@ Vagrant.configure("2") do |config| config.vm.provision "shell", path: "./scripts/laravel.sh", privileged: false, args: [laravel_server_name, laravel_alias, laravel_root_folder, laravel_version] # Provision Symfony - config.vm.provision "shell", path: "./scripts/symfony.sh", privileged: false, args: [symfony_server_name, symfony_alias, symfony_root_folder] + config.vm.provision "shell", path: "./scripts/symfony.sh", privileged: false, args: [symfony_server_name, symfony_alias, symfony_root_folder, server_ip] # Install Screen config.vm.provision "shell", path: "./scripts/screen.sh" @@ -408,9 +408,12 @@ Vagrant.configure("2") do |config| # Optional # If you want to set-up your custom projects, # add a bash script file (project_name.sh) in - # the 'project_setup_scripts' directory which + # the 'scripts/projects' directory which # contains the necessary functionality to set it/them up. + # + # The script below will loop over your project scripts + # and execute each one of them (subject to errors occurring etc). ########## - config.vm.provision "shell", path: "./setup_projects.sh" + config.vm.provision "shell", path: "./scripts/setup_projects.sh" end diff --git a/project_setup_scripts/example_project_setup.txt b/project_setup_scripts/example_project_setup.txt deleted file mode 100644 index 6b1a32bd..00000000 --- a/project_setup_scripts/example_project_setup.txt +++ /dev/null @@ -1,51 +0,0 @@ -# !/usr/bin/env bash -# Add above to your project set-up script. -# Remove space between first 'hash' and exclamation mark! - -PROJECT_LOG_FILE=./EXAMPLE_WEB_PROJECT.build.log; -echo "" > $PROJECT_LOG_FILE; - -echo "Moving into /home/ubuntu/code/EXAMPLE_WEB_PROJECT_FOLDER.\n" >> $PROJECT_LOG_FILE; -cd /home/ubuntu/code/EXAMPLE_WEB_PROJECT_FOLDER >> $PROJECT_LOG_FILE; - -echo "Update global Composer first, befire installing/updating packages.\n" -composer self-update >> $PROJECT_LOG_FILE; - -echo "Install Composer packages for project.\n" >> $PROJECT_LOG_FILE; -composer install >> $PROJECT_LOG_FILE; - -echo "If Composer packages are already installed for project, let's update them.\n" >> $PROJECT_LOG_FILE; -composer update >> $PROJECT_LOG_FILE; - -echo "Compile back-end assets.\n" >> $PROJECT_LOG_FILE; -composer dump-autoload --optimize && -php artisan optimize && -php artisan clear-compiled && -php artisan cache:clear && -php artisan view:clear && -php artisan laroute:generate && -php artisan key:generate >> $PROJECT_LOG_FILE; - -echo "Run database migrations, and seed with data (errors will be logged).\n" >> $PROJECT_LOG_FILE; -php artisan migrate --seed >> $PROJECT_LOG_FILE; - -echo "Install NPM packages for project.\n" >> $PROJECT_LOG_FILE; -npm install --force --save >> $PROJECT_LOG_FILE - -echo "Install front-end packages via Bower.\n" >> $PROJECT_LOG_FILE; -bower install --save --force >> $PROJECT_LOG_FILE; - -echo "Compile front-end assets.\n" >> $PROJECT_LOG_FILE; -gulp copyfiles && -gulp && -gulp minifycss && -gulp minifyjs >> $PROJECT_LOG_FILE; - -echo "Chown storage directory for Apache user:group (www-data:www-data).\n" -chown -R www-data:www-data /home/ubuntu/code/EXAMPLE_WEB_PROJECT_FOLDER/storage - -echo "Make storage directory readable/writeable.\n" -chmod -R 755 /home/ubuntu/code/EXAMPLE_WEB_PROJECT_FOLDER/storage - -echo "Now create Apache Vhost file and enable site.\n" -sudo vhost -s EXAMPLE_WEB_PROJECT_VHOST_NAME -d /home/ubuntu/code/EXAMPLE_WEB_PROJECT_FOLDER/public \ No newline at end of file diff --git a/scripts/laravel.sh b/scripts/laravel.sh index f0a55d78..f898e69d 100644 --- a/scripts/laravel.sh +++ b/scripts/laravel.sh @@ -19,10 +19,10 @@ composer -v > /dev/null 2>&1 || { printf "!!! Composer is not installed.\n In [[ -z "$1" ]] && { printf "!!! Server name address not set. Check the Vagrantfile.\n Installing Laravel aborted!\n"; exit 0; } # Check if Laravel root is set. If not set use default -if [[ -z $2 ]]; then - laravel_root_folder="/home/ubuntu/code/laravel-test" +if [[ -z $laravel_root_folder ]]; then + laravel_root_folder="/var/www/laravel-test" else - laravel_root_folder="$2" + laravel_root_folder="$laravel_root_folder" fi laravel_public_folder="$laravel_root_folder/public" @@ -47,14 +47,14 @@ if [[ ! -f "$laravel_root_folder/composer.json" ]]; then create-project --prefer-dist laravel/laravel $laravel_root_folder else hhvm -v ResourceLimit.SocketDefaultTimeout=30 -v Http.SlowQueryThreshold=30000 -v Eval.Jit=false /usr/local/bin/composer \ - create-project laravel/laravel:$4 $laravel_root_folder + create-project laravel/laravel:$laravel_version $laravel_root_folder fi else # Create Laravel - if [[ "$4" == 'latest-stable' ]]; then + if [[ "$laravel_version" == 'latest-stable' ]]; then composer create-project --prefer-dist laravel/laravel $laravel_root_folder else - composer create-project laravel/laravel:$4 $laravel_root_folder + composer create-project laravel/laravel:$laravel_version $laravel_root_folder fi fi else @@ -74,7 +74,7 @@ fi if [[ $NGINX_IS_INSTALLED -eq 0 ]]; then # Change default vhost created - sudo sed -i "s@root /ubuntu@root $laravel_public_folder@" /etc/nginx/sites-available/$1 + sudo sed -i "s@root /ubuntu@root $laravel_public_folder@" /etc/nginx/sites-available/$laravel_server_name sudo service nginx reload fi diff --git a/project_setup_scripts/.gitignore b/scripts/projects/.gitignore similarity index 65% rename from project_setup_scripts/.gitignore rename to scripts/projects/.gitignore index 2d59fd5d..8089c6d2 100644 --- a/project_setup_scripts/.gitignore +++ b/scripts/projects/.gitignore @@ -2,4 +2,5 @@ */ *.sh *.log +projects/*.sh !.gitignore \ No newline at end of file diff --git a/scripts/setup_projects.sh b/scripts/setup_projects.sh new file mode 100644 index 00000000..af7c9c11 --- /dev/null +++ b/scripts/setup_projects.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +chmod -R u+x projects/ + +for file in projects/*.sh; do + [ -f "$file" ] && [ -x "$file" ] && "$file"; +done diff --git a/scripts/symfony.sh b/scripts/symfony.sh index 06fabc8e..76399bdf 100755 --- a/scripts/symfony.sh +++ b/scripts/symfony.sh @@ -12,17 +12,14 @@ composer -v > /dev/null 2>&1 || { printf "!!! Composer is not installed.\n In [[ -z "$1" ]] && { printf "!!! IP address not set. Check the Vagrantfile.\n Installing Symfony aborted!\n"; exit 0; } # Check if Symfony root is set. If not set use default -if [ -z "$2" ]; then +if [ -z "$3" ]; then symfony_root_folder="/var/www/symfony-test" else - symfony_root_folder="$2" + symfony_root_folder="$3" fi symfony_public_folder="$symfony_root_folder/web" -# The host ip is same as guest ip with last octet equal to 1 -host_ip=`echo $1 | sed 's/\.[0-9]*$/.1/'` - # Test if HHVM is installed hhvm --version > /dev/null 2>&1 HHVM_IS_INSTALLED=$? @@ -65,8 +62,8 @@ sudo chmod -R 775 $symfony_root_folder/app/cache sudo chmod -R 775 $symfony_root_folder/app/logs sudo chmod -R 775 $symfony_root_folder/app/console -sed -i "s/('127.0.0.1', 'fe80::1'/('127.0.0.1', '$host_ip', 'fe80::1'/" $symfony_public_folder/app_dev.php -sed -i "s/'127.0.0.1',$/'127.0.0.1', '$host_ip',/" $symfony_public_folder/config.php +sed -i "s/('127.0.0.1', 'fe80::1'/('127.0.0.1', '$server_ip', 'fe80::1'/" $symfony_public_folder/app_dev.php +sed -i "s/'127.0.0.1',$/'127.0.0.1', '$server_ip',/" $symfony_public_folder/config.php if [ $NGINX_IS_INSTALLED -eq 0 ]; then # Change default vhost created diff --git a/setup_projects.sh b/setup_projects.sh deleted file mode 100644 index 684d0fe0..00000000 --- a/setup_projects.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -chmod -R u+x ./project_setup_scripts - -for file in ./project_setup_scripts/*.sh; do - [ -f "$file" ] && [ -x "$file" ] && "$file"; -done From 884d188127a3472af4a82f1139948683257a9cad Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Wed, 22 Nov 2017 22:43:15 +1300 Subject: [PATCH 18/44] Adding extra checking in laravel.sh test project script. --- scripts/laravel.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/laravel.sh b/scripts/laravel.sh index f898e69d..6fd195b6 100644 --- a/scripts/laravel.sh +++ b/scripts/laravel.sh @@ -42,7 +42,7 @@ fi if [[ ! -f "$laravel_root_folder/composer.json" ]]; then if [[ $HHVM_IS_INSTALLED -eq 0 ]]; then # Create Laravel - if [[ "$4" == 'latest-stable' ]]; then + if [[ "$laravel_version" == 'latest-stable' || "$laravel_version" == '' ]]; then hhvm -v ResourceLimit.SocketDefaultTimeout=30 -v Http.SlowQueryThreshold=30000 -v Eval.Jit=false /usr/local/bin/composer \ create-project --prefer-dist laravel/laravel $laravel_root_folder else @@ -51,7 +51,7 @@ if [[ ! -f "$laravel_root_folder/composer.json" ]]; then fi else # Create Laravel - if [[ "$laravel_version" == 'latest-stable' ]]; then + if [[ "$laravel_version" == 'latest-stable' || "$laravel_version" == '' ]]; then composer create-project --prefer-dist laravel/laravel $laravel_root_folder else composer create-project laravel/laravel:$laravel_version $laravel_root_folder From 2612bacb9bb439abb42aa0aac6d379760e59f772 Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Wed, 22 Nov 2017 22:54:23 +1300 Subject: [PATCH 19/44] Change default Laravel test project version. --- Vagrantfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index 196dfb1a..1491f4f9 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -80,7 +80,7 @@ public_folder = "/home/ubuntu/code" laravel_server_name = "laravel-test.#{server_ip}.xip.io" laravel_alias = "laravel-test.localhost" laravel_root_folder = "/var/www/laravel-test" # Where to install Laravel. Will `composer install` if a composer.json file exists -laravel_version = "latest-stable" # If you need a specific version of Laravel, set it here +laravel_version = "master" # If you need a specific version of Laravel, set it here symfony_server_name = "symfony-test.#{server_ip}.xip.io" symfony_alias = "symfony-test.localhost" From b45569d835c882cb0e48cddf57826979862880e3 Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Wed, 22 Nov 2017 23:48:09 +1300 Subject: [PATCH 20/44] Troubleshooting custom projects in 'scripts/projects'. --- scripts/setup_projects.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/setup_projects.sh b/scripts/setup_projects.sh index af7c9c11..ffa348ed 100644 --- a/scripts/setup_projects.sh +++ b/scripts/setup_projects.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash -chmod -R u+x projects/ +chmod -R u+x ./projects -for file in projects/*.sh; do +for file in ./projects/*.sh; do [ -f "$file" ] && [ -x "$file" ] && "$file"; done From 49c50c093ac1da4ca194e1bcfc486753baa28273 Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Thu, 23 Nov 2017 18:08:44 +1300 Subject: [PATCH 21/44] Removing custom project setup from Vagrantfile - think of dev/user friendly implementation. --- Vagrantfile | 12 ------------ {scripts/projects => projects}/.gitignore | 0 2 files changed, 12 deletions(-) rename {scripts/projects => projects}/.gitignore (100%) diff --git a/Vagrantfile b/Vagrantfile index 1491f4f9..aac25d58 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -404,16 +404,4 @@ Vagrant.configure("2") do |config| # config.vm.provision "shell", path: "./your_script_name.sh" config.vm.provision "shell", path: "./scripts/install_phpmyadmin.sh" - ##### - # Optional - # If you want to set-up your custom projects, - # add a bash script file (project_name.sh) in - # the 'scripts/projects' directory which - # contains the necessary functionality to set it/them up. - # - # The script below will loop over your project scripts - # and execute each one of them (subject to errors occurring etc). - ########## - config.vm.provision "shell", path: "./scripts/setup_projects.sh" - end diff --git a/scripts/projects/.gitignore b/projects/.gitignore similarity index 100% rename from scripts/projects/.gitignore rename to projects/.gitignore From 21dc404a3ef2477e3a1c729d59d5d786c4eb35e9 Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Thu, 23 Nov 2017 23:37:36 +1300 Subject: [PATCH 22/44] Debugging changes in test Laravel and Symfony projects. --- Vagrantfile | 4 ++-- scripts/laravel.sh | 4 ++-- scripts/symfony.sh | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index aac25d58..f59ceb63 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -376,10 +376,10 @@ Vagrant.configure("2") do |config| config.vm.provision "shell", path: "./scripts/composer.sh", privileged: false, args: [github_pat, composer_packages.join(" ")] # Provision Laravel - config.vm.provision "shell", path: "./scripts/laravel.sh", privileged: false, args: [laravel_server_name, laravel_alias, laravel_root_folder, laravel_version] + config.vm.provision "shell", path: "./scripts/laravel.sh", privileged: false, args: [laravel_root_folder, laravel_version, server_ip] # Provision Symfony - config.vm.provision "shell", path: "./scripts/symfony.sh", privileged: false, args: [symfony_server_name, symfony_alias, symfony_root_folder, server_ip] + config.vm.provision "shell", path: "./scripts/symfony.sh", privileged: false, args: [symfony_root_folder, server_ip] # Install Screen config.vm.provision "shell", path: "./scripts/screen.sh" diff --git a/scripts/laravel.sh b/scripts/laravel.sh index 6fd195b6..aae49f31 100644 --- a/scripts/laravel.sh +++ b/scripts/laravel.sh @@ -74,7 +74,7 @@ fi if [[ $NGINX_IS_INSTALLED -eq 0 ]]; then # Change default vhost created - sudo sed -i "s@root /ubuntu@root $laravel_public_folder@" /etc/nginx/sites-available/$laravel_server_name + sudo sed -i "s@root /ubuntu@root $laravel_public_folder@" /etc/nginx/sites-available/"laravel-test.$server_ip.xip.io" sudo service nginx reload fi @@ -85,7 +85,7 @@ if [[ $APACHE_IS_INSTALLED -eq 0 ]]; then chown -R www-data:www-data $laravel_root_folder/storage chmod -R 755 $laravel_root_folder/storage - sudo vhost -s $laravel_server_name -a $laravel_alias -d $laravel_public_folder + sudo vhost -s "laravel-test."$server_ip".xip.io" -a "laravel-test.localhost" -d $laravel_public_folder sudo service apache2 restart fi diff --git a/scripts/symfony.sh b/scripts/symfony.sh index 76399bdf..f1cd5fd9 100755 --- a/scripts/symfony.sh +++ b/scripts/symfony.sh @@ -73,7 +73,7 @@ fi if [ $APACHE_IS_INSTALLED -eq 0 ]; then - sudo vhost -s $symfony_server_name -a $symfony_alias -d $symfony_public_folder + sudo vhost -s "symfony-test."$server_ip".xip.io" -a "symfony-test.localhost" -d $symfony_public_folder sudo service apache2 restart fi From 6875d34535e21229c450c4f2bf3b17294d13fd75 Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Fri, 24 Nov 2017 00:38:24 +1300 Subject: [PATCH 23/44] Debugging changes in test Laravel and Symfony projects. --- scripts/laravel.sh | 2 +- scripts/symfony.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/laravel.sh b/scripts/laravel.sh index aae49f31..5924505b 100644 --- a/scripts/laravel.sh +++ b/scripts/laravel.sh @@ -85,7 +85,7 @@ if [[ $APACHE_IS_INSTALLED -eq 0 ]]; then chown -R www-data:www-data $laravel_root_folder/storage chmod -R 755 $laravel_root_folder/storage - sudo vhost -s "laravel-test."$server_ip".xip.io" -a "laravel-test.localhost" -d $laravel_public_folder + sudo vhost -s "laravel-test.192.168.22.10.xip.io" -a "laravel-test.localhost" -d $laravel_public_folder sudo service apache2 restart fi diff --git a/scripts/symfony.sh b/scripts/symfony.sh index f1cd5fd9..d9e3aabb 100755 --- a/scripts/symfony.sh +++ b/scripts/symfony.sh @@ -62,8 +62,8 @@ sudo chmod -R 775 $symfony_root_folder/app/cache sudo chmod -R 775 $symfony_root_folder/app/logs sudo chmod -R 775 $symfony_root_folder/app/console -sed -i "s/('127.0.0.1', 'fe80::1'/('127.0.0.1', '$server_ip', 'fe80::1'/" $symfony_public_folder/app_dev.php -sed -i "s/'127.0.0.1',$/'127.0.0.1', '$server_ip',/" $symfony_public_folder/config.php +sed -i "s/('127.0.0.1', 'fe80::1'/('127.0.0.1', '192.168.22.10', 'fe80::1'/" $symfony_public_folder/app_dev.php +sed -i "s/'127.0.0.1',$/'127.0.0.1', '192.168.22.10',/" $symfony_public_folder/config.php if [ $NGINX_IS_INSTALLED -eq 0 ]; then # Change default vhost created @@ -73,7 +73,7 @@ fi if [ $APACHE_IS_INSTALLED -eq 0 ]; then - sudo vhost -s "symfony-test."$server_ip".xip.io" -a "symfony-test.localhost" -d $symfony_public_folder + sudo vhost -s "symfony-test.192.168.22.10.xip.io" -a "symfony-test.localhost" -d $symfony_public_folder sudo service apache2 restart fi From 2b38fdf95d8a1a5b221d0a6c9f2df267a9adc49f Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Wed, 10 Jan 2018 16:11:14 +1300 Subject: [PATCH 24/44] Fixed minor bug in Redis auto-installation, added scripts/projects folder to .gitignore. --- .gitignore | 1 + Vagrantfile | 12 ++++++------ scripts/redis.sh | 4 +++- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index b74b5c29..24d1edb7 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ notes.md .vagrant play *.log +scripts/projects # editor backup files *~ diff --git a/Vagrantfile b/Vagrantfile index f59ceb63..96caefef 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -88,9 +88,11 @@ symfony_root_folder = "/var/www/symfony-test" # Where to install Symfony. nodejs_version = "latest" # By default "latest" will equal the latest stable version nodejs_packages = [ # List any global NodeJS packages that you want to install + "npm", "grunt-cli", "gulp", "bower", + "yarn", "yo", "gulp-concat-css", "gulp-minify-css", @@ -101,10 +103,8 @@ nodejs_packages = [ # List any global NodeJS packages that you wa "notify-send", "sw-precache-webpack-plugin", "cross-env", - "cross-env", - "laravel-mix" -] - + "laravel-mix", + "laravel-elixir" # RabbitMQ settings rabbitmq_user = "user" rabbitmq_password = "password" @@ -319,10 +319,10 @@ Vagrant.configure("2") do |config| config.vm.provision "shell", path: "./scripts/memcached.sh" # Provision Redis (without journaling and persistence) - # config.vm.provision "shell", path: "#{github_url}/scripts/redis.sh" + config.vm.provision "shell", path: "#{github_url}/scripts/redis.sh" # Provision Redis (with journaling and persistence) - config.vm.provision "shell", path: "./scripts/redis.sh", args: "persistent" + # config.vm.provision "shell", path: "./scripts/redis.sh", args: "persistent" # NOTE: It is safe to run this to add persistence even if originally provisioned without persistence diff --git a/scripts/redis.sh b/scripts/redis.sh index 9c2983ca..f4b55f33 100644 --- a/scripts/redis.sh +++ b/scripts/redis.sh @@ -25,7 +25,9 @@ if [ ! -z "$1" ]; then # add the config to the redis config includes if ! cat /etc/redis/redis.conf | grep -q "journaling.conf"; then + sudo chown ubuntu:root /etc/redis/redis.conf sudo echo "include /etc/redis/conf.d/journaling.conf" >> /etc/redis/redis.conf + sudo chown redis:redis /etc/redis/redis.conf fi # schedule background append rewriting @@ -36,4 +38,4 @@ if [ ! -z "$1" ]; then fi # persistent fi # arg check -sudo service redis-server restart +sudo service redis-server start From 630dff4266f83adcf000f8dfee208579f8f4e0d6 Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Wed, 10 Jan 2018 16:15:47 +1300 Subject: [PATCH 25/44] Convert tabs to 4 spaces in scripts/redis.sh. --- scripts/redis.sh | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/scripts/redis.sh b/scripts/redis.sh index f4b55f33..33e3014c 100644 --- a/scripts/redis.sh +++ b/scripts/redis.sh @@ -20,22 +20,22 @@ EOF # Persistence if [ ! -z "$1" ]; then - if [ "$1" == "persistent" ]; then - echo ">>> Enabling Redis Persistence" - - # add the config to the redis config includes - if ! cat /etc/redis/redis.conf | grep -q "journaling.conf"; then - sudo chown ubuntu:root /etc/redis/redis.conf - sudo echo "include /etc/redis/conf.d/journaling.conf" >> /etc/redis/redis.conf - sudo chown redis:redis /etc/redis/redis.conf - fi - - # schedule background append rewriting - if ! crontab -l | grep -q "redis-cli bgrewriteaof"; then - line="*/5 * * * * /usr/bin/redis-cli bgrewriteaof > /dev/null 2>&1" - (sudo crontab -l; echo "$line" ) | sudo crontab - - fi - fi # persistent + if [ "$1" == "persistent" ]; then + echo ">>> Enabling Redis Persistence" + + # add the config to the redis config includes + if ! cat /etc/redis/redis.conf | grep -q "journaling.conf"; then + sudo chown ubuntu:root /etc/redis/redis.conf + sudo echo "include /etc/redis/conf.d/journaling.conf" >> /etc/redis/redis.conf + sudo chown redis:redis /etc/redis/redis.conf + fi + + # schedule background append rewriting + if ! crontab -l | grep -q "redis-cli bgrewriteaof"; then + line="*/5 * * * * /usr/bin/redis-cli bgrewriteaof > /dev/null 2>&1" + (sudo crontab -l; echo "$line" ) | sudo crontab - + fi + fi # persistent fi # arg check sudo service redis-server start From bb26da104fd3c7b4e0274457c5b2cf481ff39fef Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Wed, 10 Jan 2018 16:25:50 +1300 Subject: [PATCH 26/44] Converted tabs to 4 spaces. --- scripts/mailcatcher.sh | 22 +++++++++++----------- scripts/mongodb.sh | 2 +- scripts/mysql.sh | 20 ++++++++++---------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/scripts/mailcatcher.sh b/scripts/mailcatcher.sh index 90970e00..9352bd75 100644 --- a/scripts/mailcatcher.sh +++ b/scripts/mailcatcher.sh @@ -17,15 +17,15 @@ APACHE_IS_INSTALLED=$? sudo apt-get install -qq libsqlite3-dev ruby1.9.1-dev if $(which rvm) -v > /dev/null 2>&1; then - echo ">>>>Installing with RVM" - $(which rvm) default@mailcatcher --create do gem install --no-rdoc --no-ri mailcatcher - $(which rvm) wrapper default@mailcatcher --no-prefix mailcatcher catchmail + echo ">>>>Installing with RVM" + $(which rvm) default@mailcatcher --create do gem install --no-rdoc --no-ri mailcatcher + $(which rvm) wrapper default@mailcatcher --no-prefix mailcatcher catchmail else - # Gem check - if ! gem -v > /dev/null 2>&1; then sudo aptitude install -y libgemplugin-ruby; fi + # Gem check + if ! gem -v > /dev/null 2>&1; then sudo aptitude install -y libgemplugin-ruby; fi - # Install - gem install --no-rdoc --no-ri mailcatcher + # Install + gem install --no-rdoc --no-ri mailcatcher fi # Make it start on boot @@ -44,12 +44,12 @@ EOL sudo service mailcatcher start if [[ $PHP_IS_INSTALLED -eq 0 ]]; then - # Make php use it to send mail + # Make php use it to send mail echo "sendmail_path = /usr/bin/env $(which catchmail)" | sudo tee /etc/php/${PHP_VERSION}/mods-available/mailcatcher.ini - sudo phpenmod mailcatcher - sudo service php${PHP_VERSION}-fpm restart + sudo phpenmod mailcatcher + sudo service php${PHP_VERSION}-fpm restart fi if [[ $APACHE_IS_INSTALLED -eq 0 ]]; then - sudo service apache2 restart + sudo service apache2 restart fi diff --git a/scripts/mongodb.sh b/scripts/mongodb.sh index 6bf19faf..ee032a91 100644 --- a/scripts/mongodb.sh +++ b/scripts/mongodb.sh @@ -49,7 +49,7 @@ if [ $PHP_IS_INSTALLED -eq 0 ]; then sudo apt-get -y install php-pear php7.1-dev # install php extension - sudo pecl channel-update pecl.php.net + sudo pecl channel-update pecl.php.net sudo pecl install mongodb # add extension file and restart service diff --git a/scripts/mysql.sh b/scripts/mysql.sh index 860bcca3..59f1a04f 100644 --- a/scripts/mysql.sh +++ b/scripts/mysql.sh @@ -8,24 +8,24 @@ mysql_package=mysql-server if [ $2 == "5.6" ]; then # Add repo for MySQL 5.6 - sudo add-apt-repository -y ppa:ondrej/mysql-5.6 + sudo add-apt-repository -y ppa:ondrej/mysql-5.6 - # Update Again - sudo apt-get update + # Update Again + sudo apt-get update - # Change package - mysql_package=mysql-server-5.6 + # Change package + mysql_package=mysql-server-5.6 fi if [ $2 == "5.7" ]; then # Add repo for MySQL 5.7 - sudo add-apt-repository -y ppa:ondrej/mysql-5.7 + sudo add-apt-repository -y ppa:ondrej/mysql-5.7 - # Update Again - sudo apt-get update + # Update Again + sudo apt-get update - # Change package - mysql_package=mysql-server-5.7 + # Change package + mysql_package=mysql-server-5.7 fi # Install MySQL without password prompt From 8c44068b5904b40c7abc7d1613bc6edc10464320 Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Wed, 10 Jan 2018 16:30:29 +1300 Subject: [PATCH 27/44] Correcting syntax error in Vagrantfile. --- Vagrantfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Vagrantfile b/Vagrantfile index 96caefef..93104238 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -105,6 +105,7 @@ nodejs_packages = [ # List any global NodeJS packages that you wa "cross-env", "laravel-mix", "laravel-elixir" +] # RabbitMQ settings rabbitmq_user = "user" rabbitmq_password = "password" From c69329ff36dea840457b12e3ec03a3a9a95b73e6 Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Wed, 10 Jan 2018 22:26:20 +1300 Subject: [PATCH 28/44] Enable mod headers for Apache2 install/configuration. --- scripts/apache.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/apache.sh b/scripts/apache.sh index 8bbeafce..d77c3bd3 100644 --- a/scripts/apache.sh +++ b/scripts/apache.sh @@ -71,4 +71,5 @@ else fi sudo a2enmod php7.1 +sudo a2enmod headers sudo service apache2 restart From b3d918e148e7b2a182da7436baba06e9829c511d Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Mon, 26 Feb 2018 21:10:21 +1300 Subject: [PATCH 29/44] Updating versions for global Composer packages. --- Vagrantfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 93104238..4324b69f 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -63,13 +63,13 @@ hhvm = "false" # PHP Options composer_packages = [ # List any global Composer packages that you want to install - "phpunit/phpunit:~6.4", - "phpunit/php-invoker:^1.1", + "phpunit/phpunit:~7.0", + "phpunit/php-invoker:^2.0", "codeception/codeception:~2.3", - "phpspec/phpspec:~4.2", - "squizlabs/php_codesniffer:^3.0", + "phpspec/phpspec:~4.3", + "squizlabs/php_codesniffer:^3.2", "unitgen/unitgen:dev-master", - "theseer/phpdox:~0.10.1" + "theseer/phpdox:~0.11" ] # Default web server document root From 47484fc4f0e3683208c655cc2588867e99a2d70a Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Sat, 12 Jan 2019 13:57:06 +1300 Subject: [PATCH 30/44] Updated scripts. --- Vagrantfile | 40 +++++++++++++++++++--------------------- scripts/apache.sh | 15 ++++++++++++--- scripts/base.sh | 10 +++++----- scripts/composer.sh | 4 ++-- scripts/docker.sh | 6 +++--- scripts/elastichq.sh | 8 ++++---- scripts/git-ftp.sh | 4 ++-- scripts/go.sh | 2 +- scripts/laravel.sh | 4 ++-- scripts/mariadb.sh | 2 +- scripts/mongodb.sh | 16 ++++++++++------ scripts/mysql.sh | 10 ---------- scripts/nginx.sh | 6 +++--- scripts/nodejs.sh | 4 ++-- scripts/pgsql.sh | 10 +++++----- scripts/php.sh | 12 ++++++------ scripts/redis.sh | 2 +- scripts/symfony.sh | 4 ++-- scripts/vim.sh | 14 +++++++------- 19 files changed, 87 insertions(+), 86 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 4324b69f..7d5a27fb 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -47,7 +47,7 @@ mongo_enable_remote = "false" # remote access enabled when true # Languages and Packages php_timezone = "Pacific/Auckland" # http://php.net/manual/en/timezones.php -php_version = "7.1" # Options: 5.5 | 5.6 | 7.0 | 7.1 +php_version = "7.2" # Options: 5.5 | 5.6 | 7.0 | 7.1 ruby_version = "latest" # Choose what ruby version should be installed (will also be the default version) ruby_gems = [ # List any Ruby Gems that you want to install "sass", @@ -63,28 +63,26 @@ hhvm = "false" # PHP Options composer_packages = [ # List any global Composer packages that you want to install - "phpunit/phpunit:~7.0", - "phpunit/php-invoker:^2.0", - "codeception/codeception:~2.3", - "phpspec/phpspec:~4.3", - "squizlabs/php_codesniffer:^3.2", + "phpunit/phpunit:~7.5", + "codeception/codeception:~2.5", + "phpspec/phpspec:~5.1", + "squizlabs/php_codesniffer:^3.4", "unitgen/unitgen:dev-master", - "theseer/phpdox:~0.11" ] # Default web server document root # Symfony's public directory is assumed "web" # Laravel's public directory is assumed "public" -public_folder = "/home/ubuntu/code" +public_folder = "/home/vagrant/code" -laravel_server_name = "laravel-test.#{server_ip}.xip.io" -laravel_alias = "laravel-test.localhost" -laravel_root_folder = "/var/www/laravel-test" # Where to install Laravel. Will `composer install` if a composer.json file exists -laravel_version = "master" # If you need a specific version of Laravel, set it here +#laravel_server_name = "laravel-test.#{server_ip}.xip.io" +#laravel_alias = "laravel-test.localhost" +#laravel_root_folder = "/var/www/laravel-test" # Where to install Laravel. Will `composer install` if a composer.json file exists +#laravel_version = "master" # If you need a specific version of Laravel, set it here -symfony_server_name = "symfony-test.#{server_ip}.xip.io" -symfony_alias = "symfony-test.localhost" -symfony_root_folder = "/var/www/symfony-test" # Where to install Symfony. +#symfony_server_name = "symfony-test.#{server_ip}.xip.io" +#symfony_alias = "symfony-test.localhost" +#symfony_root_folder = "/var/www/symfony-test" # Where to install Symfony. nodejs_version = "latest" # By default "latest" will equal the latest stable version nodejs_packages = [ # List any global NodeJS packages that you want to install @@ -117,7 +115,7 @@ elasticsearch_version = "2.3.1" # 5.0.0-alpha1, 2.3.1, 2.2.2, 2.1.2, 1.7.5 Vagrant.configure("2") do |config| # Set server to Ubuntu 16.04 - config.vm.box = "ubuntu/xenial64" + config.vm.box = "ubuntu/bionic64" config.vm.define "Vaprobash" do |vapro| end @@ -263,10 +261,10 @@ Vagrant.configure("2") do |config| config.vm.provision "shell", path: "./scripts/mysql.sh", args: [mysql_root_password, mysql_version, mysql_enable_remote] # Provision PostgreSQL - config.vm.provision "shell", path: "./scripts/pgsql.sh", args: pgsql_root_password + # config.vm.provision "shell", path: "./scripts/pgsql.sh", args: pgsql_root_password # Provision SQLite - config.vm.provision "shell", path: "./scripts/sqlite.sh" + #config.vm.provision "shell", path: "./scripts/sqlite.sh" # Provision RethinkDB # config.vm.provision "shell", path: "#{github_url}/scripts/rethinkdb.sh", args: pgsql_root_password @@ -278,7 +276,7 @@ Vagrant.configure("2") do |config| # config.vm.provision "shell", path: "#{github_url}/scripts/couchdb.sh" # Provision MongoDB - config.vm.provision "shell", path: "./scripts/mongodb.sh", args: [mongo_enable_remote, mongo_version] + #config.vm.provision "shell", path: "./scripts/mongodb.sh", args: [mongo_enable_remote, mongo_version] # Provision MariaDB # config.vm.provision "shell", path: "./scripts/mariadb.sh", args: [mysql_root_password, mysql_enable_remote] @@ -377,10 +375,10 @@ Vagrant.configure("2") do |config| config.vm.provision "shell", path: "./scripts/composer.sh", privileged: false, args: [github_pat, composer_packages.join(" ")] # Provision Laravel - config.vm.provision "shell", path: "./scripts/laravel.sh", privileged: false, args: [laravel_root_folder, laravel_version, server_ip] + #config.vm.provision "shell", path: "./scripts/laravel.sh", privileged: false, args: [laravel_root_folder, laravel_version, server_ip] # Provision Symfony - config.vm.provision "shell", path: "./scripts/symfony.sh", privileged: false, args: [symfony_root_folder, server_ip] + #config.vm.provision "shell", path: "./scripts/symfony.sh", privileged: false, args: [symfony_root_folder, server_ip] # Install Screen config.vm.provision "shell", path: "./scripts/screen.sh" diff --git a/scripts/apache.sh b/scripts/apache.sh index d77c3bd3..b147d890 100644 --- a/scripts/apache.sh +++ b/scripts/apache.sh @@ -3,6 +3,9 @@ # Test if PHP is installed php -v > /dev/null 2>&1 PHP_IS_INSTALLED=$? +PHP_INSTALLED_VERSION=$? + +[[ $PHP_IS_INSTALLED -eq 0 ]] && { PHP_INSTALLED_VERSION=$(php -r "echo PHP_VERSION;" | cut -c 1,2,3); } # Test if HHVM is installed hhvm --version > /dev/null 2>&1 @@ -16,7 +19,7 @@ echo ">>> Installing Apache Server" [[ -z $1 ]] && { echo "!!! IP address not set. Check the Vagrant file."; exit 1; } if [[ -z $2 ]]; then - public_folder="/home/ubuntu/code" + public_folder="/home/vagrant/code" else public_folder="$2" fi @@ -27,6 +30,12 @@ else github_url="$4" fi +if [[ -z $5 ]]; then + php_version="7.2" +else + php_version="$5" +fi + # Add repo for latest FULL stable Apache # (Required to remove conflicts with PHP PPA due to partial Apache upgrade within it) sudo add-apt-repository -y ppa:ondrej/apache2 @@ -49,7 +58,7 @@ sudo usermod -a -G www-data ubuntu # On separate lines since some may cause an error # if not installed sudo a2dismod mpm_prefork mpm_worker -sudo a2dismod php7.1 +sudo a2dismod php${PHP_INSTALLED_VERSION} sudo a2enmod rewrite actions ssl curl --silent -L $github_url/helpers/vhost.sh > vhost sudo chmod guo+x vhost @@ -70,6 +79,6 @@ else sudo sed -i "s@ProxyPassMatch@#ProxyPassMatch@" /etc/apache2/sites-available/$1.xip.io.conf fi -sudo a2enmod php7.1 +sudo a2enmod php${PHP_INSTALLED_VERSION} sudo a2enmod headers sudo service apache2 restart diff --git a/scripts/base.sh b/scripts/base.sh index ebefeaf5..f5ea1c6b 100644 --- a/scripts/base.sh +++ b/scripts/base.sh @@ -29,13 +29,13 @@ DOMAIN="*.xip.io" PASSPHRASE="vaprobash" SUBJ=" -C=NZ -ST=Otago +C=US +ST=California O=Vaprobash -localityName=Dunedin +localityName=Los Angeles commonName=$DOMAIN -organizationalUnitName= -emailAddress= +organizationalUnitName=Vaprobash +emailAddress=vaprobash@test.com " sudo mkdir -p "$SSL_DIR" diff --git a/scripts/composer.sh b/scripts/composer.sh index 31530f83..4c764db2 100644 --- a/scripts/composer.sh +++ b/scripts/composer.sh @@ -88,9 +88,9 @@ if [[ ! -z $COMPOSER_PACKAGES ]]; then if [[ -f $PROFILE ]]; then if ! grep -qsc 'COMPOSER_HOME=' $PROFILE; then # Ensure COMPOSER_HOME variable is set. This isn't set by Composer automatically - printf "\n\nCOMPOSER_HOME=\"/home/ubuntu/.composer\"" >> $PROFILE + printf "\n\nCOMPOSER_HOME=\"/home/vagrant/.composer\"" >> $PROFILE # Add composer home vendor bin dir to PATH to run globally installed executables - printf "\n# Add Composer Global Bin to PATH\n%s" 'export PATH=$PATH:$COMPOSER_HOME/ubuntu/bin' >> $PROFILE + printf "\n# Add Composer Global Bin to PATH\n%s" 'export PATH=$PATH:$COMPOSER_HOME/vagrant/bin' >> $PROFILE source $PROFILE source $BASHRC diff --git a/scripts/docker.sh b/scripts/docker.sh index e0e8a283..2a51764b 100644 --- a/scripts/docker.sh +++ b/scripts/docker.sh @@ -13,12 +13,12 @@ sudo apt-get update # -qq implies -y --force-yes sudo apt-get install -qq lxc-docker -# Make the ubuntu user able to interact with docker without sudo +# Make the vagrant user able to interact with docker without sudo if [ ! -z "$1" ]; then if [ "$1" == "permissions" ]; then - echo ">>> Adding ubuntu user to docker group" + echo ">>> Adding vagrant user to docker group" - sudo usermod -a -G docker ubuntu + sudo usermod -a -G docker vagrant fi # permissions fi # arg check diff --git a/scripts/elastichq.sh b/scripts/elastichq.sh index 652cbc6e..94f89c38 100644 --- a/scripts/elastichq.sh +++ b/scripts/elastichq.sh @@ -37,9 +37,9 @@ fi # Set and enable configuration for Nginx if [ $NGINX_IS_INSTALLED -eq 0 ]; then - sudo ngxdis ubuntu - sudo sed -i '$ d' /etc/nginx/sites-available/ubuntu -sudo tee -a /etc/nginx/sites-available/ubuntu > /dev/null <<'EOF' + sudo ngxdis vagrant + sudo sed -i '$ d' /etc/nginx/sites-available/vagrant +sudo tee -a /etc/nginx/sites-available/vagrant > /dev/null <<'EOF' location /elastichq { root /usr/share/; @@ -62,7 +62,7 @@ sudo tee -a /etc/nginx/sites-available/ubuntu > /dev/null <<'EOF' } } EOF - sudo ngxen ubuntu + sudo ngxen vagrant # Reload Nginx to load in configuration sudo service nginx reload diff --git a/scripts/git-ftp.sh b/scripts/git-ftp.sh index a95447b4..4cf6abe1 100644 --- a/scripts/git-ftp.sh +++ b/scripts/git-ftp.sh @@ -21,10 +21,10 @@ fi echo ">>> Installing git-ftp"; # Clone git-ftp into .git-ftp folder -git clone https://github.com/git-ftp/git-ftp.git /home/ubuntu/.git-ftp +git clone https://github.com/git-ftp/git-ftp.git /home/vagrant/.git-ftp # Move to the .git-ftp folder -cd /home/ubuntu/.git-ftp +cd /home/vagrant/.git-ftp # Install git-ftp sudo make install diff --git a/scripts/go.sh b/scripts/go.sh index 9cc32371..dadc1d7c 100755 --- a/scripts/go.sh +++ b/scripts/go.sh @@ -18,7 +18,7 @@ else echo "Installing Go version manager" sudo apt-get install -qq curl git mercurial make binutils bison build-essential bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer) - source /home/ubuntu/.gvm/scripts/gvm + source /home/vagrant/.gvm/scripts/gvm if [[ $GO_VERSION -eq "latest" ]]; then GO_VERSION=`curl -L 'https://golang.org/' | grep 'Build version' | awk '{print $3}' | awk -F\< '{ print $1 }' | rev | cut -c 2- | rev` diff --git a/scripts/laravel.sh b/scripts/laravel.sh index 5924505b..6789fa2e 100644 --- a/scripts/laravel.sh +++ b/scripts/laravel.sh @@ -58,7 +58,7 @@ if [[ ! -f "$laravel_root_folder/composer.json" ]]; then fi fi else - # Go to ubuntu folder + # Go to Laravel folder cd $laravel_root_folder if [[ $HHVM_IS_INSTALLED -eq 0 ]]; then @@ -74,7 +74,7 @@ fi if [[ $NGINX_IS_INSTALLED -eq 0 ]]; then # Change default vhost created - sudo sed -i "s@root /ubuntu@root $laravel_public_folder@" /etc/nginx/sites-available/"laravel-test.$server_ip.xip.io" + sudo sed -i "s@root /vagrant@root $laravel_public_folder@" /etc/nginx/sites-available/"laravel-test.$server_ip.xip.io" sudo service nginx reload fi diff --git a/scripts/mariadb.sh b/scripts/mariadb.sh index d89cacd3..c54002a2 100644 --- a/scripts/mariadb.sh +++ b/scripts/mariadb.sh @@ -11,7 +11,7 @@ MARIADB_VERSION='10.1' sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db # Add repo for MariaDB -sudo add-apt-repository "deb [arch=amd64,i386] http://mirrors.accretive-networks.net/mariadb/repo/$MARIADB_VERSION/ubuntu trusty main" +sudo add-apt-repository "deb [arch=amd64,i386] http://mirrors.accretive-networks.net/mariadb/repo/$MARIADB_VERSION/ubuntu bionic main" # Update sudo apt-get update diff --git a/scripts/mongodb.sh b/scripts/mongodb.sh index ee032a91..003faebc 100644 --- a/scripts/mongodb.sh +++ b/scripts/mongodb.sh @@ -5,7 +5,7 @@ echo ">>> Installing MongoDB" # Get key and add to sources sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927 -echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list +echo "deb http://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.1 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.1.list # Update @@ -45,17 +45,21 @@ php -v > /dev/null 2>&1 PHP_IS_INSTALLED=$? if [ $PHP_IS_INSTALLED -eq 0 ]; then + # get current PHP version + + PHP_INSTALLED_VERSION=$(php -r "echo PHP_VERSION;" | cut -c 1,2,3) + # install dependencies - sudo apt-get -y install php-pear php7.1-dev + sudo apt-get -y install php-pear php${PHP_INSTALLED_VERSION}-dev # install php extension sudo pecl channel-update pecl.php.net sudo pecl install mongodb # add extension file and restart service - sudo echo 'extension=mongodb.so' | sudo tee /etc/php/7.1/mods-available/mongo.ini + sudo echo 'extension=mongodb.so' | sudo tee /etc/php/${PHP_INSTALLED_VERSION}/mods-available/mongo.ini - sudo ln -s /etc/php/7.1/mods-available/mongo.ini /etc/php/7.1/fpm/conf.d/mongo.ini - sudo ln -s /etc/php/7.1/mods-available/mongo.ini /etc/php/7.1/cli/conf.d/mongo.ini - sudo service php7.1-fpm restart + sudo ln -s /etc/php/${PHP_INSTALLED_VERSION}/mods-available/mongo.ini /etc/php/${PHP_INSTALLED_VERSION}/fpm/conf.d/mongo.ini + sudo ln -s /etc/php/${PHP_INSTALLED_VERSION}/mods-available/mongo.ini /etc/php/${PHP_INSTALLED_VERSION}/cli/conf.d/mongo.ini + sudo service php${PHP_INSTALLED_VERSION}-fpm restart fi diff --git a/scripts/mysql.sh b/scripts/mysql.sh index 59f1a04f..a4863093 100644 --- a/scripts/mysql.sh +++ b/scripts/mysql.sh @@ -7,22 +7,12 @@ echo ">>> Installing MySQL Server $2" mysql_package=mysql-server if [ $2 == "5.6" ]; then - # Add repo for MySQL 5.6 - sudo add-apt-repository -y ppa:ondrej/mysql-5.6 - - # Update Again - sudo apt-get update # Change package mysql_package=mysql-server-5.6 fi if [ $2 == "5.7" ]; then - # Add repo for MySQL 5.7 - sudo add-apt-repository -y ppa:ondrej/mysql-5.7 - - # Update Again - sudo apt-get update # Change package mysql_package=mysql-server-5.7 diff --git a/scripts/nginx.sh b/scripts/nginx.sh index c9911b2f..2078a433 100644 --- a/scripts/nginx.sh +++ b/scripts/nginx.sh @@ -16,7 +16,7 @@ echo ">>> Installing Nginx" [[ -z $1 ]] && { echo "!!! IP address not set. Check the Vagrant file."; exit 1; } if [[ -z $2 ]]; then - public_folder="/home/ubuntu/code" + public_folder="/var/www/html" else public_folder="$2" fi @@ -49,9 +49,9 @@ sudo apt-get install -qq nginx # Turn off sendfile to be more compatible with Windows, which can't use NFS sed -i 's/sendfile on;/sendfile off;/' /etc/nginx/nginx.conf -# Set run-as user for PHP5-FPM processes to user/group "ubuntu" +# Set run-as user for PHP5-FPM processes to user/group "vagrant" # to avoid permission errors from apps writing to files -sed -i "s/user www-data;/user ubuntu;/" /etc/nginx/nginx.conf +sed -i "s/user www-data;/user vagrant;/" /etc/nginx/nginx.conf sed -i "s/# server_names_hash_bucket_size.*/server_names_hash_bucket_size 64;/" /etc/nginx/nginx.conf # Add ubuntu user to www-data group diff --git a/scripts/nodejs.sh b/scripts/nodejs.sh index f64fd440..6d5c817e 100644 --- a/scripts/nodejs.sh +++ b/scripts/nodejs.sh @@ -19,12 +19,12 @@ if [[ $NODE_IS_INSTALLED -ne 0 ]]; then echo ">>> Installing latest stable Node LTS - 6.X" sudo apt-get update - sudo apt-get -qq install python-software-properties + sudo apt-get -y install python-software-properties # Install NVM curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - sudo apt-get update - sudo apt-get -qq install nodejs + sudo apt-get -y install nodejs npm # Re-source user profiles # if they exist diff --git a/scripts/pgsql.sh b/scripts/pgsql.sh index cd315a48..6f45d3c3 100644 --- a/scripts/pgsql.sh +++ b/scripts/pgsql.sh @@ -5,7 +5,7 @@ echo ">>> Installing PostgreSQL" [[ -z "$1" ]] && { echo "!!! PostgreSQL root password not set. Check the Vagrant file."; exit 1; } # Set some variables -POSTGRE_VERSION=10 +POSTGRE_VERSION=12 # Add PostgreSQL GPG public key # to get latest stable @@ -14,7 +14,7 @@ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt- # Add PostgreSQL Apt repository # to get latest stable sudo touch /etc/apt/sources.list.d/pgdg.list -sudo echo "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list +sudo echo "deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list # Update Apt repos sudo apt-get update @@ -35,11 +35,11 @@ sudo sed -i "s/#listen_addresses = 'localhost'/listen_addresses = '*'/g" /etc/po echo "host all all 0.0.0.0/0 md5" | sudo tee -a /etc/postgresql/$POSTGRE_VERSION/main/pg_hba.conf sudo service postgresql start -# Create new superuser "ubuntu" -sudo -u postgres createuser -s ubuntu +# Create new superuser "vagrant" +sudo -u postgres createuser -s vagrant # Create new user "root" w/ defined password -# Not a superuser, just tied to new db "ubuntu" +# Not a superuser, just tied to new db "vagrant" sudo -u postgres psql -c "CREATE ROLE root LOGIN PASSWORD '$1' NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION;" # Make sure changes are reflected by restarting diff --git a/scripts/php.sh b/scripts/php.sh index cbbc7fc9..01f9bb47 100644 --- a/scripts/php.sh +++ b/scripts/php.sh @@ -40,7 +40,7 @@ else # -qq implies -y --force-yes # Install PHP module for Apache - sudo apt-get install -qq libapache2-mod-php${PHP_VERSION} php${PHP_VERSION}-cli php${PHP_VERSION}-fpm php${PHP_VERSION}-mysql php${PHP_VERSION}-pgsql php${PHP_VERSION}-sqlite php${PHP_VERSION}-curl php${PHP_VERSION}-gd php${PHP_VERSION}-gmp php${PHP_VERSION}-mcrypt php${PHP_VERSION}-memcached php${PHP_VERSION}-imagick php${PHP_VERSION}-intl php${PHP_VERSION}-mbstring php${PHP_VERSION}-xml php-xdebug + sudo apt-get install -qq libapache2-mod-php${PHP_VERSION} php${PHP_VERSION}-zip php${PHP_VERSION}-cli php${PHP_VERSION}-fpm php${PHP_VERSION}-mysql php${PHP_VERSION}-pgsql php${PHP_VERSION}-sqlite php${PHP_VERSION}-curl php${PHP_VERSION}-gd php${PHP_VERSION}-gmp php${PHP_VERSION}-memcached php${PHP_VERSION}-imagick php${PHP_VERSION}-intl php${PHP_VERSION}-mbstring php${PHP_VERSION}-xml php-xdebug # Set PHP FPM to listen on TCP instead of Socket sudo sed -i "s/listen =.*/listen = 127.0.0.1:9000/" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf @@ -48,13 +48,13 @@ else # Set PHP FPM allowed clients IP address sudo sed -i "s/;listen.allowed_clients/listen.allowed_clients/" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf - # Set run-as user for PHP5-FPM processes to user/group "ubuntu" + # Set run-as user for PHP5-FPM processes to user/group "vagrant" # to avoid permission errors from apps writing to files - sudo sed -i "s/user = www-data/user = ubuntu/" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf - sudo sed -i "s/group = www-data/group = ubuntu/" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf + sudo sed -i "s/user = www-data/user = vagrant/" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf + sudo sed -i "s/group = www-data/group = vagrant/" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf - sudo sed -i "s/listen\.owner.*/listen.owner = ubuntu/" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf - sudo sed -i "s/listen\.group.*/listen.group = ubuntu/" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf + sudo sed -i "s/listen\.owner.*/listen.owner = vagrant/" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf + sudo sed -i "s/listen\.group.*/listen.group = vagrant/" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf sudo sed -i "s/listen\.mode.*/listen.mode = 0666/" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf diff --git a/scripts/redis.sh b/scripts/redis.sh index 33e3014c..b9988f17 100644 --- a/scripts/redis.sh +++ b/scripts/redis.sh @@ -25,7 +25,7 @@ if [ ! -z "$1" ]; then # add the config to the redis config includes if ! cat /etc/redis/redis.conf | grep -q "journaling.conf"; then - sudo chown ubuntu:root /etc/redis/redis.conf + sudo chown vagrant:root /etc/redis/redis.conf sudo echo "include /etc/redis/conf.d/journaling.conf" >> /etc/redis/redis.conf sudo chown redis:redis /etc/redis/redis.conf fi diff --git a/scripts/symfony.sh b/scripts/symfony.sh index d9e3aabb..7eacb547 100755 --- a/scripts/symfony.sh +++ b/scripts/symfony.sh @@ -44,7 +44,7 @@ if [ ! -f "$symfony_root_folder/composer.json" ]; then composer create-project --prefer-dist symfony/framework-standard-edition $symfony_root_folder fi else - # Go to ubuntu folder + # Go to Symfony folder cd $symfony_root_folder # Install Symfony @@ -67,7 +67,7 @@ sed -i "s/'127.0.0.1',$/'127.0.0.1', '192.168.22.10',/" $symfony_public_folder/c if [ $NGINX_IS_INSTALLED -eq 0 ]; then # Change default vhost created - sudo sed -i "s@root /ubuntu@root $symfony_public_folder@" /etc/nginx/sites-available/ubuntu + sudo sed -i "s@root /vagrant@root $symfony_public_folder@" /etc/nginx/sites-available/vagrant sudo service nginx reload fi diff --git a/scripts/vim.sh b/scripts/vim.sh index 5c81eca3..daeb8651 100644 --- a/scripts/vim.sh +++ b/scripts/vim.sh @@ -9,16 +9,16 @@ else fi # Create directories needed for some .vimrc settings -mkdir -p /home/ubuntu/.vim/backup -mkdir -p /home/ubuntu/.vim/swap +mkdir -p /home/vagrant/.vim/backup +mkdir -p /home/vagrant/.vim/swap # Install Vundle and set owner of .vim files -git clone https://github.com/VundleVim/Vundle.vim.git /home/ubuntu/.vim/bundle/vundle -sudo chown -R ubuntu:ubuntu /home/ubuntu/.vim +git clone https://github.com/VundleVim/Vundle.vim.git /home/vagrant/.vim/bundle/vundle +sudo chown -R vagrant:vagrant /home/vagrant/.vim # Grab .vimrc and set owner -curl --silent -L $github_url/helpers/vimrc > /home/ubuntu/.vimrc -sudo chown ubuntu:ubuntu /home/ubuntu/.vimrc +curl --silent -L $github_url/helpers/vimrc > /home/vagrant/.vimrc +sudo chown vagrant:vagrant /home/vagrant/.vimrc # Install Vundle Bundles -sudo su - ubuntu -c 'vim +BundleInstall +qall' +sudo su - vagrant -c 'vim +BundleInstall +qall' From 5a78a339b2cae4d119d6256241970db6094c3cc0 Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Sat, 12 Jan 2019 13:59:53 +1300 Subject: [PATCH 31/44] Updated scripts. --- scripts/nodejs.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/nodejs.sh b/scripts/nodejs.sh index 6d5c817e..0dba8d00 100644 --- a/scripts/nodejs.sh +++ b/scripts/nodejs.sh @@ -17,8 +17,9 @@ BASHRC=~/.bashrc if [[ $NODE_IS_INSTALLED -ne 0 ]]; then echo ">>> Installing latest stable Node LTS - 6.X" - - sudo apt-get update + + sudo apt-get -f -y upgrade; + sudo apt-get -f -y dist-upgrade; sudo apt-get -y install python-software-properties # Install NVM From 63af03b921c7d7755046963d2c4b5771bee63ddc Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Mon, 14 Oct 2019 17:52:41 +1300 Subject: [PATCH 32/44] Updating install scripts. --- .gitignore | 1 + Vagrantfile | 29 ++++++++++++++++++----------- code/.gitignore | 34 +++++++++++++++++++++++++++++++--- scripts/android.sh | 2 ++ scripts/ansible.sh | 2 ++ scripts/apache.sh | 1 + scripts/base.sh | 13 ++++++------- scripts/beanstalkd.sh | 2 ++ scripts/couchbase.sh | 6 ++++-- scripts/couchdb.sh | 2 ++ scripts/docker.sh | 2 ++ scripts/elastichq.sh | 2 ++ scripts/elasticsearch.sh | 2 ++ scripts/go.sh | 2 ++ scripts/install_phpmyadmin.sh | 2 ++ scripts/mailcatcher.sh | 4 +++- scripts/mariadb.sh | 2 ++ scripts/memcached.sh | 2 ++ scripts/mssql.sh | 4 +++- scripts/mysql.sh | 2 ++ scripts/neo4j.sh | 2 ++ scripts/nginx.sh | 2 ++ scripts/nodejs.sh | 11 ++++++----- scripts/pgsql.sh | 2 ++ scripts/php.sh | 8 +++++++- scripts/rabbitmq.sh | 8 +++++--- scripts/redis.sh | 2 ++ scripts/rethinkdb.sh | 2 ++ scripts/screen.sh | 2 ++ scripts/sphinxsearch.sh | 2 ++ scripts/sqlite.sh | 2 ++ scripts/supervisord.sh | 2 ++ scripts/vim.sh | 2 ++ scripts/zeromq.sh | 2 ++ 34 files changed, 131 insertions(+), 34 deletions(-) diff --git a/.gitignore b/.gitignore index 24d1edb7..b24485eb 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ notes.md play *.log scripts/projects +code/* # editor backup files *~ diff --git a/Vagrantfile b/Vagrantfile index 7d5a27fb..68fd56f2 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -17,6 +17,7 @@ github_pat = "" # Server Configuration hostname = "vaprobash.localhost" +network_bridge = "Intel(R) Dual Band Wireless-AC 3165" # Set a local private network IP address. # See http://en.wikipedia.org/wiki/Private_network for explanation @@ -28,7 +29,7 @@ server_ip = "192.168.22.10" server_cpus = "4" # Cores server_memory = "4096" # MB server_swap = "8192" # Options: false | int (MB) - Guideline: Between one or two times the server_memory -disk_space = "25GB" +disk_space = "100GB" # UTC for Universal Coordinated Time # EST for Eastern Standard Time @@ -47,7 +48,7 @@ mongo_enable_remote = "false" # remote access enabled when true # Languages and Packages php_timezone = "Pacific/Auckland" # http://php.net/manual/en/timezones.php -php_version = "7.2" # Options: 5.5 | 5.6 | 7.0 | 7.1 +php_version = "7.3" # Options: 5.5 | 5.6 | 7.0 | 7.1 | 7.2 | 7.3 ruby_version = "latest" # Choose what ruby version should be installed (will also be the default version) ruby_gems = [ # List any Ruby Gems that you want to install "sass", @@ -63,11 +64,13 @@ hhvm = "false" # PHP Options composer_packages = [ # List any global Composer packages that you want to install - "phpunit/phpunit:~7.5", - "codeception/codeception:~2.5", - "phpspec/phpspec:~5.1", - "squizlabs/php_codesniffer:^3.4", + "phpunit/phpunit:~8.4", + "codeception/codeception:~3.1", + "phpspec/phpspec:~6.0", + "squizlabs/php_codesniffer:^3.5", "unitgen/unitgen:dev-master", + "phpunit/php-code-coverage:^7.0", + "mihaeu/test-generator:^1.3" ] # Default web server document root @@ -115,8 +118,8 @@ elasticsearch_version = "2.3.1" # 5.0.0-alpha1, 2.3.1, 2.2.2, 2.1.2, 1.7.5 Vagrant.configure("2") do |config| # Set server to Ubuntu 16.04 - config.vm.box = "ubuntu/bionic64" - + config.vm.box = "ubuntu/bionic64" + config.vm.boot_timeout = 600 config.vm.define "Vaprobash" do |vapro| end @@ -134,10 +137,12 @@ Vagrant.configure("2") do |config| # Create a static IP if Vagrant.has_plugin?("vagrant-auto_network") - config.vm.network :private_network, :ip => "0.0.0.0", :auto_network => true + config.vm.network :private_network, :ip => "0.0.0.0", :auto_network => true, bridge: network_bridge else - config.vm.network :private_network, ip: server_ip + config.vm.network :private_network, ip: server_ip, bridge: network_bridge config.vm.network :forwarded_port, guest: 80, host: 8000 + config.vm.network :forwarded_port, guest: 3000, host: 3000 + config.vm.network :forwarded_port, guest: 22, host: 2200, id: 'ssh' end # Enable agent forwarding over SSH connections @@ -166,6 +171,8 @@ Vagrant.configure("2") do |config| # If the clock gets more than 15 minutes out of sync (due to your laptop going # to sleep for instance, then some 3rd party services will reject requests. vb.customize ["guestproperty", "set", :id, "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold", 10000] + + vb.customize ['setextradata', :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate//vagrant", '1'] # Prevent VMs running on Ubuntu to lose internet connection # vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] @@ -318,7 +325,7 @@ Vagrant.configure("2") do |config| config.vm.provision "shell", path: "./scripts/memcached.sh" # Provision Redis (without journaling and persistence) - config.vm.provision "shell", path: "#{github_url}/scripts/redis.sh" + config.vm.provision "shell", path: "./scripts/redis.sh" # Provision Redis (with journaling and persistence) # config.vm.provision "shell", path: "./scripts/redis.sh", args: "persistent" diff --git a/code/.gitignore b/code/.gitignore index e7a210ec..4f085348 100644 --- a/code/.gitignore +++ b/code/.gitignore @@ -1,3 +1,31 @@ -* -*/ -!.gitignore \ No newline at end of file +vendor/ +node_modules/ +storage/* + +# Laravel 4 specific +bootstrap/compiled.php +app/storage/ + +# Laravel 5 & Lumen specific +bootstrap/cache/ +.env.*.php +.env.php +.env + +# Rocketeer PHP task runner and deployment package. https://github.com/rocketeers/rocketeer +.rocketeer/ + +_ide_helper.php +.phpstorm.meta.php +_ide_helper_models.php +/.idea + +# PHP CS Fixer +.php_cs.cache + +# Keep views from Laravel packages. +!/resources/views/vendor/ + +npm-debug.log +.yarnclean +*.log diff --git a/scripts/android.sh b/scripts/android.sh index 6c8d07a1..beb27d09 100644 --- a/scripts/android.sh +++ b/scripts/android.sh @@ -34,3 +34,5 @@ expect { sudo /home/ubuntu/android-sdk-linux/platform-tools/adb kill-server sudo /home/ubuntu/android-sdk-linux/platform-tools/adb start-server sudo /home/ubuntu/android-sdk-linux/platform-tools/adb devices + +sudo apt -f -y autoremove --purge \ No newline at end of file diff --git a/scripts/ansible.sh b/scripts/ansible.sh index e25996f2..97c7255c 100644 --- a/scripts/ansible.sh +++ b/scripts/ansible.sh @@ -11,3 +11,5 @@ sudo apt-get update # Intall ansible sudo apt-get install -y ansible + +sudo apt -f -y autoremove --purge \ No newline at end of file diff --git a/scripts/apache.sh b/scripts/apache.sh index b147d890..daeb1503 100644 --- a/scripts/apache.sh +++ b/scripts/apache.sh @@ -82,3 +82,4 @@ fi sudo a2enmod php${PHP_INSTALLED_VERSION} sudo a2enmod headers sudo service apache2 restart +sudo apt -f -y autoremove --purge diff --git a/scripts/base.sh b/scripts/base.sh index f5ea1c6b..4fb72577 100644 --- a/scripts/base.sh +++ b/scripts/base.sh @@ -12,15 +12,14 @@ sudo update-locale LANG=en_NZ.UTF-8 LC_CTYPE=en_NZ.UTF-8 echo ">>> Installing Base Packages" -if [[ -z $1 ]]; then - github_url="https://raw.githubusercontent.com/rattfieldnz/Vaprobash/master" -else - github_url="$1" -fi - # Install base packages # -qq implies -y --force-yes -sudo apt-get install -qq vim build-essential python-software-properties git zip unzip tcl curl git-core ack-grep software-properties-common cachefilesd virtualbox-guest-dkms openssl pkg-config libssl-dev libsslcommon2-dev +sudo apt-get install -qq vim build-essential python-software-properties git zip unzip tcl curl git-core ack-grep software-properties-common cachefilesd virtualbox-guest-dkms openssl pkg-config libssl-dev libsslcommon2-dev libpng-dev libjpeg-dev libwebp-dev imagemagick libmagickcore-dev libmagickwand-dev resolvconf network-manager + +sudo echo "nameserver 192.168.1.100 1.1.1.1" > /etc/resolvconf/resolv.conf.d/base +sudo service resolvconf restart +sudo service networkd-dispatcher restart +sudo service network-manager restart echo ">>> Installing *.xip.io self-signed SSL" diff --git a/scripts/beanstalkd.sh b/scripts/beanstalkd.sh index 99ab98ad..9c1f643b 100644 --- a/scripts/beanstalkd.sh +++ b/scripts/beanstalkd.sh @@ -11,3 +11,5 @@ sudo sed -i "s/#START=yes/START=yes/" /etc/default/beanstalkd # Start Beanstalkd sudo service beanstalkd start + +sudo apt -f -y autoremove --purge \ No newline at end of file diff --git a/scripts/couchbase.sh b/scripts/couchbase.sh index 4fac9b3e..5bc13cde 100644 --- a/scripts/couchbase.sh +++ b/scripts/couchbase.sh @@ -4,7 +4,7 @@ echo ">>> Installing Couchbase Server" # Set some variables COUCHBASE_EDITION=community -COUCHBASE_VERSION=5.0 # Check https://www.couchbase.com/downloads for latest version +COUCHBASE_VERSION=6.0.3 # Check https://www.couchbase.com/downloads for latest version COUCHBASE_ARCH=x86_64 @@ -28,7 +28,7 @@ if [ ${PHP_IS_INSTALLED} -eq 0 ]; then fi if [ ${PHPDEV_IS_INSTALLED} -eq 1 ]; then - sudo apt-get -qq install php7.1-dev + sudo apt-get -qq install php-dev fi sudo wget --quiet -O/etc/apt/sources.list.d/couchbase.list http://packages.couchbase.com/ubuntu/couchbase-ubuntu1204.list @@ -46,3 +46,5 @@ EOF sudo php7.1enmod couchbase sudo service php7.1-fpm restart fi + +sudo apt -f -y autoremove --purge diff --git a/scripts/couchdb.sh b/scripts/couchdb.sh index 53dcbd2f..50483ab8 100755 --- a/scripts/couchdb.sh +++ b/scripts/couchdb.sh @@ -8,3 +8,5 @@ sudo apt-get install -qq couchdb # Make Futon Available sudo sed -i 's/;bind_address = 127.0.0.1/bind_address = 0.0.0.0/' /etc/couchdb/local.ini + +sudo apt -f -y autoremove --purge diff --git a/scripts/docker.sh b/scripts/docker.sh index 2a51764b..0d9aa208 100644 --- a/scripts/docker.sh +++ b/scripts/docker.sh @@ -22,3 +22,5 @@ if [ ! -z "$1" ]; then fi # permissions fi # arg check + +sudo apt -f -y autoremove --purge \ No newline at end of file diff --git a/scripts/elastichq.sh b/scripts/elastichq.sh index 94f89c38..4229bccc 100644 --- a/scripts/elastichq.sh +++ b/scripts/elastichq.sh @@ -67,3 +67,5 @@ EOF # Reload Nginx to load in configuration sudo service nginx reload fi + +sudo apt -f -y autoremove --purge \ No newline at end of file diff --git a/scripts/elasticsearch.sh b/scripts/elasticsearch.sh index faf98e76..67ffff60 100644 --- a/scripts/elasticsearch.sh +++ b/scripts/elasticsearch.sh @@ -22,3 +22,5 @@ sudo service elasticsearch restart # Configure to start up Elasticsearch automatically sudo update-rc.d elasticsearch defaults 95 10 + +sudo apt -f -y autoremove --purge \ No newline at end of file diff --git a/scripts/go.sh b/scripts/go.sh index dadc1d7c..9825d955 100755 --- a/scripts/go.sh +++ b/scripts/go.sh @@ -29,3 +29,5 @@ else gvm install $GO_VERSION --prefer-binary gvm use $GO_VERSION --default fi + +sudo apt -f -y autoremove --purge \ No newline at end of file diff --git a/scripts/install_phpmyadmin.sh b/scripts/install_phpmyadmin.sh index 19920251..30726d89 100644 --- a/scripts/install_phpmyadmin.sh +++ b/scripts/install_phpmyadmin.sh @@ -67,3 +67,5 @@ sudo echo " sudo a2ensite phpmyadmin.localhost.conf sudo service apache2 reload fi + +sudo apt -f -y autoremove --purge \ No newline at end of file diff --git a/scripts/mailcatcher.sh b/scripts/mailcatcher.sh index 9352bd75..73e92e2e 100644 --- a/scripts/mailcatcher.sh +++ b/scripts/mailcatcher.sh @@ -14,7 +14,7 @@ APACHE_IS_INSTALLED=$? # Installing dependency # -qq implies -y --force-yes -sudo apt-get install -qq libsqlite3-dev ruby1.9.1-dev +sudo apt-get install -qq libsqlite3-dev ruby-dev if $(which rvm) -v > /dev/null 2>&1; then echo ">>>>Installing with RVM" @@ -53,3 +53,5 @@ fi if [[ $APACHE_IS_INSTALLED -eq 0 ]]; then sudo service apache2 restart fi + +sudo apt -f -y autoremove --purge \ No newline at end of file diff --git a/scripts/mariadb.sh b/scripts/mariadb.sh index c54002a2..05bd0beb 100644 --- a/scripts/mariadb.sh +++ b/scripts/mariadb.sh @@ -43,3 +43,5 @@ if [ $2 == "true" ]; then service mysql restart fi + +sudo apt -f -y autoremove --purge \ No newline at end of file diff --git a/scripts/memcached.sh b/scripts/memcached.sh index 07f2cacc..a269fe9c 100644 --- a/scripts/memcached.sh +++ b/scripts/memcached.sh @@ -3,3 +3,5 @@ # Install Memcached # -qq implies -y --force-yes sudo apt-get install -qq memcached + +sudo apt -f -y autoremove --purge \ No newline at end of file diff --git a/scripts/mssql.sh b/scripts/mssql.sh index b74950a3..4d5f61ff 100644 --- a/scripts/mssql.sh +++ b/scripts/mssql.sh @@ -22,4 +22,6 @@ echo ">>> Installing UnixODBC for MSSQL" sudo apt-get install -qq unixodbc unixodbc-dev # Restart php7.1-fpm -sudo service php7.1-fpm restart +sudo service php-fpm restart + +sudo apt -f -y autoremove --purge \ No newline at end of file diff --git a/scripts/mysql.sh b/scripts/mysql.sh index a4863093..a4106e50 100644 --- a/scripts/mysql.sh +++ b/scripts/mysql.sh @@ -49,3 +49,5 @@ if [ $3 == "true" ]; then service mysql restart fi + +sudo apt -f -y autoremove --purge \ No newline at end of file diff --git a/scripts/neo4j.sh b/scripts/neo4j.sh index 51554b67..e2cf3d52 100644 --- a/scripts/neo4j.sh +++ b/scripts/neo4j.sh @@ -21,3 +21,5 @@ apt-get install -qq neo4j # Start the server service neo4j-service restart + +sudo apt -f -y autoremove --purge \ No newline at end of file diff --git a/scripts/nginx.sh b/scripts/nginx.sh index 2078a433..7ce731de 100644 --- a/scripts/nginx.sh +++ b/scripts/nginx.sh @@ -78,3 +78,5 @@ if [[ $HHVM_IS_INSTALLED -ne 0 && $PHP_IS_INSTALLED -eq 0 ]]; then fi sudo service nginx restart + +sudo apt -f -y autoremove --purge diff --git a/scripts/nodejs.sh b/scripts/nodejs.sh index 0dba8d00..e70812f6 100644 --- a/scripts/nodejs.sh +++ b/scripts/nodejs.sh @@ -25,7 +25,7 @@ if [[ $NODE_IS_INSTALLED -ne 0 ]]; then # Install NVM curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - sudo apt-get update - sudo apt-get -y install nodejs npm + sudo apt-get -y install nodejs npm node-gyp # Re-source user profiles # if they exist @@ -37,8 +37,9 @@ if [[ $NODE_IS_INSTALLED -ne 0 ]]; then fi # Install (optional) Global Node Packages -if [[ ! -z $NODE_PACKAGES ]]; then - echo ">>> Start installing Global Node Packages" - npm install -g ${NODE_PACKAGES[@]} -fi +echo ">>> Start installing Global Node Packages" + +sudo npm install -g npm grunt-cli gulp bower yarn yo gulp-concat-css gulp-minify-css gulp-rename gulp-ruby-sass gulp-sourcemaps gulp-uglify notify-send sw-precache-webpack-plugin cross-env laravel-mix laravel-elixir --force -qq + +sudo apt -f -y autoremove --purge \ No newline at end of file diff --git a/scripts/pgsql.sh b/scripts/pgsql.sh index 6f45d3c3..9958884b 100644 --- a/scripts/pgsql.sh +++ b/scripts/pgsql.sh @@ -44,3 +44,5 @@ sudo -u postgres psql -c "CREATE ROLE root LOGIN PASSWORD '$1' NOSUPERUSER INHER # Make sure changes are reflected by restarting sudo service postgresql restart + +sudo apt -f -y autoremove --purge \ No newline at end of file diff --git a/scripts/php.sh b/scripts/php.sh index 01f9bb47..4fdcb8b1 100644 --- a/scripts/php.sh +++ b/scripts/php.sh @@ -40,8 +40,12 @@ else # -qq implies -y --force-yes # Install PHP module for Apache - sudo apt-get install -qq libapache2-mod-php${PHP_VERSION} php${PHP_VERSION}-zip php${PHP_VERSION}-cli php${PHP_VERSION}-fpm php${PHP_VERSION}-mysql php${PHP_VERSION}-pgsql php${PHP_VERSION}-sqlite php${PHP_VERSION}-curl php${PHP_VERSION}-gd php${PHP_VERSION}-gmp php${PHP_VERSION}-memcached php${PHP_VERSION}-imagick php${PHP_VERSION}-intl php${PHP_VERSION}-mbstring php${PHP_VERSION}-xml php-xdebug + sudo apt-get install -qq libapache2-mod-php${PHP_VERSION} php${PHP_VERSION}-zip php${PHP_VERSION}-cli php${PHP_VERSION}-fpm php${PHP_VERSION}-mysql php${PHP_VERSION}-pgsql php${PHP_VERSION}-sqlite php${PHP_VERSION}-curl php${PHP_VERSION}-gd php${PHP_VERSION}-gmp php${PHP_VERSION}-memcached php${PHP_VERSION}-imagick php${PHP_VERSION}-intl php${PHP_VERSION}-mbstring php${PHP_VERSION}-bcmath php${PHP_VERSION}-xml php${PHP_VERSION}-redis php${PHP_VERSION}-xdebug php${PHP_VERSION}-dom + sudo phpenmod zip cli fpm mysql pgsql sqlite curl gd gmp memcached imagick intl mbstring bcmath xml redis xdebug dom + + sudo a2enmod proxy_fcgi setenvif && a2enconf php7.3-fpm + # Set PHP FPM to listen on TCP instead of Socket sudo sed -i "s/listen =.*/listen = 127.0.0.1:9000/" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf @@ -84,3 +88,5 @@ EOF sudo service php${PHP_VERSION}-fpm restart fi + +sudo apt -f -y autoremove --purge \ No newline at end of file diff --git a/scripts/rabbitmq.sh b/scripts/rabbitmq.sh index e6840f57..11145ad5 100644 --- a/scripts/rabbitmq.sh +++ b/scripts/rabbitmq.sh @@ -2,12 +2,14 @@ echo ">>> Installing RabbitMQ" -apt-get -y install erlang-nox +sudo apt-get -y install erlang-nox wget http://www.rabbitmq.com/rabbitmq-signing-key-public.asc apt-key add rabbitmq-signing-key-public.asc echo "deb http://www.rabbitmq.com/debian/ testing main" > /etc/apt/sources.list.d/rabbitmq.list -apt-get update -apt-get install -y rabbitmq-server +sudo apt-get update +sudo apt-get install -y rabbitmq-server rabbitmqctl add_user $1 $2 rabbitmqctl set_permissions -p / $1 ".*" ".*" ".*" + +sudo apt -f -y autoremove --purge \ No newline at end of file diff --git a/scripts/redis.sh b/scripts/redis.sh index b9988f17..6779b523 100644 --- a/scripts/redis.sh +++ b/scripts/redis.sh @@ -39,3 +39,5 @@ if [ ! -z "$1" ]; then fi # arg check sudo service redis-server start + +sudo apt -f -y autoremove --purge \ No newline at end of file diff --git a/scripts/rethinkdb.sh b/scripts/rethinkdb.sh index 23c8311e..b2616d23 100644 --- a/scripts/rethinkdb.sh +++ b/scripts/rethinkdb.sh @@ -11,3 +11,5 @@ sudo apt-get update # Install # -qq implies -y --force-yes sudo apt-get install -qq rethinkdb + +sudo apt -f -y autoremove --purge diff --git a/scripts/screen.sh b/scripts/screen.sh index fc4e3d87..63d71709 100644 --- a/scripts/screen.sh +++ b/scripts/screen.sh @@ -10,3 +10,5 @@ touch ~/.screenrc SCREENINFO="startup_message off\ncaption always '%{= dg} %H %{G}%=%?%{d}%-w%?%{r}(%{d}%n %t%? {%u} %?%{r})%{d}%?%+w%?%=%{G} %{B}%M %d %c:%s '" echo -e $SCREENINFO >> ~/.screenrc + +sudo apt -f -y autoremove --purge \ No newline at end of file diff --git a/scripts/sphinxsearch.sh b/scripts/sphinxsearch.sh index 62df3d3d..bedc6bcc 100644 --- a/scripts/sphinxsearch.sh +++ b/scripts/sphinxsearch.sh @@ -27,3 +27,5 @@ sudo sed -i 's/sphinxsearch\/searchd.pid/searchd.pid/' /etc/sphinxsearch/sphinx. # Start searchd searchd + +sudo apt -f -y autoremove --purge \ No newline at end of file diff --git a/scripts/sqlite.sh b/scripts/sqlite.sh index 28212942..f799be03 100644 --- a/scripts/sqlite.sh +++ b/scripts/sqlite.sh @@ -5,3 +5,5 @@ echo ">>> Installing SQLite Server" # Install SQLite Server # -qq implies -y --force-yes sudo apt-get install -qq sqlite + +sudo apt -f -y autoremove --purge diff --git a/scripts/supervisord.sh b/scripts/supervisord.sh index 3e3b7c94..3e12f4ed 100644 --- a/scripts/supervisord.sh +++ b/scripts/supervisord.sh @@ -5,3 +5,5 @@ echo ">>> Installing Supervisord" # Supervisord # -qq implies -y --force-yes sudo apt-get install -qq supervisor + +sudo apt -f -y autoremove --purge diff --git a/scripts/vim.sh b/scripts/vim.sh index daeb8651..cab5ae42 100644 --- a/scripts/vim.sh +++ b/scripts/vim.sh @@ -22,3 +22,5 @@ sudo chown vagrant:vagrant /home/vagrant/.vimrc # Install Vundle Bundles sudo su - vagrant -c 'vim +BundleInstall +qall' + +sudo apt -f -y autoremove --purge \ No newline at end of file diff --git a/scripts/zeromq.sh b/scripts/zeromq.sh index 49810127..695dd3ea 100644 --- a/scripts/zeromq.sh +++ b/scripts/zeromq.sh @@ -19,3 +19,5 @@ echo "" | sudo pecl install zmq-beta > /dev/null sudo echo "extension=zmq.so" >> /etc/php/${PHP_VERSION}/mods-available/zmq.ini sudo phpenmod zmq > /dev/null sudo service php${PHP_VERSION}-fpm restart > /dev/null + +sudo apt -f -y autoremove --purge \ No newline at end of file From 778fbafd369cad84e65e7f1b5115967d53fb8bc5 Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Tue, 26 Jan 2021 15:58:44 +1300 Subject: [PATCH 33/44] Minor improvements. --- Vagrantfile | 4 +- helpers/vhost.sh | 10 ++-- scripts/base.sh | 6 +++ scripts/install_phpmyadmin.sh | 97 ++++++++++++++++++----------------- scripts/nodejs.sh | 23 +++++++-- scripts/php.sh | 3 +- start_vagrant | 1 + 7 files changed, 86 insertions(+), 58 deletions(-) create mode 100644 start_vagrant diff --git a/Vagrantfile b/Vagrantfile index 68fd56f2..ece5a466 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -48,7 +48,7 @@ mongo_enable_remote = "false" # remote access enabled when true # Languages and Packages php_timezone = "Pacific/Auckland" # http://php.net/manual/en/timezones.php -php_version = "7.3" # Options: 5.5 | 5.6 | 7.0 | 7.1 | 7.2 | 7.3 +php_version = "7.4" # Options: 5.5 | 5.6 | 7.0 | 7.1 | 7.2 | 7.3 | 7.4 ruby_version = "latest" # Choose what ruby version should be installed (will also be the default version) ruby_gems = [ # List any Ruby Gems that you want to install "sass", @@ -410,4 +410,4 @@ Vagrant.configure("2") do |config| # config.vm.provision "shell", path: "./your_script_name.sh" config.vm.provision "shell", path: "./scripts/install_phpmyadmin.sh" -end +end \ No newline at end of file diff --git a/helpers/vhost.sh b/helpers/vhost.sh index 6110d149..105223ab 100644 --- a/helpers/vhost.sh +++ b/helpers/vhost.sh @@ -42,7 +42,7 @@ cat <<- _EOF_ ServerAdmin webmaster@localhost ServerName $ServerName - $ServerAlias + ServerAlias $ServerAlias DocumentRoot $DocumentRoot @@ -174,14 +174,14 @@ if [ -f "$DocumentRoot/$ServerName.conf" ]; then echo 'vHost already exists. Aborting' show_usage else - create_vhost > /etc/apache2/sites-available/${ServerName}.conf + sudo create_vhost > /etc/apache2/sites-available/${ServerName}.conf # Add :443 handling if [ "$CertPath" != "" ]; then - create_ssl_vhost >> /etc/apache2/sites-available/${ServerName}.conf + sudo create_ssl_vhost >> /etc/apache2/sites-available/${ServerName}.conf fi # Enable Site - a2ensite ${ServerName}.conf - service apache2 reload + sudo a2ensite ${ServerName}.conf + sudo service apache2 reload fi diff --git a/scripts/base.sh b/scripts/base.sh index 4fb72577..695c435d 100644 --- a/scripts/base.sh +++ b/scripts/base.sh @@ -16,6 +16,12 @@ echo ">>> Installing Base Packages" # -qq implies -y --force-yes sudo apt-get install -qq vim build-essential python-software-properties git zip unzip tcl curl git-core ack-grep software-properties-common cachefilesd virtualbox-guest-dkms openssl pkg-config libssl-dev libsslcommon2-dev libpng-dev libjpeg-dev libwebp-dev imagemagick libmagickcore-dev libmagickwand-dev resolvconf network-manager +echo ">>> Installing Git Secrets" +git clone https://github.com/awslabs/git-secrets.git +cd git-secrets +make test && sudo make install + +echo ">>> Configure networking and nameserver properties" sudo echo "nameserver 192.168.1.100 1.1.1.1" > /etc/resolvconf/resolv.conf.d/base sudo service resolvconf restart sudo service networkd-dispatcher restart diff --git a/scripts/install_phpmyadmin.sh b/scripts/install_phpmyadmin.sh index 30726d89..8685f1e6 100644 --- a/scripts/install_phpmyadmin.sh +++ b/scripts/install_phpmyadmin.sh @@ -9,60 +9,63 @@ echo "Set-up MySQL and phpMyAdmin (for development purposes ONLY).\n" DBHOST=localhost DBUSER=root DBPASSWD=root -echo 'mysql-server mysql-server/root_password password $DBPASSWD' | debconf-set-selections; -echo 'mysql-server mysql-server/root_password_again password $DBPASSWD' | debconf-set-selections; -echo 'phpmyadmin phpmyadmin/dbconfig-install boolean true' | debconf-set-selections; -echo 'phpmyadmin phpmyadmin/app-password-confirm password $DBPASSWD' | debconf-set-selections; -echo 'phpmyadmin phpmyadmin/mysql/admin-pass password $DBPASSWD' | debconf-set-selections; -echo 'phpmyadmin phpmyadmin/mysql/app-pass password $DBPASSWD' | debconf-set-selections; -echo 'phpmyadmin phpmyadmin/reconfigure-webserver multiselect none' | debconf-set-selections; + +export DEBIAN_FRONTEND="noninteractive" + +sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password $DBPASSWD'; +sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password $DBPASSWD' +sudo debconf-set-selections <<< 'phpmyadmin phpmyadmin/dbconfig-install boolean true'; +sudo debconf-set-selections <<< 'phpmyadmin phpmyadmin/app-password-confirm password $DBPASSWD'; +sudo debconf-set-selections <<< 'phpmyadmin phpmyadmin/mysql/admin-pass password $DBPASSWD'; +sudo debconf-set-selections <<< 'phpmyadmin phpmyadmin/mysql/app-pass password $DBPASSWD'; +sudo debconf-set-selections <<< 'phpmyadmin phpmyadmin/reconfigure-webserver multiselect none'; sudo apt-get -f -y install phpmyadmin; echo "Set-up Apache Vhost file (assuming phpMyAdmin has been installed to /usr/share/phpmyadmin.\n" if [ -d "/usr/share/phpmyadmin" ]; then sudo echo " - ServerName phpmyadmin.localhost - ServerAlias phpmyadmin.localhost - DocumentRoot /usr/share/phpmyadmin - - Options FollowSymLinks - DirectoryIndex index.php - - - AddType application/x-httpd-php .php - - - SetHandler application/x-httpd-php - - php_flag magic_quotes_gpc Off - php_flag track_vars On - php_flag register_globals Off - php_admin_flag allow_url_fopen On - php_value include_path . - php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp - php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/php-gettext/:/usr/share/javascript/:/usr/share/php/tcpdf/:/usr/share/doc/phpmyadmin/:/usr/share/php/phpseclib/ - - + ServerName phpmyadmin.localhost + ServerAlias phpmyadmin.localhost + DocumentRoot /usr/share/phpmyadmin + + Options FollowSymLinks + DirectoryIndex index.php + + + AddType application/x-httpd-php .php + + + SetHandler application/x-httpd-php + + php_flag magic_quotes_gpc Off + php_flag track_vars On + php_flag register_globals Off + php_admin_flag allow_url_fopen On + php_value include_path . + php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp + php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/php-gettext/:/usr/share/javascript/:/usr/share/php/tcpdf/:/usr/share/doc/phpmyadmin/:/usr/share/php/phpseclib/ + + - # Authorize for setup - - - - AuthType Basic - AuthName \"phpMyAdmin Setup\" - AuthUserFile /etc/phpmyadmin/htpasswd.setup - - Require valid-user - - + # Authorize for setup + + + + AuthType Basic + AuthName \"phpMyAdmin Setup\" + AuthUserFile /etc/phpmyadmin/htpasswd.setup + + Require valid-user + + - # Disallow web access to directories that don't need it - - Require all denied - - - Require all denied - + # Disallow web access to directories that don't need it + + Require all denied + + + Require all denied + " > /etc/apache2/sites-available/phpmyadmin.localhost.conf sudo a2ensite phpmyadmin.localhost.conf sudo service apache2 reload diff --git a/scripts/nodejs.sh b/scripts/nodejs.sh index e70812f6..5a8f8e0b 100644 --- a/scripts/nodejs.sh +++ b/scripts/nodejs.sh @@ -16,16 +16,18 @@ BASHRC=~/.bashrc # True, if Node is not installed if [[ $NODE_IS_INSTALLED -ne 0 ]]; then - echo ">>> Installing latest stable Node LTS - 6.X" + echo ">>> Installing latest stable Node LTS - 10.X" sudo apt-get -f -y upgrade; sudo apt-get -f -y dist-upgrade; sudo apt-get -y install python-software-properties # Install NVM - curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - + curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - sudo apt-get update sudo apt-get -y install nodejs npm node-gyp + + curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash # Re-source user profiles # if they exist @@ -40,6 +42,21 @@ fi echo ">>> Start installing Global Node Packages" -sudo npm install -g npm grunt-cli gulp bower yarn yo gulp-concat-css gulp-minify-css gulp-rename gulp-ruby-sass gulp-sourcemaps gulp-uglify notify-send sw-precache-webpack-plugin cross-env laravel-mix laravel-elixir --force -qq +sudo npm install -g grunt-cli --force; +sudo npm install -g gulp --force; +sudo npm install -g bower --force; +sudo npm install -g yarn --force; +sudo npm install -g gulp-concat-css --force; +sudo npm install -g gulp-minify-css --force; +sudo npm install -g gulp-clean-css --force; +sudo npm install -g gulp-rename --force; +sudo npm install -g gulp-ruby-sass --force; +sudo npm install -g gulp-sourcemaps --force; +sudo npm install -g gulp-uglify --force; +sudo npm install -g notify-send --force; +sudo npm install -g sw-precache-webpack-plugin --force; +sudo npm install -g cross-env --force; +sudo npm install -g laravel-mix --force; +sudo npm install -g laravel-elixir --force; sudo apt -f -y autoremove --purge \ No newline at end of file diff --git a/scripts/php.sh b/scripts/php.sh index 4fdcb8b1..c7abd770 100644 --- a/scripts/php.sh +++ b/scripts/php.sh @@ -40,7 +40,8 @@ else # -qq implies -y --force-yes # Install PHP module for Apache - sudo apt-get install -qq libapache2-mod-php${PHP_VERSION} php${PHP_VERSION}-zip php${PHP_VERSION}-cli php${PHP_VERSION}-fpm php${PHP_VERSION}-mysql php${PHP_VERSION}-pgsql php${PHP_VERSION}-sqlite php${PHP_VERSION}-curl php${PHP_VERSION}-gd php${PHP_VERSION}-gmp php${PHP_VERSION}-memcached php${PHP_VERSION}-imagick php${PHP_VERSION}-intl php${PHP_VERSION}-mbstring php${PHP_VERSION}-bcmath php${PHP_VERSION}-xml php${PHP_VERSION}-redis php${PHP_VERSION}-xdebug php${PHP_VERSION}-dom + + sudo apt-get install -y libapache2-mod-php${PHP_VERSION} php${PHP_VERSION}-{cli,bcmath,bz2,intl,gd,mbstring,mysql,zip,redis,gd,fpm,curl,gmp,memcached,imagick,xml,dom,xdebug,common} sudo phpenmod zip cli fpm mysql pgsql sqlite curl gd gmp memcached imagick intl mbstring bcmath xml redis xdebug dom diff --git a/start_vagrant b/start_vagrant new file mode 100644 index 00000000..45c1e86d --- /dev/null +++ b/start_vagrant @@ -0,0 +1 @@ +vagrant halt && vagrant box update && vagrant box prune && vagrant plugin update && vagrant up && vagrant ssh From f60aa70fb055c42a16d63a9f4c6f521a14a172e1 Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Tue, 26 Jan 2021 16:02:15 +1300 Subject: [PATCH 34/44] Minor improvements. --- Vagrantfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index ece5a466..cfe27cd7 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -4,7 +4,7 @@ # Config Github Settings github_username = "rattfieldnz" github_repo = "Vaprobash" -github_branch = "1.4.3" +github_branch = "1.4.4" github_url = "https://raw.githubusercontent.com/#{github_username}/#{github_repo}/#{github_branch}" vm_synced_folder_host = "code" @@ -97,6 +97,7 @@ nodejs_packages = [ # List any global NodeJS packages that you wa "yo", "gulp-concat-css", "gulp-minify-css", + "gulp-clean-css", "gulp-rename", "gulp-ruby-sass", "gulp-sourcemaps", From 853f9b4ef595da1270e79cc5e7a1f846df1996c1 Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Tue, 26 Jan 2021 16:06:35 +1300 Subject: [PATCH 35/44] Minor improvements. --- Vagrantfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index cfe27cd7..579dd404 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -4,7 +4,7 @@ # Config Github Settings github_username = "rattfieldnz" github_repo = "Vaprobash" -github_branch = "1.4.4" +github_branch = "1.4.5" github_url = "https://raw.githubusercontent.com/#{github_username}/#{github_repo}/#{github_branch}" vm_synced_folder_host = "code" From b28a36d99afc631b9ee7b85c22a00c478c96d5b1 Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Tue, 26 Jan 2021 16:11:30 +1300 Subject: [PATCH 36/44] Minor improvements. --- Vagrantfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index 579dd404..8024c1ee 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -4,7 +4,7 @@ # Config Github Settings github_username = "rattfieldnz" github_repo = "Vaprobash" -github_branch = "1.4.5" +github_branch = "master" github_url = "https://raw.githubusercontent.com/#{github_username}/#{github_repo}/#{github_branch}" vm_synced_folder_host = "code" From 2dfad71a78e698516480d1f529f366769c1aa647 Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Tue, 26 Jan 2021 16:19:17 +1300 Subject: [PATCH 37/44] Minor improvements. --- Vagrantfile | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 8024c1ee..a5d3806b 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -2,10 +2,7 @@ # vi: set ft=ruby : # Config Github Settings -github_username = "rattfieldnz" -github_repo = "Vaprobash" -github_branch = "master" -github_url = "https://raw.githubusercontent.com/#{github_username}/#{github_repo}/#{github_branch}" +github_url = "https://raw.githubusercontent.com/rattfieldnz/Vaprobash/master" vm_synced_folder_host = "code" vm_synced_folder_guest = "/var/www" From c0ac97e4e896e15cf2ce9785b45e9916608b1d47 Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Tue, 26 Jan 2021 16:57:29 +1300 Subject: [PATCH 38/44] Minor improvements. --- scripts/nodejs.sh | 62 +++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/scripts/nodejs.sh b/scripts/nodejs.sh index 5a8f8e0b..2febdf75 100644 --- a/scripts/nodejs.sh +++ b/scripts/nodejs.sh @@ -17,46 +17,46 @@ BASHRC=~/.bashrc if [[ $NODE_IS_INSTALLED -ne 0 ]]; then echo ">>> Installing latest stable Node LTS - 10.X" - + sudo apt-get -f -y upgrade; sudo apt-get -f -y dist-upgrade; - sudo apt-get -y install python-software-properties - + sudo apt-get -y install python-software-properties + # Install NVM - curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - - sudo apt-get update - sudo apt-get -y install nodejs npm node-gyp - - curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash + curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - + sudo apt-get update + sudo apt-get -y install nodejs npm node-gyp + + curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash + + # Install (optional) Global Node Packages + + echo ">>> Start installing Global Node Packages" + + sudo npm install -g grunt-cli --force; + sudo npm install -g gulp --force; + sudo npm install -g bower --force; + sudo npm install -g yarn --force; + sudo npm install -g gulp-concat-css --force; + sudo npm install -g gulp-minify-css --force; + sudo npm install -g gulp-clean-css --force; + sudo npm install -g gulp-rename --force; + sudo npm install -g gulp-ruby-sass --force; + sudo npm install -g gulp-sourcemaps --force; + sudo npm install -g gulp-uglify --force; + sudo npm install -g notify-send --force; + sudo npm install -g sw-precache-webpack-plugin --force; + sudo npm install -g cross-env --force; + sudo npm install -g laravel-mix --force; + sudo npm install -g laravel-elixir --force; # Re-source user profiles # if they exist source $PROFILE - - # Re-source .bashrc if exists + + # Re-source .bashrc if exists source $BASHRC fi -# Install (optional) Global Node Packages - -echo ">>> Start installing Global Node Packages" - -sudo npm install -g grunt-cli --force; -sudo npm install -g gulp --force; -sudo npm install -g bower --force; -sudo npm install -g yarn --force; -sudo npm install -g gulp-concat-css --force; -sudo npm install -g gulp-minify-css --force; -sudo npm install -g gulp-clean-css --force; -sudo npm install -g gulp-rename --force; -sudo npm install -g gulp-ruby-sass --force; -sudo npm install -g gulp-sourcemaps --force; -sudo npm install -g gulp-uglify --force; -sudo npm install -g notify-send --force; -sudo npm install -g sw-precache-webpack-plugin --force; -sudo npm install -g cross-env --force; -sudo npm install -g laravel-mix --force; -sudo npm install -g laravel-elixir --force; - sudo apt -f -y autoremove --purge \ No newline at end of file From a24919d3a7cd34ece1b6570c5c1fb91dfbf735ba Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Tue, 26 Jan 2021 17:11:34 +1300 Subject: [PATCH 39/44] Minor improvements. --- scripts/nodejs.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/nodejs.sh b/scripts/nodejs.sh index 2febdf75..5b8f6770 100644 --- a/scripts/nodejs.sh +++ b/scripts/nodejs.sh @@ -25,14 +25,14 @@ if [[ $NODE_IS_INSTALLED -ne 0 ]]; then # Install NVM curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - sudo apt-get update - sudo apt-get -y install nodejs npm node-gyp + sudo apt-get -y install nodejs node-gyp curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash # Install (optional) Global Node Packages echo ">>> Start installing Global Node Packages" - + sudo npm install -g npm --force; sudo npm install -g grunt-cli --force; sudo npm install -g gulp --force; sudo npm install -g bower --force; From a96696d481878b87b32bad2c91c779b05114f511 Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Tue, 26 Jan 2021 18:13:43 +1300 Subject: [PATCH 40/44] Minor improvements. --- scripts/php.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/php.sh b/scripts/php.sh index c7abd770..02154c49 100644 --- a/scripts/php.sh +++ b/scripts/php.sh @@ -35,6 +35,10 @@ else sudo apt-key update sudo apt-get update + + git clone https://github.com/rapidwebltd/php-switch-scripts.git + cd php-switch-scripts/ + ./setup.sh && ./switch-to-php-${PHP_VERSION}.sh # Install PHP # -qq implies -y --force-yes @@ -45,7 +49,7 @@ else sudo phpenmod zip cli fpm mysql pgsql sqlite curl gd gmp memcached imagick intl mbstring bcmath xml redis xdebug dom - sudo a2enmod proxy_fcgi setenvif && a2enconf php7.3-fpm + sudo a2enmod proxy_fcgi setenvif && a2enconf php${PHP_VERSION}-fpm # Set PHP FPM to listen on TCP instead of Socket sudo sed -i "s/listen =.*/listen = 127.0.0.1:9000/" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf From 5266224bd27ab7fd9491c1bc19aea48b4bb51983 Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Tue, 26 Jan 2021 18:15:18 +1300 Subject: [PATCH 41/44] Minor improvements. --- scripts/php.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/php.sh b/scripts/php.sh index 02154c49..3b927a90 100644 --- a/scripts/php.sh +++ b/scripts/php.sh @@ -35,21 +35,21 @@ else sudo apt-key update sudo apt-get update - - git clone https://github.com/rapidwebltd/php-switch-scripts.git - cd php-switch-scripts/ - ./setup.sh && ./switch-to-php-${PHP_VERSION}.sh + + git clone https://github.com/rapidwebltd/php-switch-scripts.git + cd php-switch-scripts/ + ./setup.sh && ./switch-to-php-${PHP_VERSION}.sh # Install PHP # -qq implies -y --force-yes # Install PHP module for Apache - - sudo apt-get install -y libapache2-mod-php${PHP_VERSION} php${PHP_VERSION}-{cli,bcmath,bz2,intl,gd,mbstring,mysql,zip,redis,gd,fpm,curl,gmp,memcached,imagick,xml,dom,xdebug,common} + + sudo apt-get install -y libapache2-mod-php${PHP_VERSION} php${PHP_VERSION}-{cli,bcmath,bz2,intl,gd,mbstring,mysql,zip,redis,gd,fpm,curl,gmp,memcached,imagick,xml,dom,xdebug,common} sudo phpenmod zip cli fpm mysql pgsql sqlite curl gd gmp memcached imagick intl mbstring bcmath xml redis xdebug dom - - sudo a2enmod proxy_fcgi setenvif && a2enconf php${PHP_VERSION}-fpm + + sudo a2enmod proxy_fcgi setenvif && a2enconf php${PHP_VERSION}-fpm # Set PHP FPM to listen on TCP instead of Socket sudo sed -i "s/listen =.*/listen = 127.0.0.1:9000/" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf From 843fc4fc7ec52c5933c1e3d258d1f29ac8d0ef22 Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Tue, 26 Jan 2021 18:44:05 +1300 Subject: [PATCH 42/44] Minor improvements. --- scripts/php.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/php.sh b/scripts/php.sh index 3b927a90..977ae96f 100644 --- a/scripts/php.sh +++ b/scripts/php.sh @@ -37,8 +37,8 @@ else sudo apt-get update git clone https://github.com/rapidwebltd/php-switch-scripts.git - cd php-switch-scripts/ - ./setup.sh && ./switch-to-php-${PHP_VERSION}.sh + cd php-switch-scripts/ && ./setup.sh + export DEBIAN_FRONTEND=noninteractive && ./switch-to-php-${PHP_VERSION}.sh # Install PHP # -qq implies -y --force-yes From f8b69102ea41d14b0e9acbfd849cb16c66e26828 Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Tue, 26 Jan 2021 19:22:24 +1300 Subject: [PATCH 43/44] Minor improvements. --- scripts/php.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/php.sh b/scripts/php.sh index 977ae96f..ec90c464 100644 --- a/scripts/php.sh +++ b/scripts/php.sh @@ -37,17 +37,18 @@ else sudo apt-get update git clone https://github.com/rapidwebltd/php-switch-scripts.git - cd php-switch-scripts/ && ./setup.sh - export DEBIAN_FRONTEND=noninteractive && ./switch-to-php-${PHP_VERSION}.sh + cd php-switch-scripts/ + export DEBIAN_FRONTEND=noninteractive + ./setup.sh 2> /dev/null && ./switch-to-php-${PHP_VERSION}.sh # Install PHP # -qq implies -y --force-yes # Install PHP module for Apache - sudo apt-get install -y libapache2-mod-php${PHP_VERSION} php${PHP_VERSION}-{cli,bcmath,bz2,intl,gd,mbstring,mysql,zip,redis,gd,fpm,curl,gmp,memcached,imagick,xml,dom,xdebug,common} + # sudo apt-get install -y libapache2-mod-php${PHP_VERSION} php${PHP_VERSION}-{cli,bcmath,bz2,intl,gd,mbstring,mysql,zip,redis,gd,fpm,curl,gmp,memcached,imagick,xml,dom,xdebug,common} - sudo phpenmod zip cli fpm mysql pgsql sqlite curl gd gmp memcached imagick intl mbstring bcmath xml redis xdebug dom + # sudo phpenmod zip cli fpm mysql pgsql sqlite curl gd gmp memcached imagick intl mbstring bcmath xml redis xdebug dom sudo a2enmod proxy_fcgi setenvif && a2enconf php${PHP_VERSION}-fpm From dcdbf1e8cd9ac8448ff6c2c1501f60277de145e8 Mon Sep 17 00:00:00 2001 From: Rob Attfield Date: Tue, 26 Jan 2021 19:23:10 +1300 Subject: [PATCH 44/44] Minor improvements. --- scripts/php.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/php.sh b/scripts/php.sh index ec90c464..6c9fd470 100644 --- a/scripts/php.sh +++ b/scripts/php.sh @@ -38,8 +38,8 @@ else git clone https://github.com/rapidwebltd/php-switch-scripts.git cd php-switch-scripts/ - export DEBIAN_FRONTEND=noninteractive - ./setup.sh 2> /dev/null && ./switch-to-php-${PHP_VERSION}.sh + export DEBIAN_FRONTEND=noninteractive + ./setup.sh 2> /dev/null && ./switch-to-php-${PHP_VERSION}.sh # Install PHP # -qq implies -y --force-yes