-
Notifications
You must be signed in to change notification settings - Fork 0
/
compositor.json
138 lines (138 loc) · 11.2 KB
/
compositor.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
{
"name": "code-orange/statuspage",
"version": "0.1.4",
"libraries": {
"xv": "^1.1.25"
},
"title": "Statuspage",
"branch": "master",
"style": {
"name": "Default",
"componentSet": {
"nav": "nav/BasicNav",
"header": "header/BannerHeader",
"article": "article/BasicArticle",
"footer": "footer/BasicFooter"
},
"fontFamily": "-apple-system, BlinkMacSystemFont, sans-serif",
"fontWeight": 400,
"bold": 600,
"lineHeight": 1.5,
"typeScale": [
72,
48,
24,
20,
16,
14,
12
],
"monospace": "Menlo, monospace",
"heading": {
"fontFamily": null,
"fontStyle": null,
"fontWeight": 600,
"lineHeight": 1.25,
"textTransform": null,
"letterSpacing": null
},
"h0": {},
"h1": {},
"h2": {},
"h3": {},
"h4": {},
"h5": {},
"h6": {},
"alternativeText": {},
"space": [
0,
8,
16,
32,
48,
64,
96
],
"layout": {
"maxWidth": 1024,
"centered": false
},
"colors": {
"text": "#111",
"background": "#fff",
"primary": "#08e",
"secondary": "#059",
"highlight": "#e08",
"border": "#ddd",
"muted": "#eee"
},
"border": {
"width": 1,
"radius": 2
},
"link": {},
"button": {
"hover": {
"boxShadow": "inset 0 0 0 999px rgba(0, 0, 0, .125)"
}
},
"input": {},
"body": {
"margin": 0
},
"breakpoints": {
"xs": "@media screen and (max-width:40em)",
"sm": "@media screen and (min-width:40em)",
"md": "@media screen and (min-width:52em)",
"lg": "@media screen and (min-width:64em)"
}
},
"content": [
{
"component": "nav",
"links": [
{
"href": "https://github.com/code-orange/statuspage",
"text": "GitHub"
}
]
},
{
"component": "header",
"heading": "statuspage",
"subhead": "Statuspage is a Lumen package that allows you to easily add a status page to an existing Lumen application or to create a dedicated Lumen status application.",
"children": [
{
"component": "ui/TweetButton",
"text": "statuspage: Statuspage is a Lumen package that allows you to easily add a status page to an existing Lumen application or to create a dedicated Lumen status application.",
"url": null
},
{
"component": "ui/GithubButton",
"user": "code-orange",
"repo": "statuspage"
}
]
},
{
"component": "article",
"metadata": {
"source": "github.readme"
},
"html": "<h1>Statuspage <a href=\"https://packagist.org/packages/code-orange/statuspage\"><img src=\"https://poser.pugx.org/code-orange/statuspage/v/stable\"></a> <a href=\"https://packagist.org/packages/code-orange/statuspage\"><img src=\"https://poser.pugx.org/code-orange/statuspage/downloads\"></a> <a href=\"https://packagist.org/packages/code-orange/statuspage\"><img src=\"https://poser.pugx.org/code-orange/statuspage/license\"></a> <a href=\"https://packagist.org/packages/code-orange/statuspage\"><img src=\"https://poser.pugx.org/code-orange/statuspage/composerlock\"></a></h1>\n\n<p><a href=\"https://status.odysseyattribution.co\"><img src=\"demo.png\"></a>\n<em>Live demo of Statuspage. This installation is a dedicated Lumen app monitoring a bigger Laravel app.</em></p>\n<h2>Installation</h2>\n<pre><span class=\"hljs-symbol\">composer</span> <span class=\"hljs-meta\">require</span> <span class=\"hljs-meta\">code</span>-orange/statuspage</pre><h2>Configuration</h2>\n<p>First, register the Statuspage <code>ServiceProvider</code> in your <code>bootstrap/app.php</code>:</p>\n<pre>$app->register(CodeOrange\\Statuspage\\StatuspageProvider::<span class=\"hljs-class\"><span class=\"hljs-keyword\">class</span>);</span></pre><p>By default, Statuspage will register the status page at <code>/</code> and a JSON version of it on <code>/json</code>.\nIf you want to override this behaviour, you can set the <code>STATUSPAGE_ROUTE</code> environment variable.\nIf your route doesn't end in a slash, the JSON version will be hosted at <code>/{$route}.json</code>.</p>\n<p>Statuspage comes with a default HTML page that displays the status of all registered checks.\nIf you'd like to make changes to this page, you should copy the view (from <code>vendor/code-orange/statuspage/src/views/</code>) to your own views folder.\nYou can then set the view you would like Statuspage to render with <code>STATUSPAGE_VIEW</code>.</p>\n<p>For the header on the status page, Statuspage will normally use your <code>APP_NAME</code> or <code>config('app.name')</code> followed by the word 'status'.\nIf you want to use something different, you can set the <code>STATUSPAGE_HEADER</code> environment variable.\nIf this variable is set, the page header will be filled with its contents instead of the application name.\nThe environment variable can contain HTML.</p>\n<p>All environment variables are optional.</p>\n<pre><span class=\"hljs-meta\">#STATUSPAGE_ROUTE=/</span>\n<span class=\"hljs-meta\">#STATUSPAGE_VIEW=status</span>\n<span class=\"hljs-meta\">#STATUSPAGE_HEADER="<img src='https://odysseyattribution.co/logo.svg' style='height: 1.5em; vertical-align: middle;'> status"</span></pre><h2>Usage</h2>\n<h2>Registering checks</h2>\n<p>Statuspage works by registering <code>StatusChecks</code> (either alone or in sections) with <code>Statuspage</code>.\nWe recommend doing this in the <code>boot</code> method of your <code>AppServiceProvider</code>.</p>\n<p><code>Statuspage</code> exposes two relevant methods.</p>\n<ul>\n<li><code>registerCheck($label, $check)</code> allows you to register a single check with a label to the status page.</li>\n<li><code>registerSection($label, ['Label' => $check, 'Label 2' => $check2])</code> allows you to register a section with a title and multiple checks to the status page.</li>\n</ul>\n<p>For example:</p>\n<pre><span class=\"hljs-class\"><span class=\"hljs-keyword\">class</span> <span class=\"hljs-title\">AppServiceProvider</span> <span class=\"hljs-keyword\">extends</span> <span class=\"hljs-title\">ServiceProvider</span> </span>{\n <span class=\"hljs-keyword\">public</span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">boot</span><span class=\"hljs-params\">(Statuspage $statuspage)</span> </span>{\n $statuspage->registerCheck(<span class=\"hljs-string\">'Code Orange'</span>, <span class=\"hljs-keyword\">new</span> Http200Check(<span class=\"hljs-string\">'https://code-orange.nl'</span>));\n\n $statuspage->registerSection(<span class=\"hljs-string\">'Google'</span>, [\n <span class=\"hljs-string\">'Google 200'</span> => <span class=\"hljs-keyword\">new</span> Http200Check(<span class=\"hljs-string\">'https://www.google.nl'</span>),\n <span class=\"hljs-string\">'Google without www 200 (should fail)'</span> => <span class=\"hljs-keyword\">new</span> Http200Check(<span class=\"hljs-string\">'https://google.nl'</span>),\n <span class=\"hljs-string\">'Google without www 301'</span> => <span class=\"hljs-keyword\">new</span> Http200Check(<span class=\"hljs-string\">'https://google.nl'</span>, <span class=\"hljs-number\">301</span>)\n ]);\n\n $statuspage->registerSection(<span class=\"hljs-string\">'Database'</span>, [\n <span class=\"hljs-string\">'Connection'</span> => <span class=\"hljs-keyword\">new</span> DatabaseConnectionCheck(),\n <span class=\"hljs-string\">'Non-existing connection'</span> => <span class=\"hljs-keyword\">new</span> DatabaseConnectionCheck(<span class=\"hljs-string\">'asdf'</span>)\n ]);\n\n $statuspage->registerCheck(<span class=\"hljs-string\">'Dummy succesful'</span>, <span class=\"hljs-keyword\">new</span> DummyCheck(Status::$OPERATIONAL));\n\n $statuspage->registerSection(<span class=\"hljs-string\">'Color check'</span>, [\n <span class=\"hljs-string\">'Operational'</span> => <span class=\"hljs-keyword\">new</span> DummyCheck(Status::$OPERATIONAL),\n <span class=\"hljs-string\">'Maintenance'</span> => <span class=\"hljs-keyword\">new</span> DummyCheck(Status::$MAINTENANCE),\n <span class=\"hljs-string\">'Degraded'</span> => <span class=\"hljs-keyword\">new</span> DummyCheck(Status::$DEGRADED),\n <span class=\"hljs-string\">'Partial outage'</span> => <span class=\"hljs-keyword\">new</span> DummyCheck(Status::$PARTIAL_OUTAGE),\n <span class=\"hljs-string\">'Major outage'</span> => <span class=\"hljs-keyword\">new</span> DummyCheck(Status::$MAJOR_OUTAGE),\n ]);\n }\n}</pre><h2>Writing your own checks</h2>\n<p>While Statuspage comes with a number of basic but useful checks, the real power is in the fact that you can easily define your own custom checks specific to your application.</p>\n<p>To do this, simply start by subclassing <code>CodeOrange\\Statuspage\\Checks\\StatusCheck</code>.\nA check usually takes some arguments in its constructor and executes when its <code>performCheck</code> method is called.\nA check always returns an instance of <code>CodeOrange\\Statuspage\\Status</code>, optionally with a message.</p>\n<h3>Background checking</h3>\n<p>By default, Statuspage executes all checks whenever the page is requested.\nWhile this is fine in a small-scale or development setting, it's probably not something you want in production.</p>\n<p>To configure Statuspage to instead perform the registered checks in the background, add the following line to your <code>Kernel</code>'s schedule function:</p>\n<pre><span class=\"hljs-class\"><span class=\"hljs-keyword\">class</span> <span class=\"hljs-title\">Kernel</span> <span class=\"hljs-keyword\">extends</span> <span class=\"hljs-title\">ConsoleKernel</span> </span>{\n <span class=\"hljs-keyword\">protected</span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">schedule</span><span class=\"hljs-params\">(Schedule $schedule)</span> </span>{\n app(Statuspage::class)->scheduleBackgroundExecution($schedule);\n }\n}</pre><p>The registered checks will be executed every minute (make sure <code>php artisan schedule:run</code> <a href=\"https://laravel.com/docs/5.5/scheduling#introduction\">is properly configured in your crontab</a>).</p>\n<p>The results of your checks are stored in the default cache store (with key <code>statuspage_status</code>).</p>\n<h2>Known issues</h2>\n<ul>\n<li>The framework doesn't (yet) deal with long-running checks. You are responsible for managing the run-time of your checks and setting timeouts.</li>\n</ul>\n"
},
{
"component": "footer",
"links": [
{
"href": "https://github.com/code-orange/statuspage",
"text": "GitHub"
},
{
"href": "https://github.com/code-orange",
"text": "code-orange"
}
]
}
]
}