系统状态监控程序-Cachet

Cachet is a beautiful and powerful open source status page system.

cachethq.io

Overview

  • List your service components
  • Report incidents
  • Customise the look of your status page
  • Markdown support for incident messages
  • A powerful JSON API
  • Metrics
  • Multi-lingual
  • Subscriber notifications via email
  • Two factor authentication

Community

You can now join our Slack community!

Requirements

  • PHP 7.1.3 – 7.3
  • HTTP server with PHP support (e.g.: Apache, Nginx, Caddy)
  • Composer
  • A supported database: MySQL, PostgreSQL or SQLite

Installation, Upgrades and Documentation

You can find documentation at https://docs.cachethq.io.

Here are some useful quick links:

Demo

To test out the demo, you can log in to the Dashboard with the following credentials:

  • Username: test or test@example.com
  • Password: test123

The demo resets every 30 minutes.

Translate Cachet

If you'd like to contribute translations, please check out our Crowdin project.

Security Vulnerabilities

If you discover a security vulnerability within Cachet, please send an e-mail to support@cachethq.io. All security vulnerabilities are reviewed on a case-by-case basis.

Limited Support Contact

We may be able to resolve support queries via email. Please send an email to support@cachethq.io. Please check the GitHub issue tracker first before emailing.

from 

https://github.com/CachetHQ/Cachet

-------------------------------------------------

Installing Cachet

Cachet is constantly evolving therefore, we advise you to always download and use the latest tagged release.

Warning!

Using a non-tagged release or the master branch may result in an unstable or broken environment.

Download the source code with Git:

Check out the latest version!

The tags below are examples of what will be shown. You should always run git checkout on the latest tag.

$ cd /var/www # Or wherever you chose to install web applications to
$ git clone https://github.com/cachethq/Cachet.git
$ cd Cachet
$ git tag -l

v0.1.0-alpha
v1.0.0
v1.1.0
v2.0.0
v2.1.0

$ git checkout v2.1.0

 

Configuring a database

By default Cachet comes with a .env.example file. You'll need to rename this file to just .env regardless of what environment you're working on.

It's now just a case of editing this new .env file and setting the values of your setup.

Environment Configuration Notice

Any values with spaces in them should be contained within double quotes.

APP_ENV=production
APP_DEBUG=false
APP_URL=http://localhost
APP_KEY=SomeRandomString

DB_DRIVER=mysql
DB_HOST=localhost
DB_DATABASE=cachet
DB_USERNAME=homestead
DB_PASSWORD=secret
DB_PORT=null

CACHE_DRIVER=apc
SESSION_DRIVER=apc
QUEUE_DRIVER=sync
CACHET_EMOJI=false

MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ADDRESS=null
MAIL_NAME="Demo Status Page"
MAIL_ENCRYPTION=tls

REDIS_HOST=null
REDIS_DATABASE=null
REDIS_PORT=null

GITHUB_TOKEN=null

SQLite hosts

If you're using SQLite then your .env file should not contain a DB_HOST key. You'll also need to touch ./database/database.sqlite and give it the required permissions.

Install Composer:

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

$ composer install --no-dev -o

Struggling with Composer?

If you're stuck at the Composer stage, you can run composer install --no-dev -o --no-scripts which usually fixes any issues on Windows servers.

Set the application key.

Before going any further, we need to set the APP_KEY config. This is used for all encryption used in Cachet.

$ php artisan key:generate

Be sure that you have the right permissions to .env before running this command.

Using the install command.

Cachet comes with an installation command that will:

  • Run migrations
  • Run seeders (of which there are none)
$ php artisan app:install

Never change the APP_KEY after installation on production environment. This will result in all of your encrypted/hashed data being lost.

Getting a 500 - Internal Server Error?

If you get a 500 error when visiting your status page, you may need to run chmod -R 777 storage for it to work or rm -rf bootstrap/cache/*

You can also try to give permissions to cache chmod -R 777 bootstrap/

Running Cachet on Apache

Required Apache Modules

You need to enable mod_rewrite for Apache. On Debian-based systems you can do this by:

a2enmod rewrite

Once Cachet is setup, the Apache installation is as simple as creating a new Virtual Host entry in the 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>

Restart Apache by running the following:

$ sudo service apache2 restart

If you also need HTTPS on apache you will need to get the ssl mod installed and the default ssl conf file enabled. See DigitalOcean's documentation.

Running Cachet on nginx
  • You'll need to install php5-fpm - DigitalOcean has a nice LEMP installation tutorial
  • Generate your SSL key+certificate
  • Create a new vhost such as /etc/nginx/sites-enabled/cachet.conf:

# Upstream to abstract backend connection(s) for php
upstream php {
    server unix:/tmp/php-cgi.socket;
    server 127.0.0.1:9000;
}

server {
    server_name  cachet.mycompany.com; # Or whatever you want to use
    listen 80 default;
    rewrite ^(.*) https://cachet.mycompany.com$1 permanent;
}

# HTTPS server

server {
    listen 443;
    server_name cachet.mycompany.com;

    root /var/vhost/cachet.mycompany.com/public;
    index index.php;

    ssl on;
    ssl_certificate /etc/ssl/crt/cachet.mycompany.com.crt; # Or wherever your crt is
    ssl_certificate_key /etc/ssl/key/cachet.mycompany.com.key; # Or wherever your key is
    ssl_session_timeout 5m;

    # Best practice as at March 2014
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;
    ssl_ciphers "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA";
    ssl_buffer_size 1400; # 1400 bytes, within MTU - because we generally have small responses. Could increase to 4k, but default 16k is too big

    location / {
        add_header Strict-Transport-Security max-age=15768000;
        try_files $uri /index.php$is_args$args;
    }

    location ~ \.php$ {
                include fastcgi_params;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_index index.php;
                fastcgi_keep_conn on;
                add_header Strict-Transport-Security max-age=15768000;
    }
}

Start php5-fpm and nginx and you're done!

from 

https://docs.cachethq.io/docs/installing-cachet

------------------------------------------------------

https://briteming.hatenablog.com/entry/2023/05/03/175041