Skip to content

Commit

Permalink
Version 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
floriandammeyer committed Nov 1, 2014
1 parent 8754e35 commit ac0719f
Show file tree
Hide file tree
Showing 11 changed files with 2,193 additions and 32 deletions.
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
## Installation
Den Inhalt des Repositorys einfach ins Wurzelverzeichnis des Projekts kopieren. Schon kann mit "vagrant up" ein
virtueller Webserver für das jeweilige Projekt gestartet werden.

## Zugriff auf den Server
Es werden vier Ports der virtuellen Maschine auf den Host-Computer weitergeleitet.
2222 ist Vagrants Standardport für SSH, sodass man über localhost:2222 per SSH auf den Server zugreifen kann.
Wie genau das mit der Authentifizierung funktioniert steht in der Vagrant-Dokumentation.
Unter Port 8080 ist der Webserver erreichbar, über 3306 der MySQL-Server.
Ein Sonderfall ist Port 1080, der auf das Web-Frontend von Mailcatcher weiterleitet. Hier bekommt man eine Übersicht über die "versendeten" E-Mails.

## Details zum System
### Ubuntu 14.04 mit folgenden Tools:

- Curl
- Git
- G++
- Make

- Ruby
- Python
- PHP

- Apache2
- Nodejs
- NPM
- Bower

- MySQL
- phpMyAdmin

### Details:
##### Apache2
> Das DocumentRoot-Verzeichnis des Webservers wird automatisch auf das Wurzelverzeichnis des Projekts gemappt.
> Dadurch ist das Projekt nach "vagrant up" direkt über http://localhost:8080/ erreichbar.
##### MySQL-Server 5.5
> Aktuellste Version des MySQL-Servers. Mit dem Benutzer "root" und dem Passwort "password" kann direkt am Server gearbeitet werden.
> Es wird automatisch eine Standarddatenbank namens "default_database" angelegt. Über die in database-config.sh definierten Dateien kann diese Datenbank automatisch gefüllt werden.
##### phpMyAdmin
> Unter http://localhost:8080/phpmyadmin ist die phpMyAdmin-Oberfläche erreichbar. phpMyAdmin ist bereits so konfiguriert,
> dass man direkt ohne Login auf die Datenbank zugreifen kann.
##### PHP 5.4
> zusätzlich zu den (Ubuntu-) Standardmodulen sind die PHP-Module Pear, Curl, Imap, Mysqlnd, Sqlite3, PostgreSql, MySQL und pcntl installiert.
> Außerdem ist Xdebug als nützliches Entwickler-Tool dabei.
##### mailcatcher
> Mailcatcher ist ein kleines Ruby-Programm, das einen lokalen SMTP-Server ausführt. PHP ist schon so konfiguriert,
> dass es per "mail()" gesendete E-Mails an diesen Server schickt. Anstatt die E-Mails wie ein normaler SMTP-Server
> an ihre Adressaten weiterzuleiten, werden sie bloß abgefangen und gespeichert und können über http://localhost:1080/ online angesehen werden.
2 changes: 2 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ Vagrant.configure("2") do |config|
# Make the webserver and the MySQL server accessible to the host
config.vm.network :forwarded_port, guest: 80, host: 8080
config.vm.network :forwarded_port, guest: 3306, host: 3306
# HTTP port for accessing mailcatcher's inbox
config.vm.network :forwarded_port, guest: 1080, host: 1080
end
1 change: 0 additions & 1 deletion vagrant-up/README.md

This file was deleted.

85 changes: 55 additions & 30 deletions vagrant-up/bootstrap.sh
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
#!/usr/bin/env bash
#!/bin/bash

if [ ! -f /var/log/vagrant-provisioning ];
then

touch /var/log/vagrant-provisioning

# Load the configuration file
source config.sh

##########################################
# Preparations
apt-get update
apt-get -y install debconf-utils python-software-properties git git-core curl make
apt-get -y install debconf-utils python-software-properties git git-core curl make g++

