1
1
mirror of https://github.com/aelve/guide.git synced 2024-11-30 01:23:04 +03:00

Write about the status page

This commit is contained in:
Artyom 2016-03-14 22:13:57 +03:00
parent 4d579832a3
commit ddb4182603
2 changed files with 18 additions and 1 deletions

View File

@ -4,7 +4,7 @@
$ cabal build $ cabal build
$ dist/build/guide/guide $ dist/build/guide/guide
And go to <http://localhost:8080>. And go to <http://localhost:8080>. The status page is available at <http://localhost:5050>.
The `state/` directory contains the database. You can download the current database of [guide.aelve.com](http://guide.aelve.com) by doing this: The `state/` directory contains the database. You can download the current database of [guide.aelve.com](http://guide.aelve.com) by doing this:
@ -51,6 +51,22 @@ Make a new subdomain in Apache. For me, it means writing this to `/etc/apache2/s
</VirtualHost> </VirtualHost>
~~~ ~~~
If you want the status page to be available as well, write:
~~~
<VirtualHost *:80>
ServerName guide.aelve.com
ProxyPreserveHost On
ProxyPass /status/ http://0.0.0.0:5050/
ProxyPassReverse /status/ http://0.0.0.0:5050/
ProxyPass / http://0.0.0.0:8080/
ProxyPassReverse / http://0.0.0.0:8080/
</VirtualHost>
~~~
(Note that it will only be available at `/status/`, not `/status`.)
Enable the site: Enable the site:
$ a2ensite guide $ a2ensite guide

View File

@ -268,6 +268,7 @@ main = do
globalState <- Acid.query db GetGlobalState globalState <- Acid.query db GetGlobalState
let allCategories = globalState^.categories let allCategories = globalState^.categories
let allItems = allCategories^.each.items let allItems = allCategories^.each.items
-- Count length of all Text values in global state
let textLength = sum (map T.length (childrenBi globalState)) let textLength = sum (map T.length (childrenBi globalState))
EKG.Gauge.set categoryGauge (fromIntegral (length allCategories)) EKG.Gauge.set categoryGauge (fromIntegral (length allCategories))
EKG.Gauge.set itemGauge (fromIntegral (length allItems)) EKG.Gauge.set itemGauge (fromIntegral (length allItems))