Initial attempts at dockerizing, cabal isn't cooperating.

[?]
Jun 8, 2015, 8:05 PM
4ZLEDBK7VGLKFUPENAFLUJYNFLKFYJ3TREPQ7P6PKMYGJUXB55HQC

Dependencies

  • [2] PGZJ736C Update aftok.cfg.example and revise INSTALL instructions
  • [3] IZEVQF62 Work in progress replacing sqlite with postgres.
  • [4] 4U7F3CPI THE GREAT RENAMING OF THINGS!
  • [5] TNR3TEHK Switch to Postgres + snaplet arch compiles.
  • [6] Z3M53KTL Adrift.
  • [*] AXKKXBWN Initial attempt at writing down my ideas for a company based on trust.
  • [*] ADMKQQGC Initial empty Snap project.
  • [*] XTBSG4C7 Adding serveJSON combinator to eliminate some boilerplate from handlers.
  • [*] W35DDBFY Factor common JSON conversions up into client lib module.

Change contents

  • file addition: .dockerignore (----------)
    [8.2]
  • file addition: Dockerfile (----------)
    [8.2]
    ## Dockerfile for the Aftok environment
    FROM phusion/baseimage:0.9.16
    MAINTAINER Kris Nuttycombe <kris@aftok.com>
    ## ensure locale is set during build
    ENV LANG C.UTF-8
    RUN echo 'deb http://ppa.launchpad.net/hvr/ghc/ubuntu trusty main' > /etc/apt/sources.list.d/ghc.list && \
    apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F6F88286 && \
    apt-get update && \
    apt-get install -y --no-install-recommends \
    cabal-install-1.22 \
    ghc-7.10.2 \
    happy-1.19.5 \
    alex-3.1.4 \
    zlib1g-dev \
    libtinfo-dev \
    libsqlite3-0 \
    libsqlite3-dev \
    ca-certificates && \
    rm -rf /var/lib/apt/lists/*
    ENV PATH /root/.cabal/bin:/opt/cabal/1.22/bin:/opt/ghc/7.10.2/bin:/opt/happy/1.19.5/bin:/opt/alex/3.1.4/bin:$PATH
    ADD ./aftok.cabal /opt/aftok/aftok.cabal
    RUN cabal update
    RUN cd /opt/aftok && cabal sandbox init && cabal install --only-dependencies -j4
    ADD ./lib /opt/aftok/lib
    ADD ./server /opt/aftok/server
    # Set up /etc/aftok volume for configuration information
    RUN mkdir /etc/aftok
    VOLUME ["/etc/aftok"]
    ADD ./conf/aftok.example.cfg /etc/aftok/aftok.cfg
    ENV AFTOK_CFG /etc/aftok/aftok.cfg
    # This is the main shell script that starts the aftok server
    RUN mkdir /etc/services/aftok
    ADD ./docker/aftok-server.sh /etc/services/aftok/run
    # Use baseimage-docker's init system.
    CMD ["/sbin/my_init"]
  • file addition: docker (d--r------)
    [8.2]
  • file addition: aftok-server.sh (----------)
    [0.1510]
    #!/bin/bash
    /opt/aftok/dist/build/aftok-server/aftok-server
  • edit in server/Main.hs at line 6
    [10.626]
    [11.918]
    import System.Environment
  • replacement in server/Main.hs at line 26
    [3.8195][2.1079:1117]()
    cfg <- loadQConfig "conf/aftok.cfg"
    [3.8195]
    [3.8231]
    cfgPath <- try $ getEnv "AFTOK_CFG" :: IO (Either IOError String)
    cfg <- loadQConfig $ either (const "conf/aftok.cfg") id cfgPath