4.5 KiB
Installation
Cachet is an open source replacement to StatusPage.io written in PHP and the Laravel framework.
You need at least PHP, Composer and the php-mcrypt
extension installed to run Cachet.
Table of contents
Get a copy!
If you want to run Cachet locally or help develop then you'll want to use this method.
The easiest way is to use Git to pull down the code. You'll need to put it into your web server directory for Apache & Nginx.
$ cd /var/www
$ git clone https://github.com/jbrooksuk/Cachet.git
$ cd Cachet
$ composer install
Deploy to Heroku
When using the Deploy to Heroku button you needn't worry about using a database as the install will setup a free instance of ClearDB. Once installed Heroku can direct you to the setup page where you'll configure the site/application information and create an administrator account.
Configuring a database without Heroku
Cachet relies on a database to store the components and incidents, however it needs to be configured for your environment.
Our database configuration (./app/config/database.php
) is setup to require the following environment variables:
DB_DRIVER
-sqlite
,mysql
,pgsql
orsqlsrv
.DB_HOST
DB_DATABASE
- SQLite file within theapp/database
directory or database name.DB_USERNAME
DB_PASSWORD
Laravel uses PDO for its database driver so it should be compatible with:
- SQLite
- MySQL
- Postgresql
- MSSQL
No .sqlite
file is included, so be sure to add this into your app/database
directory.
Laravel 4 enables you to protect your sensitive configuration details with the use of .env files. For your production environment, create a .env.php
file in the root of your project, or for environment specific create the file named .env.environment.php
.
For example, if working locally with MySQL, your .env.local.php
file would be:
<?php
return [
'DB_DRIVER' => 'mysql',
'DB_HOST' => 'localhost',
'DB_DATABASE' => 'cachet',
'DB_USERNAME' => 'root',
'DB_PASSWORD' => 'secret',
];
?>
Even though SQLite doesn't require a host, username or password, these still must be set (an empty string will suffice).
Running database migrations
Once we've decided on our database, we now need to run the migrations to create the tables. In our command line we need to run the migrations, from within the root directory:
$ php artisan migrate
You should see the output of the current project migration files being migrated to your database.
Seeding
If you're getting Cachet setup to develop on, then you may want to seed the database with some example data.
$ php artisan db:seed
Running Cachet
Apache
Apache is one of the easier installations. We simply need to create a new Virtual Host and add it to our HOSTS
file.
We simply add the following Virtual Host to our httpd-vhosts.conf
file:
<VirtualHost *:80>
ServerName cachet.dev # Or whatever you want to use
ServerAlias cachet.dev # Make this the same as ServerName
DocumentRoot "/var/www/Cachet/public"
<Directory "/var/www/Cachet/public">
Require all granted # Used by Apache 2.4
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Next we add a lookup on our HOSTS
file (if we're not serving Cachet externally). So open up /etc/hosts
or on Windows it'll be C:\Windows\System32\drivers\etc\hosts
and add this line:
127.0.0.1 cachet.dev
Restart Apache and you're done!
nginx
TODO.
Environment Detection
If you're deploying into production you'll want to create an environmental variable as ENV=production
. In the instance where the variable isn't defined, Cachet will think that it's local
.
Security
After deploying to a server that isn't Heroku you should run php artisan key:generate
before setting Cachet up. This changes the application key (found in /app/config/app.php
) which is used for encryption.