From 2f5b476afac5b952870e68853d0f4e86525fa15f Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Wed, 6 Dec 2017 11:22:04 -0600 Subject: [PATCH] update Readme for install instructions and a sample prod env file --- .env.prod.example | 15 +++++++++++++++ .env.travis | 4 ++-- Makefile | 15 +++++++-------- README.md | 28 ++++++++++++++++++++++------ config/installer.php | 4 ++-- 5 files changed, 48 insertions(+), 18 deletions(-) create mode 100644 .env.prod.example diff --git a/.env.prod.example b/.env.prod.example new file mode 100644 index 00000000..2556b104 --- /dev/null +++ b/.env.prod.example @@ -0,0 +1,15 @@ +APP_ENV=prod +APP_KEY=base64:ve66Z5Kt/zTN3p++0zOPu854PHfZkwJE5VuoFAlzHtI= +APP_DEBUG=false +APP_LOG_LEVEL=info +APP_URL=http://localhost +APP_SETTINGS_STORE=json + +DB_CONNECTION=travis +DB_HOST=127.0.0.1 +DB_PORT=3306 +DB_DATABASE=phpvms +DB_USERNAME=root +DB_PASSWORD= + +CACHE_DRIVER=array diff --git a/.env.travis b/.env.travis index 5b0d26b8..c176f40a 100644 --- a/.env.travis +++ b/.env.travis @@ -1,11 +1,11 @@ -APP_ENV=testing +APP_ENV=prod APP_KEY=base64:ve66Z5Kt/zTN3p++0zOPu854PHfZkwJE5VuoFAlzHtI= APP_DEBUG=true APP_LOG_LEVEL=debug APP_URL=http://localhost APP_SETTINGS_STORE=json -DB_CONNECTION=travis +DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=phpvms diff --git a/Makefile b/Makefile index 80753121..42dea053 100644 --- a/Makefile +++ b/Makefile @@ -13,9 +13,14 @@ build: @composer install --no-interaction @php artisan config:cache +.PHONY: db +db: + @php artisan database:create --reset + @php artisan migrate:refresh --seed + .PHONY: install install: build db - echo "" + @echo "Done!" .PHONY: clean clean: @@ -32,13 +37,7 @@ clean: .PHONY: reset reset: clean - @php artisan database:create --reset - @php artisan migrate:refresh --seed - -.PHONY: db -db: - @php artisan database:create --reset - @php artisan migrate:refresh --seed + @make install .PHONY: unittest-db unittest-db: diff --git a/README.md b/README.md index fd284e64..726a5116 100755 --- a/README.md +++ b/README.md @@ -37,18 +37,33 @@ server { ## development environment -For development, copy the included `.env.example` to `.env` file. By default, it uses sqlite +For development, copy the included `.env.dev.example` to `.env` file. By default, it uses sqlite instead of mysql. This makes it much easier to be able to clear the database and new fixtures. -The default username and password are "admin@phpvms.net" and "admin". To see the available users in the development environment, [see this file](https://github.com/nabeelio/phpvms/blob/master/database/seeds/dev.yml#L10) +The easiest way to load locally is to install [Laravel Valet](https://laravel.com/docs/5.5/valet) +(if you're running a Mac). Once you install it, go to your phpvms directory, and run: -### makefile commands +```bash +cp .env.dev.example .env +php artisan key:generate +make install # this will install everything +valet link phpvms +``` + +Now going to [http://phpvms.dev](http://phpvms.dev) should work. If you want to use mysql, +follow the valet directions on installing mysql (`brew install mysql`) and then update the +`.env` file to point to the mysql. + +The default username and password are "admin@phpvms.net" and "admin". +To see the available users in the development environment, [see this file](https://github.com/nabeelio/phpvms/blob/master/database/seeds/dev.yml#L10) + +### creating/resetting the environment I use Makefiles to be able to quickly setup the environment. ```bash # to do an initial setup of the composer deps and install the DB -make +make install ``` Then to reset the database/clear cache, use: @@ -65,8 +80,9 @@ the database with the data from the `dev.yml`. ### virtual machine -Using [Laravel Homestead](https://laravel.com/docs/5.4/homestead) is probably the easiest -way to get this working. Follow their instructions for install. A `Vagrantfile` and `Homestead.yaml` +Using [Laravel Homestead](https://laravel.com/docs/5.4/homestead) is one way to get your dev +environment working if you're on Windows or don't want to install any Homebrew services +on your Mac. Follow their instructions for install. A `Vagrantfile` and `Homestead.yaml` is included here. Add this to your `/etc/hosts`: ```bash diff --git a/config/installer.php b/config/installer.php index 670fa91e..4cde564f 100644 --- a/config/installer.php +++ b/config/installer.php @@ -62,8 +62,8 @@ return [ 'environment' => 'required|string|max:50', 'environment_custom' => 'required_if:environment,other|max:50', 'app_debug' => [ - 'required', - Rule::in(['true', 'false']), + 'required|in:true,false', + //Rule::in(['true', 'false']), ], 'app_log_level' => 'required|string|max:50', 'app_url' => 'required|url',