Skip to content

Instantly share code, notes, and snippets.

@pbrisbin
Last active August 29, 2015 14:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pbrisbin/f09407bdcccc40023f8c to your computer and use it in GitHub Desktop.
Save pbrisbin/f09407bdcccc40023f8c to your computer and use it in GitHub Desktop.
Testing halcyon-based local development

Go through the following from within the project root.

Project prep

This will:

  • Move ~/.ghc to avoid a known bug
  • Create a user-writable /app for building
  • Clone the halcyon build tool into /app
  • Remove any current build artifacts
#!/bin/sh
set -e

if [ -d ~/.ghc ]; then
  mv ~/.ghc ~/ghc.bak
fi

if [ ! -w /app ]; then
  sudo mkdir -p /app
  sudo chown $USER /app
fi

if [ ! -d /app/halcyon ]; then
  git clone https://github.com/mietek/halcyon.git /app/halcyon
fi

cabal clean
cabal sandbox delete

Build

Update the private storage variables and run the following:

#!/bin/sh
set -e

# TODO:
export HALCYON_AWS_ACCESS_KEY_ID=
export HALCYON_AWS_SECRET_ACCESS_KEY=
export HALCYON_S3_BUCKET=

/app/halcyon/halcyon build --no-clean-private-storage

ln -sf /app/sandbox/.halcyon-sandbox.config cabal.sandbox.config

Work

Prepare your shell environment:

% source <(/app/halcyon/halcyon paths)

# POSIX version
% /app/halcyon/halcyon paths > halcyon-env && . halcyon-env

You can either do the above every time, or add it to your shell startup file.

Do work:

% ghci foo.hs
% cabal test
% yesod devel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment