forked from panique/mini
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
118 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# -*- mode: ruby -*- | ||
# vi: set ft=ruby : | ||
|
||
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | ||
VAGRANTFILE_API_VERSION = "2" | ||
|
||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | ||
|
||
# Every Vagrant virtual environment requires a box to build off of. | ||
config.vm.box = "ubuntu/trusty64" | ||
|
||
# Create a private network, which allows host-only access to the machine using a specific IP. | ||
config.vm.network "private_network", ip: "192.168.33.44" | ||
|
||
# Share an additional folder to the guest VM. The first argument is the path on the host to the actual folder. | ||
# The second argument is the path on the guest to mount the folder. | ||
config.vm.synced_folder "./", "/var/www/html" | ||
|
||
# Define the bootstrap file: A (shell) script that runs after first setup of your box (= provisioning) | ||
config.vm.provision :shell, path: "bootstrap.sh" | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Use single quotes instead of double quotes to make it work with special-character passwords | ||
PASSWORD='12345678' | ||
PROJECTFOLDER='myproject' | ||
|
||
# create project folder | ||
sudo mkdir "/var/www/html/${PROJECTFOLDER}" | ||
|
||
sudo apt-get update | ||
sudo apt-get -y upgrade | ||
|
||
sudo apt-get install -y apache2 | ||
sudo apt-get install -y php5 | ||
|
||
sudo debconf-set-selections <<< "mysql-server mysql-server/root_password password $PASSWORD" | ||
sudo debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $PASSWORD" | ||
sudo apt-get -y install mysql-server | ||
sudo apt-get install php5-mysql | ||
|
||
sudo debconf-set-selections <<< "phpmyadmin phpmyadmin/dbconfig-install boolean true" | ||
sudo debconf-set-selections <<< "phpmyadmin phpmyadmin/app-password-confirm password $PASSWORD" | ||
sudo debconf-set-selections <<< "phpmyadmin phpmyadmin/mysql/admin-pass password $PASSWORD" | ||
sudo debconf-set-selections <<< "phpmyadmin phpmyadmin/mysql/app-pass password $PASSWORD" | ||
sudo debconf-set-selections <<< "phpmyadmin phpmyadmin/reconfigure-webserver multiselect apache2" | ||
sudo apt-get -y install phpmyadmin | ||
|
||
# setup hosts file | ||
VHOST=$(cat <<EOF | ||
<VirtualHost *:80> | ||
DocumentRoot "/var/www/html/${PROJECTFOLDER}/public" | ||
<Directory "/var/www/html/${PROJECTFOLDER}/public"> | ||
AllowOverride All | ||
Require all granted | ||
</Directory> | ||
</VirtualHost> | ||
EOF | ||
) | ||
echo "${VHOST}" > /etc/apache2/sites-available/000-default.conf | ||
|
||
# enable mod_rewrite | ||
sudo a2enmod rewrite | ||
|
||
# restart apache | ||
service apache2 restart | ||
|
||
# remove default apache index.html | ||
sudo rm "/var/www/html/index.html" | ||
|
||
# install git | ||
sudo apt-get -y install git | ||
|
||
# git clone MINI | ||
sudo git clone https://github.com/panique/mini "/var/www/html/${PROJECTFOLDER}" | ||
|
||
# install Composer (not necessary by default) | ||
#curl -s https://getcomposer.org/installer | php | ||
#mv composer.phar /usr/local/bin/composer | ||
|
||
# go to project folder, load Composer packages (not necessary by default) | ||
#cd "/var/www/html/${PROJECTFOLDER}" | ||
#composer install --dev | ||
|
||
# run SQL statements from MINI folder | ||
sudo mysql -h "localhost" -u "root" "-p${PASSWORD}" < "/var/www/html/${PROJECTFOLDER}/_install/01-create-database.sql" | ||
sudo mysql -h "localhost" -u "root" "-p${PASSWORD}" < "/var/www/html/${PROJECTFOLDER}/_install/02-create-table-song.sql" | ||
sudo mysql -h "localhost" -u "root" "-p${PASSWORD}" < "/var/www/html/${PROJECTFOLDER}/_install/03-insert-demo-data-into-table-song.sql" | ||
|
||
# put the password into the application's config. This is quite hardcore, but why not :) | ||
sed -i "s/your_password/${PASSWORD}/" "/var/www/html/${PROJECTFOLDER}/application/config.php" | ||
|
||
# final feedback | ||
echo "Voila!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters