From f3545ae21e667bd26fc16ba1a03b76581346e0c8 Mon Sep 17 00:00:00 2001 From: "Francis S. Spencer" Date: Wed, 15 Nov 2017 09:37:04 -0300 Subject: [PATCH] Several configuration added and modified --- .gitignore | 1 + README.md | 1 + Vagrantfile | 3 +++ bootstrap.sh | 9 +++++---- install/nodejs.sh | 10 +++++----- install/phpmyadmin.sh | 10 ++++++---- install/xdebug.sh | 4 +++- scripts/addwebsite | 12 ++++++++++-- 8 files changed, 34 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index 917004c..43c1128 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ .idea /etc/config.yaml /sites/* +!/sites/.gitkeep diff --git a/README.md b/README.md index 59d63df..5ee2874 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ Specifications > - PHP 5.6 > - PHP 7.0 > - PHP 7.1 +> - PhpMyAdmin > - XDebug > - Composer > - Redis diff --git a/Vagrantfile b/Vagrantfile index 1dc6ed7..a92af8e 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -9,6 +9,7 @@ configs = YAML.load_file("#{current_dir}/etc/config.yaml") Vagrant.configure("2") do |config| config.vm.box = "ubuntu/trusty64" + config.vm.hostname = "codealist-lamp" config.vm.provision :shell, :path => "bootstrap.sh" config.vm.provision :shell, :path => "install/composer.sh" @@ -35,6 +36,8 @@ Vagrant.configure("2") do |config| config.vm.provision :shell, :path => "install/elasticsearch.sh" end + config.vm.provision "shell", inline: "sudo mysql -uroot -e \"ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '${configs[configs][general][mysql_root_pwd]}';\" 2> /dev/null" + config.vm.network "private_network", ip: configs['configs']['general']['public_ip'] config.vm.synced_folder "./etc", "/etc/vagrant", owner: "vagrant", group: "vagrant" diff --git a/bootstrap.sh b/bootstrap.sh index 249f3c1..78e8835 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -15,13 +15,13 @@ a2enmod php7.0 export DEBIAN_FRONTEND="noninteractive" # # Import MySQL 5.7 Key # # gpg: key 5072E1F5: public key "MySQL Release Engineering " imported -apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys 5072E1F5 +apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys 5072E1F5 2> /dev/null echo "deb http://repo.mysql.com/apt/ubuntu/ trusty mysql-5.7" | tee -a /etc/apt/sources.list.d/mysql.list -apt-get update +apt-get update 2> /dev/null debconf-set-selections <<< "mysql-community-server mysql-community-server/data-dir select ''" -debconf-set-selections <<< 'mysql-server mysql-server/root_password password ${configs[configs][general][mysql_root_pwd]}' -debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password ${configs[configs][general][mysql_root_pwd]}' +debconf-set-selections <<< "mysql-server mysql-server/root_password password root" +debconf-set-selections <<< "mysql-server mysql-server/root_password_again password root" apt-get install -y mysql-server 2> /dev/null @@ -65,6 +65,7 @@ cp /etc/vagrant/apache2/skeleton /etc/apache2/sites-available/skeleton 2> /dev/n mkdir -p /var/www/html echo " /var/www/ +apt-get install -y composer 2> /dev/null apt-get install -y git 2> /dev/null diff --git a/install/nodejs.sh b/install/nodejs.sh index a30439b..167b01e 100644 --- a/install/nodejs.sh +++ b/install/nodejs.sh @@ -1,8 +1,8 @@ #!/usr/bin/env bash -apt-get install -y build-essential nodejs -apt-get install -y npm +apt-get install -y build-essential nodejs 2> /dev/null +apt-get install -y npm 2> /dev/null npm -v -npm install -g gulp -npm install -g grunt -npm install -g grunt-cli +npm install -g gulp 2> /dev/null +npm install -g grunt 2> /dev/null +npm install -g grunt-cli 2> /dev/null diff --git a/install/phpmyadmin.sh b/install/phpmyadmin.sh index 9543212..87dd589 100644 --- a/install/phpmyadmin.sh +++ b/install/phpmyadmin.sh @@ -1,8 +1,10 @@ #!/usr/bin/env bash debconf-set-selections <<< "phpmyadmin phpmyadmin/dbconfig-install boolean true" -debconf-set-selections <<< "phpmyadmin phpmyadmin/app-password-confirm password ${configs[configs][general][mysql_root_pwd]}" -debconf-set-selections <<< "phpmyadmin phpmyadmin/mysql/admin-pass password ${configs[configs][general][mysql_root_pwd]}" -debconf-set-selections <<< "phpmyadmin phpmyadmin/mysql/app-pass password ${configs[configs][general][mysql_root_pwd]}" +debconf-set-selections <<< "phpmyadmin phpmyadmin/app-password-confirm password root" +debconf-set-selections <<< "phpmyadmin phpmyadmin/mysql/admin-pass password root" +debconf-set-selections <<< "phpmyadmin phpmyadmin/mysql/app-pass password root" debconf-set-selections <<< "phpmyadmin phpmyadmin/reconfigure-webserver multiselect none" -apt-get -y install phpmyadmin 2> /dev/null \ No newline at end of file +apt-get -y install phpmyadmin 2> /dev/null +a2dismod php5 2> /dev/null +service apache2 restart 2> /dev/null \ No newline at end of file diff --git a/install/xdebug.sh b/install/xdebug.sh index daf4b4d..ee67d89 100644 --- a/install/xdebug.sh +++ b/install/xdebug.sh @@ -1,18 +1,20 @@ #!/usr/bin/env bash -# install redis apt-get -y install php-xdebug echo 'xdebug.remote_enable = on' >> /etc/php/5.6/cli/conf.d/20-xdebug.ini echo 'xdebug.remote_connect_back = on' >> /etc/php/5.6/cli/conf.d/20-xdebug.ini echo 'xdebug.idekey = "vagrant"' >> /etc/php/5.6/cli/conf.d/20-xdebug.ini +echo 'xdebug.max_nesting_level = 200' >> /etc/php/5.6/cli/conf.d/20-xdebug.ini echo 'xdebug.remote_enable = on' >> /etc/php/7.0/cli/conf.d/20-xdebug.ini echo 'xdebug.remote_connect_back = on' >> /etc/php/7.0/cli/conf.d/20-xdebug.ini echo 'xdebug.idekey = "vagrant"' >> /etc/php/7.0/cli/conf.d/20-xdebug.ini +echo 'xdebug.max_nesting_level = 200' >> /etc/php/7.0/cli/conf.d/20-xdebug.ini echo 'xdebug.remote_enable = on' >> /etc/php/7.1/cli/conf.d/20-xdebug.ini echo 'xdebug.remote_connect_back = on' >> /etc/php/7.1/cli/conf.d/20-xdebug.ini echo 'xdebug.idekey = "vagrant"' >> /etc/php/7.1/cli/conf.d/20-xdebug.ini +echo 'xdebug.max_nesting_level = 200' >> /etc/php/7.1/cli/conf.d/20-xdebug.ini service apache2 restart \ No newline at end of file diff --git a/scripts/addwebsite b/scripts/addwebsite index d9c7d7c..015960f 100644 --- a/scripts/addwebsite +++ b/scripts/addwebsite @@ -6,6 +6,8 @@ EXTENSION=".conf" RESTARTCMD="/usr/bin/sudo service apache2 reload" if [ "$1" != '' ]; then + + # Copy the vhost skeleton to our new vhost if [ ! -f "$VHOSTDIR$1.conf" ]; then cp "$VHOSTDIR/skeleton" "$VHOSTDIR$1$EXTENSION" echo "created $VHOSTDIR$1$EXTENSION" @@ -14,19 +16,25 @@ if [ "$1" != '' ]; then cp "$VHOSTDIR/skeleton" "$VHOSTDIR$1$EXTENSION" echo "Created $VHOSTDIR$1$EXTENSION and made a backup of the existing conf" fi + + # Add website directory index to vhost configuration find "$VHOSTDIR$1$EXTENSION" -type f -exec sed -i "s/SITEDOCROOT/$1\/public_html/g" {} \; find "$VHOSTDIR$1$EXTENSION" -type f -exec sed -i "s/SITEDOMAIN/$1/g" {} \; + + # Create Website File Structure if does not exists if [ ! -d "$WEBROOT$1/" ]; then mkdir -p "$WEBROOT$1/public_html" mkdir -p "$WEBROOT$1/log" chown -R vagrant:www-data "$WEBROOT$1/" echo "Created $WEBROOT$1/" - else - echo "$WEBROOT$1/ already exists" fi + + # Enable our new website and restart apache sudo a2ensite $1 $RESTARTCMD + echo "Apache reloaded" + elif [ "$1" = 'help' ] || [ "$1" = '' ]; then echo "USAGE: sudo addwebsite [website local url]" echo "EXAMPLE: to create hostname.localhost just run the command 'sudo addwebsite hostname.localhost'"