# Install PHP 5.4
# Install PHP 5.4 and its extensions
add-apt-repository -y ppa:ondrej/php5-oldstable
apt-get update
apt-get -y install php5 php5-dev php-pear
apt-get -y install php5 php5-dev php-pear php5-curl php5-imap php5-mysqlnd php5-sqlite php5-pgsql
# Install Xdebug
pecl install xdebug

# TODO: php.ini anpassen und kopieren (z. b. xdebug konfigurieren, mail-configurieren (mailcatcher))
# @see http://berk.es/2011/05/29/mailcatcher-for-drupal-and-other-php-applications-the-simple-version/
# Install a more recent version of ruby and mailcatcher
# @see http://venturecraft.com.au/development/installing-mailcatcher-with-homestead-vagrant/
apt-get -y install ruby1.9.1-dev libsqlite3-dev
gem install mailcatcher

# Install Apache2 with PHP support
apt-get -y install apache2 libapache2-mod-php5
Expand All @@ -30,20 +30,58 @@ then
debconf-set-selections <<< 'mysql-server-5.5 mysql-server/root_password_again password password'
apt-get -y install mysql-server-5.5 php5-mysql

# TODO: für später
# apt-get install phpmyadmin

# Install rubygems and mailcatcher
apt-get install ruby rubygems
gem install mailcatcher
# Install and configure phpMyAdmin
debconf-set-selections <<< 'phpmyadmin phpmyadmin/dbconfig-install boolean true'
debconf-set-selections <<< 'phpmyadmin phpmyadmin/app-password-confirm password password'
debconf-set-selections <<< 'phpmyadmin phpmyadmin/mysql/admin-pass password password'
debconf-set-selections <<< 'phpmyadmin phpmyadmin/mysql/app-pass password password'
debconf-set-selections <<< 'phpmyadmin phpmyadmin/reconfigure-webserver multiselect apache2'
apt-get -y install phpmyadmin

# Installing PHP-PCNTL is not straight forward because we need to build it first
cwd=$(pwd)
apt-get -y install dpkg-dev
mkdir /var/tmp/php5-pcntl
cd /var/tmp/php5-pcntl
apt-get source php5
cd $(find -maxdepth 1 -name "php5*" -type d)
cd ext/pcntl
phpize
./configure
make
make install
echo "extension=pcntl.so" > /etc/php5/mods-available/pcntl.ini
chmod a=r /etc/php5/mods-available/pcntl.ini
chmod u+w /etc/php5/mods-available/pcntl.ini
ln -s /etc/php5/mods-available/pcntl.ini /etc/php5/conf.d/10-pcntl.ini
rm -rf /var/tmp/php5-pcntl
cd cwd

# enable and configure Xdebug
cp -rf /vagrant/vagrant-up/config-presets/php5/mods-available/xdebug.ini /etc/php5/mods-available/xdebug.ini
chmod a=r /etc/php5/mods-available/xdebug.ini
chmod u+w /etc/php5/mods-available/xdebug.ini
ln -s /etc/php5/mods-available/xdebug.ini /etc/php5/conf.d/10-xdebug.ini
# copy php.ini for apache2
cp -rf /vagrant/vagrant-up/config-presets/php5/apache2/php.ini /etc/php5/apache2/php.ini
# Configure phpMyAdmin
cp -rf /etc/phpmyadmin/apache.conf /etc/apache2/conf.d/phpmyadmin.conf
cp -rf /vagrant/vagrant-up/config-presets/phpmyadmin/config.inc.php /etc/phpmyadmin/config.inc.php
# Now load the new apache configuration
service apache2 restart

# Install NodeJS, NPM and bower
add-apt-repository -y ppa:chris-lea/node.js
apt-get update
# The added repository also installs npm when installilng nodejs!
# The added repository also installs npm when installing nodejs!
apt-get -y install nodejs
npm install -g bower

# Register mailcatcher as a service and start it
# Next time the system boots the service will be started automatically
cp -rf /vagrant/vagrant-up/config-presets/upstart/mailcatcher.conf /etc/init/mailcatcher.conf
service mailcatcher start

####################
## Set up Apache2
# IMPORTANT! Only remove /var/www if it is not a symlink!!
Expand All @@ -66,20 +104,7 @@ then
cp -rf /vagrant/vagrant-up/config-presets/mysql/my.cnf /etc/mysql/my.cnf
service mysql restart

