From 957f81f73082f7d8ea7029d425d8ca78dbf79337 Mon Sep 17 00:00:00 2001 From: James Brooks Date: Thu, 20 Nov 2014 19:29:06 +0000 Subject: [PATCH] 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'; +}); /* |--------------------------------------------------------------------------