mirror of
https://github.com/aelve/guide.git
synced 2024-12-23 12:52:31 +03:00
Add an environment variable to enable tracking
This commit is contained in:
parent
efbd7716bb
commit
84454d2666
27
INSTALL.md
27
INSTALL.md
@ -1,3 +1,12 @@
|
||||
# Points to keep in mind
|
||||
|
||||
The `state/` directory contains the database. You can download the current database of [guide.aelve.com](http://guide.aelve.com) by doing this:
|
||||
|
||||
$ git clone https://github.com/aelve/guide-database
|
||||
$ mv guide-database state
|
||||
|
||||
If you want to enable tracking, replace the contents of `static/tracking.md` and set the environment variable `GUIDE_TRACKING=1` when running the server.
|
||||
|
||||
# How to install locally
|
||||
|
||||
$ cabal install --only-dependencies
|
||||
@ -6,11 +15,6 @@
|
||||
|
||||
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:
|
||||
|
||||
$ git clone https://github.com/aelve/guide-database
|
||||
$ mv guide-database state
|
||||
|
||||
# How to install on a server
|
||||
|
||||
I'm going to use Digitalocean and Ubuntu, but you can use anything else.
|
||||
@ -35,10 +39,6 @@ Clone and build `guide`:
|
||||
$ cabal install --dependencies-only
|
||||
$ cabal build
|
||||
|
||||
Delete the contents of `static/tracking.html` (because otherwise information about visits will be sent to me):
|
||||
|
||||
$ truncate -s 0 static/tracking.html
|
||||
|
||||
Make a new subdomain in Apache. For me, it means writing this to `/etc/apache2/sites-available/guide.conf`:
|
||||
|
||||
~~~
|
||||
@ -82,18 +82,15 @@ env LC_ALL=en_US.UTF-8
|
||||
exec dist/build/guide/guide
|
||||
~~~
|
||||
|
||||
(Also possibly `env GUIDE_TRACKING=1`.)
|
||||
|
||||
And start the daemon:
|
||||
|
||||
$ service guide start
|
||||
|
||||
## Database
|
||||
|
||||
If the `state/` directory doesn't exist, it will be created. However, you can get the current state of [guide.aelve.com](http://guide.aelve.com):
|
||||
|
||||
$ git clone https://github.com/aelve/guide-database
|
||||
$ mv guide-database state
|
||||
|
||||
You can set automatic backups to your own repository, too.
|
||||
You can set automatic backups of the database to your own repository.
|
||||
|
||||
Create `.gitignore` in the `state/` folder:
|
||||
|
||||
|
@ -169,9 +169,10 @@ renderRoot globalState mbSearchQuery = doctypehtml_ $ do
|
||||
-- TODO: when submitting a text field, gray it out (but leave it selectable)
|
||||
-- until it's been submitted
|
||||
|
||||
-- TODO: disable tracking on localhost! (and edit INSTALL.md)
|
||||
renderTracking :: HtmlT IO ()
|
||||
renderTracking = do
|
||||
trackingEnabled <- (== Just "1") <$> liftIO (lookupEnv "GUIDE_TRACKING")
|
||||
when trackingEnabled $ do
|
||||
tracking <- liftIO $ T.readFile "static/tracking.html"
|
||||
toHtmlRaw tracking
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user