From 957f81f73082f7d8ea7029d425d8ca78dbf79337 Mon Sep 17 00:00:00 2001 From: James Brooks Date: Thu, 20 Nov 2014 19:29:06 +0000 Subject: [PATCH 1/4] Having a quick go with Heroku buttons! --- Procfile | 1 + README.md | 2 ++ app.json | 14 ++++++++++++++ app/config/heroku/database.php | 20 ++++++++++++++++++++ bootstrap/start.php | 12 ++++++++---- 5 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 Procfile create mode 100644 app.json create mode 100644 app/config/heroku/database.php diff --git a/Procfile b/Procfile new file mode 100644 index 00000000..0e26515a --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: vendor/bin/heroku-php-apache2 public diff --git a/README.md b/README.md index f2a6b213..b1e2c330 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Cachet +[![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy) + Cachet is an open source PHP status page system using the Laravel framework. For more information on why I started developing Cachet, check out my [blog post](http://james-brooks.uk/cachet/?utm_source=github&utm_medium=readme&utm_campaign=github-cachet). diff --git a/app.json b/app.json new file mode 100644 index 00000000..d18825d9 --- /dev/null +++ b/app.json @@ -0,0 +1,14 @@ +{ + "name": "Cachet", + "description": "Single-site Status Page with Laravel", + "website": "http://james-brooks.uk/cachet", + "repository": "https://github.com/jbrooksuk/Cachet", + "keywords": ["cachet", "laravel", "status", "page"], + "addons": ["cleardb"], + "env": { + "ENV": "heroku" + }, + "scripts": { + "postdeploy": "php artisan migrate" + } +} diff --git a/app/config/heroku/database.php b/app/config/heroku/database.php new file mode 100644 index 00000000..770c580c --- /dev/null +++ b/app/config/heroku/database.php @@ -0,0 +1,20 @@ + 'cleardb', + 'connections' => array( + 'cleardb' => array( + 'driver' => 'mysql', + 'host' => $dbURL['host'], + 'database' => $dbName, + 'username' => $dbURL['user'], + 'password' => $dbURL['pass'], + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + ), + ) + ); diff --git a/bootstrap/start.php b/bootstrap/start.php index 42307d88..7ee494d7 100644 --- a/bootstrap/start.php +++ b/bootstrap/start.php @@ -24,11 +24,15 @@ $app = new Illuminate\Foundation\Application; | */ -$env = $app->detectEnvironment(array( +$env = $app->detectEnvironment(function() { + // Take care of Heroku deployment for us. + if ($envName = getenv('ENV')) { + return $envName; + } - 'local' => array('homestead', '*.local', '*.config', 'jbrooksuk'), - -)); + // Always fall back to local. + return 'local'; +}); /* |-------------------------------------------------------------------------- From b24c7da95235d04268ea7bba46bb26d76edd185d Mon Sep 17 00:00:00 2001 From: James Brooks Date: Thu, 20 Nov 2014 19:31:06 +0000 Subject: [PATCH 2/4] Fix parse_url function --- app/config/heroku/database.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/config/heroku/database.php b/app/config/heroku/database.php index 770c580c..7bfb5409 100644 --- a/app/config/heroku/database.php +++ b/app/config/heroku/database.php @@ -1,6 +1,6 @@ Date: Thu, 20 Nov 2014 19:32:29 +0000 Subject: [PATCH 3/4] Fix the tinyInteger default value on MySQL --- .../migrations/2014_11_16_224719_CreateIncidentsTable.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/database/migrations/2014_11_16_224719_CreateIncidentsTable.php b/app/database/migrations/2014_11_16_224719_CreateIncidentsTable.php index cac269db..31b9e998 100644 --- a/app/database/migrations/2014_11_16_224719_CreateIncidentsTable.php +++ b/app/database/migrations/2014_11_16_224719_CreateIncidentsTable.php @@ -17,7 +17,7 @@ class CreateIncidentsTable extends Migration { $table->increments('id'); $table->tinyInteger('component')->default(1); $table->string('name'); - $table->tinyInteger('status', 1)->default(1); + $table->tinyInteger('status')->default(1); $table->longText('message'); $table->timestamps(); $table->softDeletes(); From 67cd73d50bdc4494d4add2fcfff8f85606c0c4c3 Mon Sep 17 00:00:00 2001 From: James Brooks Date: Thu, 20 Nov 2014 19:35:14 +0000 Subject: [PATCH 4/4] Set the app title with an environment var --- app.json | 3 ++- app/views/layout/master.blade.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app.json b/app.json index d18825d9..0b8410cb 100644 --- a/app.json +++ b/app.json @@ -6,7 +6,8 @@ "keywords": ["cachet", "laravel", "status", "page"], "addons": ["cleardb"], "env": { - "ENV": "heroku" + "ENV": "heroku", + "APP_NAME": "My Status Page" }, "scripts": { "postdeploy": "php artisan migrate" diff --git a/app/views/layout/master.blade.php b/app/views/layout/master.blade.php index c5cfdb87..d83b6d55 100644 --- a/app/views/layout/master.blade.php +++ b/app/views/layout/master.blade.php @@ -3,7 +3,7 @@ - {{ Setting::get('site_name') }} | Cachet + {{ getenv('APP_NAME') }} | Cachet