Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ Status: Stable
###Basic usage
Open terminal, go to desired directory and type in:
```bash
git clone https://github.com/terion-name/Lagrant && mv Lagrant/* ./ && rm -r -f Lagrant && vagrant up
git clone https://github.com/yaapis/Lagrant && mv Lagrant/* ./ && rm -r -f Lagrant
mv vagrant/provision.[small|medium|full].sh vagrant/provision.sh
vagrant up
```
Or just clone/download Lagrant, edit Vagrantfile's variables and/or provision.sh to your prefers and run ```vagrant up```

Expand Down Expand Up @@ -60,6 +62,7 @@ Lagrant will load Ubuntu 12 x64 VM with following components:
* [phpunit](http://phpunit.de/)
* [composer](http://getcomposer.org/)
* [beanstalkd queue server](https://github.com/kr/beanstalkd) and [beanstalk console](https://github.com/ptrofimov/beanstalk_console), available after install at [http://localhost:8080/beanstalkd/index.php](http://localhost:8080/beanstalkd/index.php)
* [phpmyadmin](http://www.phpmyadmin.net), available after install at http://33.33.33.33/phpmyadmin/

Also it will create a database with provided in Vagrantfile credentials (default root password is *root*, default db name is *database*).
If it performs a clean install of Laravel, it will create an environment configs set (defaults to *dev*) and set up local database and app configs.
Expand Down
9 changes: 5 additions & 4 deletions vagrant/configs/nginx-vhost
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ server {

index index.php index.html;

if (!-d $request_filename) {
rewrite ^/(.+)/$ $scheme://$http_host/$1 permanent;
}
#if (!-d $request_filename) {
# rewrite ^/(.+)/$ $scheme://$http_host/$1 permanent;
#}

location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
#try_files $uri $uri/ /index.php?q=$uri&$args;
index index.php index.html index.htm;
}

error_page 404 /index.php;
Expand Down
18 changes: 18 additions & 0 deletions vagrant/configs/nginx/phpmyadmin
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
root /usr/share/;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
include /etc/nginx/fastcgi_params;
}
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
}
location /pma {
rewrite ^/* /phpmyadmin last;
}
2 changes: 2 additions & 0 deletions vagrant/provision.sh → vagrant/provision.full.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ ${SCRIPTS}/ruby.sh

${SCRIPTS}/${DATABASE_TYPE}.sh $DATABASE_ROOT_PASSWORD

${SCRIPTS}/phpmyadmin.sh $DATABASE_ROOT_PASSWORD

${SCRIPTS}/sqlite.sh

${SCRIPTS}/redis.sh
Expand Down
73 changes: 73 additions & 0 deletions vagrant/provision.medium.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/usr/bin/env bash

SCRIPTS=/vagrant/vagrant/scripts
PROJECT_PATH=/vagrant

ENV_NAME=$1
DATABASE_TYPE=$2
DATABASE_ROOT_PASSWORD=$3
DATABASE_NAME=$4

echo "--- Setting up system ---"

${SCRIPTS}/init.sh $ENV_NAME

${SCRIPTS}/php.sh

# web server MUST be installed immediately after PHP
${SCRIPTS}/nginx.sh

${SCRIPTS}/documentroot.sh

${SCRIPTS}/memcached.sh

${SCRIPTS}/ruby.sh

${SCRIPTS}/${DATABASE_TYPE}.sh $DATABASE_ROOT_PASSWORD

${SCRIPTS}/phpmyadmin.sh $DATABASE_ROOT_PASSWORD

${SCRIPTS}/sqlite.sh

${SCRIPTS}/redis.sh

${SCRIPTS}/mongodb.sh

${SCRIPTS}/nodejs.sh

${SCRIPTS}/bower.sh

${SCRIPTS}/gulp.sh
${SCRIPTS}/gulp-autoprefixer.sh

${SCRIPTS}/less.sh

${SCRIPTS}/imagick.sh

${SCRIPTS}/xdebug.sh

${SCRIPTS}/phpunit.sh

${SCRIPTS}/composer.sh

${SCRIPTS}/beanstalkd.sh

if [ -n "$DATABASE_NAME" ];
then
${SCRIPTS}/${DATABASE_TYPE}_createdb.sh $DATABASE_NAME $DATABASE_ROOT_PASSWORD
fi

# We assume that if there is no composer.json it is raw new project
# Otherwise project already exists and we need to migrate it

if [ ! -a "/vagrant/composer.json" ];
then
${SCRIPTS}/laravel_create.sh $PROJECT_PATH $ENV_NAME
if [ -n "$DATABASE_NAME" ];
then
${SCRIPTS}/laravel_set_db.sh $PROJECT_PATH $ENV_NAME $DATABASE_TYPE $DATABASE_NAME $DATABASE_ROOT_PASSWORD
fi
${SCRIPTS}/laravel_setup.sh $PROJECT_PATH $ENV_NAME
else
${SCRIPTS}/laravel_migrate.sh $PROJECT_PATH $ENV_NAME
fi
31 changes: 31 additions & 0 deletions vagrant/provision.small.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash

SCRIPTS=/vagrant/vagrant/scripts
PROJECT_PATH=/vagrant

ENV_NAME=$1
DATABASE_TYPE=$2
DATABASE_ROOT_PASSWORD=$3
DATABASE_NAME=$4

echo "--- Setting up system ---"

${SCRIPTS}/init.sh $ENV_NAME

${SCRIPTS}/php.sh

# web server MUST be installed immediately after PHP
${SCRIPTS}/nginx.sh

${SCRIPTS}/documentroot.sh

${SCRIPTS}/${DATABASE_TYPE}.sh $DATABASE_ROOT_PASSWORD

${SCRIPTS}/phpmyadmin.sh $DATABASE_ROOT_PASSWORD

${SCRIPTS}/composer.sh

if [ -n "$DATABASE_NAME" ];
then
${SCRIPTS}/${DATABASE_TYPE}_createdb.sh $DATABASE_NAME $DATABASE_ROOT_PASSWORD
fi
35 changes: 35 additions & 0 deletions vagrant/scripts/phpmyadmin.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash

echo "--- Instaling PhpMyAdmin ---"

MYSQL_PASSWORD=$1

sudo debconf-set-selections <<< "phpmyadmin phpmyadmin/dbconfig-install boolean true"
sudo debconf-set-selections <<< "phpmyadmin phpmyadmin/app-password-confirm password ${MYSQL_PASSWORD}"
sudo debconf-set-selections <<< "phpmyadmin phpmyadmin/mysql/admin-pass password ${MYSQL_PASSWORD}"
sudo debconf-set-selections <<< "phpmyadmin phpmyadmin/mysql/app-pass password ${MYSQL_PASSWORD}"
sudo debconf-set-selections <<< "phpmyadmin phpmyadmin/reconfigure-webserver multiselect none"

sudo apt-get install -y phpmyadmin

# Patch nginx config

REPLACE_ANCHOR='#place-more-options-here'
PHPMYADMIN_NG_CONFIG='include \/etc\/nginx\/phpmyadmin;'
REPLACE_STR=$PHPMYADMIN_NG_CONFIG"\n"$REPLACE_ANCHOR

sudo cp /vagrant/vagrant/configs/nginx/phpmyadmin /etc/nginx/phpmyadmin
sudo sed -i "s/$REPLACE_ANCHOR/$REPLACE_STR/" /etc/nginx/sites-available/default

# Patch phpmyadmin config
# 1 - respect localhost:8080/phpmyadmin
# 2 - skipp login page

REPLACE_ANCHOR="\$cfg\['Servers'\]\[\$i\]\['auth_type'\] = 'cookie';"
REPLACE_STR="\$cfg['Servers'][\$i]['auth_type'] = 'config';\n\$cfg['Servers'][\$i]['user'] = 'root';\n\$cfg['Servers'][\$i]['password'] = '${MYSQL_PASSWORD}';"

sudo sed -i "s/$REPLACE_ANCHOR/$REPLACE_STR/" /etc/phpmyadmin/config.inc.php

echo "\$cfg['PmaAbsoluteUri'] = 'http://localhost:8080/phpmyadmin/';" >> /etc/phpmyadmin/config.inc.php

sudo service nginx restart