# Create the default database and grant all privileges on this database to the root user
mysql -uroot -ppassword <<< 'CREATE DATABASE default_database;'
mysql -uroot -ppassword <<< 'GRANT ALL PRIVILEGES ON *.* TO "root"@"%";'
mysql -uroot -ppassword <<< 'FLUSH PRIVILEGES;'

# Import the default database structure
if [ -f $database_init_script ];
then
mysql -uroot -ppassword default_database < $database_init_script

if [ -f $database_content_script ];
then
mysql -uroot -ppassword default_database < $database_content_script
fi
fi
/vagrant/vagrant-up/database-setup.sh
fi

126 changes: 126 additions & 0 deletions vagrant-up/config-presets/php5/apache2/php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
[PHP]
engine = On
short_open_tag = On
precision = 14
y2k_compliance = Off
output_buffering = Off
output_handler =
unserialize_callback_func =
zlib.output_compression =
implicit_flush = Off
allow_call_time_pass_reference = On
safe_mode = Off
safe_mode_gid =
safe_mode_include_dir =
safe_mode_exec_dir =
safe_mode_allowed_env_vars = "PHP_"
safe_mode_protected_env_vars = "LD_LIBRARY_PATH"
disable_functions =
highlight.string = "#CC0000"
highlight.comment = "#FF9900"
highlight.keyword = "#006600"
highlight.bg = "#FFFFFF"
highlight.default = "#0000CC"
highlight.html = "#000000"
expose_php = On
max_execution_time = 90
memory_limit = 50M
error_reporting = 30711
display_startup_errors =
track_errors = Off
variables_order = "EGPCS"
register_argc_argv = On
post_max_size = 8M
gpc_order = "GPC"
magic_quotes_runtime = Off
magic_quotes_sybase = Off
default_mimetype = "text/html"
doc_root =
user_dir =
enable_dl = On
file_uploads = 1
allow_url_include = 1
arg_separator.output = "&amp;"
arg_separator.input = "&amp;"
extension = "zip.so"
asp_tags = On
allow_url_fopen = On
display_errors = On
log_errors = Off
error_log =
register_globals = On
magic_quotes_gpc = On
auto_prepend_file =
auto_append_file =
upload_max_filesize = 8M
zend_optimizer.enable_loader = On
zend_optimizer.optimization_level = 15

[mail function]
; DEVELOPMENT SETTINGS
SMTP = "localhost"
smtp_port = 1025
sendmail_from = "[email protected]"
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = "/usr/bin/env catchmail "

[SQL]
sql.safe_mode = Off

[ODBC]
odbc.allow_persistent = 1
odbc.check_persistent = 1
odbc.max_persistent = -1
odbc.max_links = -1
odbc.defaultlrl = 4096
odbc.defaultbinmode = 1

[MySQL]
mysql.allow_persistent = Off
mysql.max_persistent = -1
mysql.max_links = -1
mysql.default_port =
mysql.default_socket =
mysql.default_host =
mysql.default_user =
mysql.default_password =

[PostgresSQL]
pgsql.allow_persistent = On
pgsql.auto_reset_persistent =
pgsql.max_persistent = -1
pgsql.max_links = -1

[bcmath]
bcmath.scale = 0

[browscap]
browscap =

[Session]
session.serialize_handler = "php"
session.gc_probability = 1
session.referer_check =
session.entropy_length = 0
session.entropy_file =
session.cache_limiter = "nocache"
session.cache_expire = 180
session.use_trans_sid = 1
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
session.save_handler = "files"
session.save_path = "/tmp"
session.use_cookies = On
session.name = "PHPSESSID"
session.auto_start = Off
session.cookie_lifetime = 0
session.cookie_path = "/"
session.cookie_domain =
session.gc_maxlifetime = 1440

[Assertion]
assert.active = On
assert.warning = On
assert.bail = Off
assert.callback =
assert.quiet_eval = Off
Loading

0 comments on commit ac0719f

Please sign in to comment.