1
1
mirror of https://github.com/aelve/guide.git synced 2025-01-03 11:02:24 +03:00

[INSTALL] Update for Stack

This commit is contained in:
Artyom 2016-08-25 17:05:29 +03:00
parent 4dad1acbef
commit 1f714610eb

View File

@ -5,7 +5,7 @@ The `state/` directory contains the database. You can download the current datab
$ git clone https://github.com/aelve/guide-database $ git clone https://github.com/aelve/guide-database
$ mv guide-database state $ mv guide-database state
The `config.json` file contains the config (it will be created at the 1st start). There are 4 settings so far: The `config.json` file contains the config (it will be created at the 1st start). There are 5 settings so far:
* `admin-password` is the password for the admin panel (at `/admin`). Leave it empty if you don't want any password. * `admin-password` is the password for the admin panel (at `/admin`). Leave it empty if you don't want any password.
@ -15,11 +15,12 @@ The `config.json` file contains the config (it will be created at the 1st start)
* `prerender` enables prerendering pages when the server starts. By default it's disabled (because it's annoying during development). * `prerender` enables prerendering pages when the server starts. By default it's disabled (because it's annoying during development).
* `discuss-url` adds a “discuss this site” link under the header. You can leave it as `null`.
# How to install locally # How to install locally
$ cabal install --only-dependencies $ stack build
$ cabal build $ stack exec guide
$ dist/build/guide/guide
And go to <http://localhost:8080>. The status page is available at <http://localhost:5050>; the admin page, at <http://localhost:8080/admin>. And go to <http://localhost:8080>. The status page is available at <http://localhost:5050>; the admin page, at <http://localhost:8080/admin>.
@ -27,25 +28,15 @@ And go to <http://localhost:8080>. The status page is available at <http://local
I'm going to use Digitalocean and Ubuntu, but you can use anything else. I'm going to use Digitalocean and Ubuntu, but you can use anything else.
Create a droplet with Ubuntu. Install GHC: Create a droplet with Ubuntu. Install Stack (this command will import a GPG key, add Stack's repository, and run `apt-get`):
$ add-apt-repository ppa:hvr/ghc $ curl -sSL https://get.haskellstack.org/ | sh
$ apt-get update
$ apt-get install ghc-7.10.3 cabal-install-1.22
Add cabal-install, GHC, and the cabal dir to `PATH` by adding
/opt/cabal/1.22/bin:/opt/ghc/7.10.3/bin:$HOME/.cabal/bin
to `PATH` in `~/.bashrc` and then doing `source ~/.bashrc`.
Clone and build `guide`: Clone and build `guide`:
$ git clone https://github.com/aelve/guide $ git clone https://github.com/aelve/guide
$ cd guide $ cd guide
$ cabal update $ stack build --no-test --no-bench --copy-bins
$ cabal install --dependencies-only
$ cabal build
Make a new subdomain in Apache. For me, it means writing this to `/etc/apache2/sites-available/guide.conf`: Make a new subdomain in Apache. For me, it means writing this to `/etc/apache2/sites-available/guide.conf`:
@ -91,7 +82,7 @@ start on filesystem or runlevel [2345]
stop on runlevel [!2345] stop on runlevel [!2345]
chdir /root/guide chdir /root/guide
env LC_ALL=en_US.UTF-8 env LC_ALL=en_US.UTF-8
exec dist/build/guide/guide exec /root/.local/bin/guide
~~~ ~~~
Start the daemon: Start the daemon: