has moved to IP address -- please double check where you are logging in.

Assassinate this repo

parent a77b8658
((haskell-mode . ((haskell-indentation-layout-offset . 4)
(haskell-indentation-starter-offset . 1)
(haskell-indentation-left-offset . 4)
(haskell-indentation-ifte-offset . 4)
(haskell-indentation-where-pre-offset . 2)
(haskell-indentation-where-post-offset . 2)
(evil-shift-width . 2)
(haskell-tags-on-save . t)))
(hamlet-mode . ((hamlet/basic-offset . 4))))
# Intellij IDEA:
# EclipseFP:
[submodule "publications"]
path = publications
url =
<?xml version="1.0" encoding="UTF-8"?>
# Building and Running Snowdrift
Snowdrift has been built successfully on GNU/Linux distributions of all sorts
and on OpenBSD and OS X.
Windows is not currently supported, but we will assist any efforts to add
such support. See below for partial setup instructions.
## Install System Dependencies
[Git], [PostgreSQL], and [Stack] are the only dependencies needed at the system
level. Stack takes care of finding or installing the correct GHC version. Some
systems need a few additional libraries to support the core dependencies.
**Follow the details for your system, then skip to the "Get the Snowdrift Code"
### Debian, Ubuntu, and any related derivatives
Install Git and PostgreSQL with needed libraries:
sudo apt-get update
sudo apt-get install git postgresql postgresql-client libgmp-dev zlib1g-dev libpq-dev libtinfo-dev
Then follow the
[Debian Stack install](
[Ubuntu Stack install](
instructions as appropriate.
### CentOS/RHEL and Fedora
Install Git and needed libraries:
sudo yum update
sudo yum install ncurses-devel gmp-devel zlib-devel git
For newer versions of Fedora, replace the `yum` commands with `dnf`. Install the
following libraries if you don't already have them:
sudo dnf install libstdc++-static gcc-c++
You'll also need PostgreSQL >= 9.3:
sudo yum install postgres-server postgres-devel
If the version in the base repositories is too old, follow the [instructions on the
PostgreSQL wiki]( to install from
their repositories. Get the postgresXX-server and postgresXX-devel packages, where
XX is the version number.
So that the Snowdrift database cluster tool sees the pgsql executables at
`/usr/pgsql-X.X/bin` on your PATH, either add that route (with the correct numbers
instead of X.X) to your PATH (e.g. in `~/.bash_profile`, `~/.bashrc` or
`~/.profile`) or create symlinks somewhere already on your PATH.
Then follow the [Stack install instructions]( for your distribution.
### Arch Linux
Install Git and PostgreSQL by running this command as `root`:
pacman -S git postgresql
Finally, install the
package from the AUR.
### NixOS
Install Git as usual under NixOS.
Then, follow the [NixOS Stack install instructions](
For PostgreSQL, add these lines to `/etc/nixos/configuration.nix`:
services.postgresql.enable = true;
services.postgresql.package = pkgs.postgresql94;
Then install PostgreSQL with:
sudo nixos-rebuild switch
Afterwards, you may need to create the postgres user, like so:
sudo -su root
createuser -s -r postgres
#### Building Snowdrift and GHC with NixOS
Stack can fetch and build the required version of GHC, but this
doesn't work well on NixOS due to an unusual filesystem hierarchy,
among other things. Instead, just use `nix-shell` to get into an
environment with the right compiler version:
nix-shell -p haskell.compiler.ghc7102
You can now attempt to build Snowdrift via the general instructions below. Stack
will likely complain about some missing items (like zlib). To continue, install
listed items manually via `nix-env` or `nox`, then specify their location like
stack build --extra-include-dirs ~/.nix-profile/include \
--extra-lib-dirs ~/.nix-profile/lib
### \*BSD
*Any knowledgeable reader: please help us document any important notes about
installing the Git, PostgreSQL, and Stack dependencies on \*BSD.*
### OS X
If you don't have [brew]( yet, install it with:
ruby -e "$(curl -fsSL"
With brew, install the core dependencies:
brew install git
brew install postgres
brew install haskell-stack
### Windows
*Status:* We do not officially support Windows, but we welcome testing. From
reports so far, SnowdriftEmailDaemon won't build on Windows, so `stack test`
will fail. Our database management utility (sdb.hs) is also untested on
Install [Git] per instructions on the website.
Install PostgreSQL 32-bit version from
Add the PostgreSQL bin directory to the path
`C:\Program Files (x86)\PostgreSQL\9.4\bin`
Follow the instructions to
[install Stack for Windows](
## Get the Snowdrift code
NB: We primarily use a completely FLO (Free/Libre/Open) host for our code:
[], and our instructions assume that repository.
For convenience and redundancy, we also mirror at [GitHub], a popular but
proprietary platform.
From within your preferred directory, get the code with:
git clone
## Initial Build
### Compile the code
Change to the new snowdrift directory:
cd snowdrift
Then, fetch all Haskell dependencies and build everything:
stack setup
stack build
NB: this will take a while!
### Set up the database
We have a simple tool that creates a private database cluster local to the
project. On GNU/Linux, BSD, or OS X, initialize databases by running:
./sdb.hs init
NB: The sdb.hs tool won't work on Windows because it uses UNIX sockets. We
welcome any patches, feedback, or Postgres-on-Windows help to get an alternative
NB: To see sdb commands for other operations, run `./sdb.hs --help`
### Run initial tests
Run the tests to compile the test dependencies:
stack test
## Running the site
### Starting the database
If you just initialized, the database cluster should already be running.
However, it will stop under various circumstances such as rebooting your
computer. If you try to run the site when the cluster is stopped, you will get
an error stating "Snowdrift: libpq: failed (could not connect to server: No such
file or directory". To make sure the database is running, enter:
./sdb.hs start
### Option 1: run via `Snowdrift Development`
From the snowdrift project directory, run the site in development mode via:
stack exec Snowdrift Development
(to stop the site, use ctrl-C)
### Option 2: run via `yesod devel`
NB: `yesod devel` provides automatic rebuilding and rerunning of the site
whenever it detects changes to the code, but it requires extra compile processes
the first time you use it. It also uses some minor extra drive space and
additional resources to run the file-watching process, and yesod devel is
currently incompatible with the optional ghc-mod tool mentioned in
To set up `yesod devel`, run:
stack build cabal-install yesod-bin
From now on, you may run the site in development mode via:
stack exec yesod devel
NB: The first run will take a long time.
(To stop yesod devel, type `quit` in terminal and then press Enter)
## Using the local site
### View in your browser
Access the site in your browser at <http://localhost:3000>
### Log-in options
The development database comes with three default users (with username and
passphrase the same):
* admin
* established
* guest
### Testing
Run the test suite with:
stack build && stack test --pedantic
NB: we include `stack build` because our current cabal setup does not fully
recognize test dependencies on executables such as SnowdriftProcessPayments.
### Manual rebuild
To rebuild the site, run:
stack build
NB: As mentioned above, if you run the site with `Snowdrift Development`, then
to see any changes, you must stop the site, manually rebuild, then restart the
site. If you use `yesod devel`, the site will rebuild and restart automatically
for most changes. However, **manual rebuild is always required whenever you:**
* add new dependencies (i.e. edit the `build-depends` in `Snowdrift.cabal`)
* update any extra binaries such as the payment processing script or the
email daemon.
NB: In rare cases, you may need to run `stack clean` if building fails to
recognize a change.
#### Updating static files
To make builds recognize changes to the static directory, run:
touch src/Settings/StaticFiles.hs
### Exploring the code via REPL
To start the REPL where you can run code from the site in an interpreter, use:
stack ghci
## Database notes
See [] for instructions on resetting the database and
## Getting help, learning, contributing etc.
We welcome any and all feedback on these build instructions, on the site itself,
etc. We will happily help you with any questions. See the [README](
for further general links, and the [Contributing Guide]( for
more thorough resources about technical development.
This diff is collapsed.
Additional Notes about Snowdrift Databases
Database migrations
Some changes to the database schema in config/models are considered *unsafe*
(i.e. changes that could result in data loss, such as dropping a table). When
you make any such changes, recompile, and then start the server, it
automatically generates content in migrations/migrate.unsafe, and the server
will abort.
* If you *don't* want to lose the data (e.g. a column is being moved to a
different table, a column is being renamed, etc.), alter the contents of
migrations/migrate.unsafe to be the appropriate SQL commands to preserve the
data in the desired manner.
* If you *intend* to lose the data (e.g. destroying a column storing data we
no longer want), the automatic entry in migrate.unsafe can be kept.
Once you are sure about the migration commands working as you intend, rename
migrations/migrate.unsafe to migrations/migrateN (where N is a higher number
than any previous migrate files).
With valid migration files in place, the server should run.
NB: Our migration system needs work, see
### Committing database migrations
Assuming you are happy with unsafe migrations and ready to commit, first
consolidate multiple uncommitted migration files to only one file per commit.
Then, reset your database (described below) and run the site again to make sure
everything works as expected.
Make sure to add the associated migration file to git when you commit
the corresponding schema changes.
If you try a change that requires unsafe migrations and decide to go a different
direction before committing everything, you will need to both reset your
database and remove the unwanted migration files (as well as reset the relevant
## Database management with the sdb.hs tool
Our sdb.hs tool has several functions for database management.
**All commands below should be run from your snowdrift project directory.**
### Resetting or updating your development database
To remove any changes and reset your database to the devDB default
(such as when others have provided a new update you want to try
or to start clean before making changes you plan to commit) run:
./sdb.hs reset
### Sharing updates to the devDB database
If you make specific improvements or additions to your database that you think
will make for a better start for other contributors, use the following command
to export the changes:
./sdb.hs export
Test that the export worked by running the reset command above and verifying in
the running site that everything works as expected.
Then, the new devDB.sql file may be committed and shared like other changes.
### testDB.sql
Older tests need some extra database setup. `sdb.hs` manages all of this
using the file `dev/testDB.sql`.
This diff is collapsed.
name: Snowdrift
version: 0.1.4
license: AGPL-3
author: David L. L. Thomas
synopsis: Infrastructure for the fundraising site.
category: Web
stability: Experimental
cabal-version: >= 1.18
build-type: Simple
-- flags {{{1
Flag dev
Description: Turn on development settings, like auto-reload templates.
Default: False
Flag merge
Description: Similar to dev, except with -Werror added.
Default: False
Flag library-only
Description: Build for use with "yesod devel"
Default: False
-- library {{{1
default-language: Haskell2010
hs-source-dirs: src
if flag(dev) || flag(library-only)
cpp-options: -DDEVELOPMENT
if flag(dev) || flag(library-only)
ghc-options: -Wall -O0 -fobject-code
if flag(merge)
ghc-options: -Wall -Werror -O0 -fobject-code
ghc-options: -Werror -Wall
-- exposed-modules {{{2