Skip to content

Commit

Permalink
inital commit
Browse files Browse the repository at this point in the history
  • Loading branch information
roman204 committed Dec 7, 2015
0 parents commit 2cfe9d9
Show file tree
Hide file tree
Showing 23 changed files with 1,987 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.idea/
/htdocs/*
!/htdocs/.gitkeep
/vendor/*
!/vendor/.gitkeep
/.vagrant
/bin/*
!/bin/n98-magerun
!/bin/n98-magerun.phar
!/bin/vagrant-bootstrap.sh
!/bin/vagrant_up.sh
1 change: 1 addition & 0 deletions .modman/.basedir
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
htdocs
38 changes: 38 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
## Vagrant + Magento (1.9.2.2) + PHP-7.0.0

This Vagrantbox will build a Virtual Server for Virtualbox based on Ubuntu 14.04.
On 'vagrant up' it will automatically install a Stack based on the following:

* Nginx (1.4.6-1ubuntu3.3)
* MySQL-Server 5.6
* PHP7.0.0 (compiled from source)

## Installation
To get it up and running follow the steps:

* Download and install [Virtualbox](https://www.virtualbox.org/wiki/Downloads)
* Download and install [Vagrant](https://www.vagrantup.com/downloads.html)
* Make sure you are at least at Vagrant version 1.5 or the steps below may not work for you.
* change parameters in Vagrantfile
* change parameters in config/settings/nginx/default


$ php composer.phar install
$ vagrant up

After successful first build you should disable line: 3 in ./bin/vagrant_up.sh to avoid the installprocess runs on every vagrant up.

#/vagrant/bin/vagrant-bootstrap.sh


### Information:
MySQL-Root Password: empty (really empty "" not the string empty)
PHP-7 is installed in /usr/local/php7

### Author
Roman Hutterer
[CopeX.io](https://copex.io)




50 changes: 50 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
PROJECT_NAME = "magento-php7"
IP = "10.10.10.8"
NFS_EXPORT = true

Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty64"

config.vm.network :private_network, ip: IP
config.ssh.forward_agent = true

config.nfs.map_uid = Process.uid
config.nfs.map_gid = Process.gid
if RUBY_PLATFORM =~ /linux/
config.vm.synced_folder ".", "/vagrant", id: "vagrant-root", type: "rsync", rsync__exclude: ["htdocs/.git/",".idea/","htdocs/var/","./.modman/","./vendor/","./config/","./db/"], rsync__args: ["--verbose", "--archive","-z"]
config.vm.synced_folder "vendor", "/vagrant/vendor", id:"vendor-root", type: "nfs"
config.vm.synced_folder ".modman", "/vagrant/.modman", id:"modman-root", type: "nfs"
config.vm.synced_folder "config", "/vagrant/config", id:"config", type: "nfs"
config.vm.synced_folder "db", "/vagrant/db", id:"db", type: "nfs"
elsif RUBY_PLATFORM =~ /darwin/
config.vm.synced_folder ".", "/vagrant", id: "vagrant-root", type: "rsync", rsync__exclude: ["htdocs/.git/",".idea/","htdocs/var/","./.modman/","./vendor/","./config/","./db/"], rsync__args: ["--verbose", "--archive","-z"]
config.vm.synced_folder "vendor", "/vagrant/vendor", id:"vendor-root", :nfs => { :mount_options => ["dmode=777","fmode=777"] }
config.vm.synced_folder ".modman", "/vagrant/.modman", id:"modman-root", :nfs => { :mount_options => ["dmode=777","fmode=777"] }
config.vm.synced_folder "config", "/vagrant/config", id:"config", :nfs => { :mount_options => ["dmode=777","fmode=777"] }
config.vm.synced_folder "db", "/vagrant/db", id:"db", :nfs => { :mount_options => ["dmode=777","fmode=777"] }
elsif RUBY_PLATFORM =~ /win32/
config.vm.synced_folder ".","/vagrant", id:"vagrant-root"
end

# Set the virtual machine host name
config.vm.hostname = PROJECT_NAME + ".local"


config.vm.provision :shell, :inline => "echo \"CET\" |
sudo tee /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata"

config.vm.provider :virtualbox do |v|
v.customize ["modifyvm", :id, "--name", PROJECT_NAME]
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
v.customize ["modifyvm", :id, "--memory", 2048]
v.customize ["modifyvm", :id, "--vram", 64]
v.customize ["modifyvm", :id, "--cpus", "1"]
v.customize ["modifyvm", :id, "--cpuexecutioncap", "100"]
end

config.vm.provision "shell", inline: "chmod +x /vagrant/bin/*.sh"
## Uncomment the next line to provision a new magneto vm
config.vm.provision "shell", inline: "/vagrant/bin/vagrant_up.sh"
#, run: "always"
config.vm.provision "shell", inline: "service nginx restart", run: "always"
end
1 change: 1 addition & 0 deletions bin/n98-magerun
Binary file added bin/n98-magerun.phar
Binary file not shown.
98 changes: 98 additions & 0 deletions bin/vagrant-bootstrap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
#!/usr/bin/env bash
export DEBIAN_FRONTEND=noninteractive

# /tmp has to be world-writable, but sometimes isn't by default.
chmod 0777 /tmp

# copy ssh key
cp -r /vagrant/.ssh/* /home/vagrant/.ssh/
chmod 0600 /home/vagrant/.ssh/*
chown vagrant:vagrant /home/vagrant/.ssh/*



# PHP 5.5 from PPA
apt-get update
apt-get install -y python-software-properties
# Add Mysql 5.6
#add-apt-repository -y ppa:ondrej/mysql-5.6


# Add PHP7
apt-get install -y git-core autoconf bison libxml2-dev libbz2-dev libmcrypt-dev libcurl4-openssl-dev libltdl-dev libpng-dev libpspell-dev libreadline-dev
mkdir -p /etc/php7/conf.d
mkdir -p /etc/php7/cli/conf.d
mkdir /usr/local/php7

cd /tmp
wget https://github.com/php/php-src/archive/php-7.0.0.tar.gz
tar xzf php-7.0.0.tar.gz
cd php-src-php-7.0.0

./buildconf --force
./configure --prefix=/usr/local/php7 --without-pear --enable-opcache-file --enable-fpm --with-mysql-sock=/var/run/mysqld/mysqld.sock --enable-bcmath --with-bz2 --enable-calendar --enable-exif --enable-dba --enable-ftp --with-gettext --with-gd --enable-mbstring --with-mcrypt --with-mhash --enable-mysqlnd --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-openssl --enable-pcntl --with-pspell --enable-shmop --enable-soap --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --with-zlib --enable-zip --with-readline --with-curl --with-config-file-path=/etc/php7/cli --with-config-file-scan-dir=/etc/php7/cli/conf.d
#simple fast way to replace pear protocol to http cause they haven't a valid ssl-cert
sed -i 's/https:\/\/pear.php.net\/install-pear-nozlib.phar/http:\/\/pear.php.net\/install-pear-nozlib.phar/g' Makefile
make
#make test
make install


#copy config files
ln -fs /vagrant/config/settings/php/php-fpm.conf /usr/local/php7/etc/php-fpm.conf
ln -fs /vagrant/config/settings/php/www.conf /usr/local/php7/etc/php-fpm.d/www.conf

#configure for use as php-fpm service
ln -fs /vagrant/config/settings/php/php7-fpm /etc/init.d/php7-fpm
chmod 0755 /etc/init.d/php7-fpm
/usr/lib/insserv/insserv php7-fpm

ln -fs /vagrant/config/settings/php/php7-fpm.service /lib/systemd/system/php7-fpm.service
service php7-fpm start

cd /usr/bin
ln -s /usr/local/php7/bin/php

# Required packages
apt-get -q -y install mysql-server
apt-get install -y libnss-mdns curl git libssl0.9.8 sendmail language-pack-de-base vim
apt-get install -y nginx

# xDebug
#apt-get install php5-xdebug
#ln -s /vagrant/config/settings/xdebug.ini /etc/php5/fpm/conf.d/21-xdebug-extra.ini

#Set up Git interface: use colors, add "git tree" command
git config --global color.ui true
git config --global alias.tree "log --oneline --decorate --all --graph"

# Composer
#curl -sS https://getcomposer.org/installer | php
#mv composer.phar /usr/local/bin/composer

# Modman
#curl -s -o /usr/local/bin/modman https://raw.githubusercontent.com/colinmollenhour/modman/master/modman
#chmod +x /usr/local/bin/modman

# n98-magerun
#curl -s -o /usr/local/bin/n98-magerun https://raw.githubusercontent.com/netz98/n98-magerun/master/n98-magerun.phar
#chmod +x /usr/local/bin/n98-magerun

# make Magento directories writable as needed and add www-data user to vagrant group
chmod -R 0777 /vagrant/htdocs/var /vagrant/htdocs/app/etc /vagrant/htdocs/media
usermod -a -G vagrant www-data
usermod -a -G www-data vagrant


# MySQL configuration, cannot be linked because MySQL refuses to load world-writable configuration
cp -f /vagrant/config/settings/my.cnf /etc/mysql/my.cnf
service mysql restart
# Allow access from host
mysql -uroot -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'; FLUSH PRIVILEGES;"

# Set locale
ln -fs /vagrant/config/settings/locale /etc/default/locale


ln -fs /vagrant/config/settings/nginx/default /etc/nginx/sites-available/default
service nginx reload
46 changes: 46 additions & 0 deletions bin/vagrant_up.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash

/vagrant/bin/vagrant-bootstrap.sh
#
cd /vagrant/
#
if [ ! -e htdocs/app/etc/local.xml ]; then #Install Magento Database
echo "Installing Magento"
#Create Database
mysqladmin -uroot create magento
if [ -e config/local.xml ]; then #symlink local.xml from config
echo "Symlinking local.xml"
ln -fs /vagrant/config/local.xml /vagrant/htdocs/app/etc/local.xml
else
#Create DB Config (n98)
echo "Creating local.xml"
sudo -u vagrant -H sh -c "bin/n98-magerun --root-dir=htdocs local-config:generate localhost root '' magento db backoffice"
cp htdocs/app/etc/local.xml config/local.xml
fi
#Import Database if possible
if [ -e db/install.sql.gz ]; then
echo "Importing Database from db/install.sql.gz"
bin/n98-magerun --root-dir=htdocs db:import -c gzip /vagrant/db/install.sql.gz
else
echo "Creating admin user"
bin/n98-magerun --root-dir=htdocs admin:user:create admin [email protected] admin123 Admini Strator Administrators
fi

# Write permissions in media
chmod -R 0770 htdocs/media

# Now after Magento has been installed, deploy all additional modules and run setup scripts
sudo -u vagrant -H sh -c "bin/modman deploy-all --force > /dev/null"
bin/n98-magerun --root-dir=htdocs sys:setup:run

# Set up PHPUnit
ln -fs /vagrant/config/local.xml.phpunit /vagrant/htdocs/app/etc/local.xml.phpunit
mysqladmin -uroot create magento_unit_tests
if [ -e /vagrant/htdocs/shell/ecomdev-phpunit-install.php ]; then
echo "Creating phpUnit test database"
php /vagrant/htdocs/shell/ecomdev-phpunit-install.php
fi

bin/n98-magerun --root-dir=htdocs config:set dev/log/active 1
bin/n98-magerun --root-dir=htdocs config:set dev/template/allow_symlink 1
fi
51 changes: 51 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"config": {
"bin-dir": "bin",
"vendor-dir": "vendor",
"cache-dir": "/dev/shm"
},
"autoload": {
"psr-0": {
"": [
"htdocs/app",
"htdocs/app/code/local",
"htdocs/app/code/community",
"htdocs/app/code/core",
"htdocs/downloader/lib",
"htdocs/lib"
]
},
"psr-4": {
"PhpParser\\": "vendor/nikic/php-parser/lib/PhpParser/"
}
},
"repositories": [
{
"type": "composer",
"url": "http://packages.firegento.com"
}
],
"minimum-stability": "dev",
"require": {
"php": ">=5.4.0",
"aydin-hassan/magento-core-composer-installer": "1.2.2",
"magento/core": "1.9.2.2",
"magento-hackathon/magento-composer-installer": "3.*",
"colinmollenhour/modman": "dev-master"
},
"scripts": {
"post-install-cmd": [
"cd htdocs/ && ../bin/modman update-all --no-clean"
],
"post-update-cmd": [
"cd htdocs/ && ../bin/modman update-all --no-clean"
]
},
"extra": {
"magento-root-dir": "htdocs/",
"magento-deploystrategy": "symlink",
"auto-append-gitignore": true,
"modman-root-dir": ".modman/",
"magento-force": "true"
}
}
Loading

0 comments on commit 2cfe9d9

Please sign in to comment.