Skip to content

Commit

Permalink
Several configuration added and modified
Browse files Browse the repository at this point in the history
  • Loading branch information
Francis S. Spencer authored and Francis S. Spencer committed Nov 15, 2017
1 parent d739ed0 commit f3545ae
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 16 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
.idea
/etc/config.yaml
/sites/*
!/sites/.gitkeep
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Specifications
> - PHP 5.6
> - PHP 7.0
> - PHP 7.1
> - PhpMyAdmin
> - XDebug
> - Composer
> - Redis
Expand Down
3 changes: 3 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
9 changes: 5 additions & 4 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ a2enmod php7.0
export DEBIAN_FRONTEND="noninteractive"
# # Import MySQL 5.7 Key
# # gpg: key 5072E1F5: public key "MySQL Release Engineering <mysql-build@oss.oracle.com>" 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

Expand Down Expand Up @@ -65,6 +65,7 @@ cp /etc/vagrant/apache2/skeleton /etc/apache2/sites-available/skeleton 2> /dev/n
mkdir -p /var/www/html
echo "<?php phpinfo();" > /var/www/

apt-get install -y composer 2> /dev/null
apt-get install -y git 2> /dev/null


10 changes: 5 additions & 5 deletions install/nodejs.sh
Original file line number Diff line number Diff line change
@@ -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
10 changes: 6 additions & 4 deletions install/phpmyadmin.sh
Original file line number Diff line number Diff line change
@@ -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
apt-get -y install phpmyadmin 2> /dev/null
a2dismod php5 2> /dev/null
service apache2 restart 2> /dev/null
4 changes: 3 additions & 1 deletion install/xdebug.sh
Original file line number Diff line number Diff line change
@@ -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
12 changes: 10 additions & 2 deletions scripts/addwebsite
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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'"
Expand Down

0 comments on commit f3545ae

Please sign in to comment.