Total Pageviews

Monday 15 August 2016

一个基于haskell+mysql的博客程序:haskell-blog


This repository contains my attempt to create site using Haskell and Snap framework.
I'm novice to Haskell so use code at your own risk.

PREREQUISITES

  1. Haskell Platform http://www.haskell.org/platform/. I'm using 2012.1.0.0 from Ubuntu 12.04 repositoty.
  2. Node.js and less compiler http://lesscss.org/
  3. Closure linter https://developers.google.com/closure/utilities/docs/linter_howto
  4. Java and Python for Google Closure Compiler.
  5. MySQL database

BUILD PROJECT

To build project you need these steps:
  1. Checkout repository
  2. Import schema from schema.sql into your database
  3. Configure database access in src/Config.hs
  4. Setup cabal if you didn't do that earlier: cabal update and cabal install cabal-install
  5. Install project dependencies cabal install --only-dependencies. This step may require installation of dev-versions of some libraries (libcurl4-dev, etc.). For Ubuntu you can use this command: sudo apt-get install libcurl4-openssl-dev libmysqlclient-dev.
  6. In project root run cabal configure and cabal build
  7. The build all required js and css files by running ./build_debug.sh
  8. Create empty file config/site_key.txttouch config/site_key.txt
  9. Start server dist/build/haskell-blog/haskell-blog
That's all.
In development mode Snap framework dynamically rebuild source so all you have to do is refresh page in browser. And Google Closure Library doesn't require building in development mode. Using uncompressed less files is not yet supported. You have to rebuild them manually by running ./build_styles.js
Please let me know if I've missed something.

BUILD FOR PRODUCTION

  1. Checkout production branch.
  2. Comment out rcp command in ./build.sh
  3. Configure variables (see below)
  4. Run ./build.sh
You'll find haskell-blog.tar.lzma in project root. It will contain all required files for running project.

CONFIGURING

There is src/Config.hs which contains configuration of your environment.
  1. adminLoginadminPassword --- credentials for accessing vault.
  2. rackspaceAuthKeyrackspaceAuthUser --- you don't plan to use Rackspace CloudFiles you can skip it
  3. disqusApiKey --- disqus key for syncing comments.

from https://github.com/dikmax/haskell-blog