Make docker-compose work.
[?]
May 28, 2020, 3:05 PM
GMYPBCWEB6NKURRILAHR3TJUKDOGR2ZMK5I6MS6P5G2LAGH36P3QCDependencies
- [2]
L65BC6Y6Use updated dbmigrations executables. - [3]
B6HWAPDPModularize & update to recent haskoin. - [4]
LEINLS3XUpdate deployment documentation. - [5]
HMDM3B55Implement core of payments/billing infrastructure. - [6]
V2VDN77HEnable postgres configuration via environment variable for Heroku. - [7]
SOIAMXLWBuild versioned docker images. - [8]
O5FVTOM6Undo JSON silliness, enable a couple more routes. - [9]
4B66XH43Add sample billing config - [10]
IPG33FAWAdd billing daemon - [11]
3TAMXHCZAdd migrations to server startup. - [12]
E2KOBKIJAdd setup script detailing the setup of the docker host. - [13]
IZEVQF62Work in progress replacing sqlite with postgres. - [14]
7VGYLTMUClean up schema version handling. - [15]
XZLSHL4DThe server is now (tenuously) running, and serving pages via SSL! - [16]
2WOOGXDHUse dbmigrations to manage database state. - [17]
ZKJJVD2HFix aftok-server runit script permissions. - [18]
EW2XN7KUUpdate docker build, clean up migration for payments tables. - [19]
2LZYVHFSUpgrade to Stack-based build in Docker - [20]
6L5BK5EHUse generic SMTP rather than Sendmail-specific mail client. - [21]
NVOCQVASInitial failing tests. - [22]
AL37SVTCImplement payments service endpoints. - [23]
NEDDHXUKReformat via stylish-haskell - [24]
NLZ3JXLOFix formatting with stylish-haskell. - [25]
2XQD6KKKAdd invitation logic and clean up DBProg error handling. - [26]
DXIGERDTChange order of Docker build to avoid rebuilding the universe. - [27]
T3X4DRLFAdd dbmigrations to the docker build. - [28]
QTHFTPDXClean up dockerfile organization - [29]
DFOBMSAOInitial work on payments API - [30]
MJ6R42RCUtility methods for reading key & cert data. - [31]
JEOPOOPTDockerfile now builds correctly. - [32]
4ZLEDBK7Initial attempts at dockerizing, cabal isn't cooperating. - [33]
M3KUPGZKAdd invitation email template. - [34]
O722AOKEAdd route to allow crediting of events to users/projects. - [35]
HO2PFRABClient login now handles response correctly. - [*]
64C6AWH6Rename Ananke -> Quixotic, project reboot. - [*]
GCVQD44VCreate amends endpoint, switch to UUID primary keys - [*]
WZUHEZSBStart of migration back toward snap. - [*]
AXKKXBWNInitial attempt at writing down my ideas for a company based on trust. - [*]
PBD7LZYQPostgres & auth are beginning to function. - [*]
ADMKQQGCInitial empty Snap project. - [*]
W35DDBFYFactor common JSON conversions up into client lib module.
Change contents
- replacement in Dockerfile at line 2
FROM phusion/baseimage:0.9.19FROM ubuntu:focal - replacement in Dockerfile at line 8[4.231]→[4.1:26](∅→∅),[4.26]→[4.38:231](∅→∅),[4.219]→[4.328:383](∅→∅),[4.231]→[4.328:383](∅→∅),[4.328]→[4.328:383](∅→∅)
# Base GHC/cabal installRUN echo 'deb http://download.fpcomplete.com/ubuntu xenial main' > /etc/apt/sources.list.d/fpco.list && \apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 575159689BEFB442# Install libpq-dev to enable postgresql-simple build# Install build tools & library dependencies - edit in Dockerfile at line 12
g++ gcc libc6-dev libffi-dev libgmp-dev make xz-utils zlib1g-dev git gnupg curl \ - replacement in Dockerfile at line 14
git stack# apt-get install -y --no-install-recommends wget && \# echo 'deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main' > /etc/apt/sources.list.d/pgdg.list && \# wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \libsecp256k1-devRUN apt-get install -y --no-install-recommends ca-certificates - replacement in Dockerfile at line 18
# Install npm, then use it to get purescript, pulp and bower# RUN apt-get install -y --no-install-recommends nodejs# RUN apt-get install -y --no-install-recommends npm# RUN npm install -g npm bower pulpRUN update-ca-certificatesADD ./docker/install_stack.sh /root/RUN /bin/sh /root/install_stack.sh - replacement in Dockerfile at line 22
# Fix executable name used by the purescript npm installer# RUN ln -s /usr/bin/nodejs /usr/local/bin/nodeRUN /usr/local/bin/stack upgrade --force-download - replacement in Dockerfile at line 27
RUN stack --resolver lts-7.16 setupRUN /root/.local/bin/stack --resolver lts-13.9 setup - replacement in Dockerfile at line 30
RUN stack install dbmigrationsRUN stack install dbmigrations-postgresqlRUN /root/.local/bin/stack install dbmigrationsRUN /root/.local/bin/stack install dbmigrations-postgresql - replacement in Dockerfile at line 46
RUN stack setupRUN stack install cpphsRUN stack build --only-dependenciesRUN /root/.local/bin/stack setupRUN /root/.local/bin/stack install cpphsRUN apt-get update && apt-get install -y --no-install-recommends libssl-devRUN /root/.local/bin/stack build --only-dependencies -j1 - replacement in Dockerfile at line 58
RUN stack installRUN /root/.local/bin/stack install - replacement in Dockerfile at line 60
# Build the client application and install it where snap can serve it#ADD ./client /opt/aftok/client#WORKDIR /opt/aftok/client#RUN npm install#ENV PATH=./node_modules/.bin:${PATH}##RUN bower --allow-root install#RUN pulp build#RUN pulp browserify --optimise --to dist/aftok.js#ADD ./dist /opt/aftok/server/static# add the s6-overlay init process# RUN mkdir -p /etc/services.d/aftok# RUN mkdir -p /etc/fix-attrs.d/## ADD https://github.com/just-containers/s6-overlay/releases/download/v1.21.8.0/s6-overlay-amd64.tar.gz /tmp/# RUN tar xzf /tmp/s6-overlay-amd64.tar.gz -C / --exclude="./bin" && \# tar xzf /tmp/s6-overlay-amd64.tar.gz -C /usr ./bin## ADD ./docker/aftok-server.sh /etc/services.d/aftok/run# ADD ./docker/fix-attrs.d/* /etc/fix-attrs.d/## ENTRYPOINT ["/init"] - replacement in Dockerfile at line 73
# Add the main shell script that starts the aftok serverRUN mkdir /etc/service/aftokADD ./docker/aftok-server.sh /etc/service/aftok/runENTRYPOINT ["/opt/aftok/bin/aftok-server"] - edit in Dockerfile at line 75
# Use baseimage-docker's init system.CMD ["/sbin/my_init"] - edit in Makefile at line 2
PWD=$(shell pwd) - replacement in Makefile at line 8
docker build -t nuttycom/aftok:latest .docker build -t aftok/aftok:latest . - replacement in Makefile at line 11
docker tag nuttycom/aftok:latest nuttycom/aftok:$(VERSION)docker push docker.io/nuttycom/aftok:$(VERSION)docker tag aftok/aftok:latest aftok/aftok:$(VERSION)docker push docker.io/aftok/aftok:$(VERSION) - replacement in Makefile at line 14
run-local-docker: build-containerdocker run --net=host -it -v /home/nuttycom/projects/aftok/local/conf/:/etc/aftok aftok/aftok:latest[4.1311]run-local-docker: build-imagedocker run --net=host -it -v $(PWD)/local/conf/:/etc/aftok aftok/aftok:latest - edit in aftok.cabal at line 161
, directory - file addition: nginx[4.1]
- file move: nginx.conf → nginx.conf
- edit in deploy/nginx/nginx.conf at line 1
daemon off; - edit in deploy/nginx/nginx.conf at line 15
upstream aftok-server {server aftok-server:8000;} - replacement in deploy/nginx/nginx.conf at line 26
listen 443;listen 443 ssl; - replacement in deploy/nginx/nginx.conf at line 29
ssl_certificate /etc/nginx/aftok.crt;ssl_certificate_key /etc/nginx/aftok.key;ssl_certificate /opt/nginx/aftok.crt;ssl_certificate_key /opt/nginx/aftok.key; - edit in deploy/nginx/nginx.conf at line 32
ssl on; - replacement in deploy/nginx/nginx.conf at line 34
ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;ssl_prefer_server_ciphers on;ssl_ciphers AES128-SHA:AES256-SHA:RC4-SHA:DES-CBC3-SHA:RC4-MD5; - replacement in deploy/nginx/nginx.conf at line 45
proxy_pass http://localhost:8000;proxy_read_timeout 90;proxy_pass http://aftok-server;proxy_read_timeout 90; - replacement in deploy/nginx/nginx.conf at line 48
proxy_redirect http://localhost:8000 https://aftok.com;proxy_redirect http://aftok-server https://aftok.com; - replacement in docker/aftok-server.sh at line 1
#!/bin/bash#!/usr/bin/execlineb -P - replacement in docker/aftok-server.sh at line 3
/root/.local/bin/moo-postgresql upgrade --config-file=/etc/aftok/aftok-migrations.cfgs6-setuidgid daemon# /root/.local/bin/moo-postgresql upgrade --config-file=/etc/aftok/aftok-migrations.cfgbacktick AFTOK_CFG { echo "/etc/aftok/aftok.cfg" } - file addition: install_stack.sh[4.1510]
#!/bin/sh -e## Stack installation script.## This script is meant for quick & easy install via:# 'curl -sSL https://get.haskellstack.org/ | sh'# or:# 'wget -qO- https://get.haskellstack.org/ | sh'## By default, this installs 'stack' to '/usr/local/bin'.## Arguments (use `... | sh -s - ARGUMENTS`)## -q: reduce script's output# -f: force over-write even if 'stack' already installed# -d DESTDIR: change destination directory## Make pull requests at:# https://github.com/commercialhaskell/stack/blob/master/etc/scripts/get-stack.sh## Note that this script will ask for root access using `sudo` in order to use# your platform's package manager to install dependencies and to install to# `/usr/local/bin`. If you prefer more control, follow the manual# installation instructions for your platform at:# https://docs.haskellstack.org/en/stable/install_and_upgrade/#STACK_VERSION="2.1.3"HOME_LOCAL_BIN="$HOME/.local/bin"DEFAULT_DEST="/usr/local/bin/stack"# Windows doesn't have a good place for DEST, but all CI systems (Appveyor, Travis, Azure) support /binDEFAULT_DEST_WINDOWS="/bin/stack"DEST=""QUIET=""FORCE=""STACK_TEMP_DIR=# creates a temporary directory, which will be cleaned up automatically# when the script finishesmake_temp_dir() {STACK_TEMP_DIR="$(mktemp -d 2>/dev/null || mktemp -d -t stack)"}# cleanup the temporary directory if it's been created. called automatically# when the script exits.cleanup_temp_dir() {if [ -n "$STACK_TEMP_DIR" ] ; thenrm -rf "$STACK_TEMP_DIR"STACK_TEMP_DIR=fi}# print a message to stderr and exit with error codedie() {echo "$@" >&2exit 1}# print a message to stdout unless '-q' passed to scriptinfo() {if [ -z "$QUIET" ] ; thenecho "$@"fi}# print a separator for post-install messagespost_install_separator() {info ""info "-------------------------------------------------------------------------------"info ""}# determines the the CPU's instruction setget_isa() {if arch | grep -q armv7 ; thenecho armelif arch | grep -q aarch64 ; thenecho aarch64elseecho x86fi}# exits with code 0 if arm ISA is detected as described aboveis_arm() {test "$(get_isa)" = arm}# exits with code 0 if aarch64 ISA is detected as described aboveis_aarch64() {test "$(get_isa)" = aarch64}# determines 64- or 32-bit architecture# if getconf is available, it will return the arch of the OS, as desired# if not, it will use uname to get the arch of the CPU, though the installed# OS could be 32-bits on a 64-bit CPUget_arch() {if has_getconf ; thenif getconf LONG_BIT | grep -q 64 ; thenecho 64elseecho 32fielsecase "$(uname -m)" in*64)echo 64;;*)echo 32;;esacfi}# exits with code 0 if a 64-bit architecture is detected as described aboveis_64_bit() {test "$(get_arch)" = 64}# prints a generic bindist noticeprint_bindist_notice() {if [ -z "$1" ] ; theninfo ""info "Using generic bindist..."info ""elseinfo ""info "Using generic $1 bindist..."info ""fi}# Adds a 'sudo' prefix if sudo is available to execute the given command# If not, the given command is run as is# When requesting root permission, always show the command and never re-use cached credentials.sudocmd() {reason="$1"; shiftif command -v sudo >/dev/null; thenechoecho "About to use 'sudo' to run the following command as root:"echo " $@"echo "in order to $reason."echo# -k: Disable cached credentials (force prompt for password).sudo -k "$@"else"$@"fi}# Install dependencies for distros that use Aptapt_install_dependencies() {info "Installing dependencies..."info ""apt_get_install_pkgs "$@"}# Attempts an install on Ubuntu via apt, if possible# Expects the version (in Major.Minor format, with any sub-minor removed)# as the first and only argument# If the version of Ubuntu is unsupported, it attempts to copy the binary# and install the necessary dependencies explicitly.do_ubuntu_install() {install_dependencies() {apt_install_dependencies g++ gcc libc6-dev libffi-dev libgmp-dev make xz-utils zlib1g-dev git gnupg netbase}if is_arm ; theninstall_dependenciesprint_bindist_noticeinstall_arm_binaryelif is_aarch64 ; theninstall_dependenciesprint_bindist_noticeinstall_aarch64_binaryelif is_64_bit ; theninstall_dependenciesprint_bindist_noticeinstall_64bit_standard_binaryelseinstall_dependenciesprint_bindist_noticeinstall_32bit_standard_binaryfi}# Attempts an install on Debian.# Expects the single-number version as the first and only argument# If the version of Debian is unsupported, it attempts to copy the binary# and install the necessary dependencies explicitly.do_debian_install() {install_dependencies() {apt_install_dependencies g++ gcc libc6-dev libffi-dev libgmp-dev make xz-utils zlib1g-dev git gnupg netbase}if is_arm ; theninstall_dependenciesprint_bindist_noticeinstall_arm_binaryelif is_aarch64 ; theninstall_dependenciesprint_bindist_noticeinstall_aarch64_binaryelif is_64_bit ; theninstall_dependenciesprint_bindist_noticeinstall_64bit_standard_binaryelseinstall_dependenciesprint_bindist_noticeinstall_32bit_standard_binaryfi}# Attempts an install on Fedora.# Expects the single-number version as the first and only argument# If the version of Fedora is unsupported, it attempts to copy the binary# and install the necessary dependencies explicitly.do_fedora_install() {install_dependencies() {dnf_install_pkgs perl make automake gcc gmp-devel libffi zlib-devel xz tar git gnupg}if is_64_bit ; theninstall_dependencies "$1"print_bindist_noticeinstall_64bit_standard_binaryelseinstall_dependencies "$1"print_bindist_noticeinstall_32bit_standard_binaryfi}# Attempts an install on CentOS.# Expects the single-number version as the first and only argument# If the version of CentOS is unsupported, it attempts to copy the binary# and install the necessary dependencies explicitly.do_centos_install() {install_dependencies() {yum_install_pkgs perl make automake gcc gmp-devel libffi zlib xz tar git gnupg}if is_64_bit ; theninstall_dependenciesprint_bindist_noticeinstall_64bit_standard_binaryelsecase "$1" in"6"*)die "Sorry, there is currently no Linux 32-bit gmp4 binary available.";;*)install_dependenciesprint_bindist_noticeinstall_32bit_standard_binary;;esacfi}# Attempts to install on Windows, designed for CI scripts (tested on Appveyor, Travis, Azure)do_windows_install() {info "Using Windows install.."info ""make_temp_dirdl_to_file "http://www.stackage.org/stack/windows-x86_64" "$STACK_TEMP_DIR/stack.zip"if [ "$(basename $DEST)" != "stack" ]; then# should never happen, the -d flag appends stack itselfdie "Currently the destination must always end with 'stack' on Windows, got: $DEST"fiif ! 7z x $STACK_TEMP_DIR/stack.zip stack.exe "-o$(dirname $DEST)"; thendie "Extract zip file failed, you probably don't have 7z installed"fipost_install_separatorinfo "Stack has been installed to: $DEST"info ""check_dest_on_path}# Attempts to install on macOS.# If 'brew' exists, installs using Homebrew. Otherwise, installs# the generic bindist.do_osx_install() {info "Using generic bindist..."info ""install_64bit_osx_binaryinfo "NOTE: You may need to run 'xcode-select --install' and/or"info " 'open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg'"info " to set up the Xcode command-line tools, which Stack uses."info ""}# Attempts to insall on FreeBSD. Installs dependencies with# 'pkg install' and then downloads bindist.do_freebsd_install() {install_dependencies() {pkg_install_pkgs devel/gmake perl5 lang/gcc misc/compat8x misc/compat9x converters/libiconv ca_root_nss}if is_64_bit ; theninstall_dependenciesinstall_64bit_freebsd_binaryelsedie "Sorry, there is currently no 32-bit FreeBSD binary available."fi}# Alpine distro installdo_alpine_install() {install_dependencies() {apk_install_pkgs gmp libgcc xz make}install_dependenciesif is_64_bit ; thenprint_bindist_noticeinstall_64bit_standard_binaryelsedie "Sorry, there is currently no 32-bit Alpine Linux binary available."fi}# Attempts to install on unsupported Linux distribution by downloading# the bindist.do_sloppy_install() {info "This installer doesn't support your Linux distribution, trying generic"info "bindist..."info ""if is_arm ; theninstall_arm_binaryelif is_aarch64 ; theninstall_aarch64_binaryelif is_64_bit ; theninstall_64bit_standard_binaryelseinstall_32bit_standard_binaryfiinfo "Since this installer doesn't support your Linux distribution,"info "there is no guarantee that 'stack' will work at all! You may"info "need to manually install some system info dependencies for GHC:"info " gcc, make, libffi, zlib, libgmp and libtinfo"info "Please see http://docs.haskellstack.org/en/stable/install_and_upgrade/"info "Pull requests to add support for this distro would be welcome!"info ""}# Attempts to determine the running Linux distribution.# Prints "DISTRO;VERSION" (distribution name and version)"."distro_info() {parse_lsb() {lsb_release -a 2> /dev/null | perl -ne "$1"}try_lsb() {if has_lsb_release ; thenTL_DIST="$(parse_lsb 'if(/Distributor ID:\s+([^ ]+)/) { print "\L$1"; }')"TL_VERSION="$(parse_lsb 'if(/Release:\s+([^ ]+)/) { print "\L$1"; }')"echo "$TL_DIST;$TL_VERSION"elsereturn 1fi}try_release() {parse_release() {perl -ne "$1" /etc/*release 2>/dev/null}parse_release_id() {parse_release 'if(/^(DISTRIB_)?ID\s*=\s*"?([^"]+)/) { print "\L$2"; exit 0; }'}parse_release_version() {parse_release 'if(/^(DISTRIB_RELEASE|VERSION_ID)\s*=\s*"?([^"]+)/) { print $2; exit 0; }'}TR_RELEASE="$(parse_release_id);$(parse_release_version)"if [ ";" = "$TR_RELEASE" ] ; thenif [ -e /etc/arch-release ] ; then# /etc/arch-release exists but is often emptyecho "arch;"elif [ -e /etc/centos-release ] && grep -q "\<6\>" /etc/centos-release ; then# /etc/centos-release has a non-standard format before version 7echo "centos;6"elsereturn 1fielseecho "$TR_RELEASE"fi}try_issue() {case "$(cat /etc/issue 2>/dev/null)" in"Arch Linux"*)echo "arch;" # n.b. Version is not available in /etc/issue on Arch;;"Ubuntu"*)echo "ubuntu;$(perl -ne 'if(/Ubuntu (\d+\.\d+)/) { print $1; }' < /etc/issue)";;"Debian"*)echo "debian;$(perl -ne 'if(/Debian GNU\/Linux (\d+(\.\d+)?)/) { print $1; }' < /etc/issue)";;*"SUSE"*)echo "suse;$(perl -ne 'if(/SUSE\b.* (\d+\.\d+)/) { print $1; }' < /etc/issue)";;*"NixOS"*)echo "nixos;$(perl -ne 'if(/NixOS (\d+\.\d+)/) { print $1; }' < /etc/issue)";;"CentOS"*)echo "centos;$(perl -ne 'if(/^CentOS release (\d+)\./) { print $1; }' < /etc/issue)";;*)esac# others do not output useful info in issue, return empty}try_lsb || try_release || try_issue}# Attempt to install on a Linux distributiondo_distro() {if ! has_perl ; thenif ! try_install_pkgs perl ; then#TODO: remove dependence on 'perl', which is not installed by default#on some distributions (Fedora and RHEL, in particular).die "This script requires 'perl', please install it to continue."fifiIFS=";" read -r DISTRO VERSION <<GETDISTRO$(distro_info)GETDISTROif [ -n "$DISTRO" ] ; theninfo "Detected Linux distribution: $DISTRO"info ""ficase "$DISTRO" inubuntu|linuxmint|elementary|neon)do_ubuntu_install "$VERSION";;debian|kali|raspbian|mx)do_debian_install "$VERSION";;fedora)do_fedora_install "$VERSION";;centos|rhel|redhatenterpriseserver)do_centos_install "$VERSION";;alpine)do_alpine_install "$VERSION";;*)do_sloppy_installesac}set_default_dest() {[ "$DEST" != "" ] || DEST="$DEFAULT_DEST"}# Determine operating system and attempt to install.do_os() {case "$(uname)" in"Linux")set_default_destdo_distro;;"Darwin")set_default_destdo_osx_install;;"FreeBSD")set_default_destdo_freebsd_install;;MINGW64_NT-*|MSYS_NT-*)DEFAULT_DEST="$DEFAULT_DEST_WINDOWS"set_default_destdo_windows_install;;*)die "Sorry, this installer does not support your operating system: $(uname).See http://docs.haskellstack.org/en/stable/install_and_upgrade/"esac}# Download a URL to file using 'curl' or 'wget'.dl_to_file() {if has_curl ; thenif ! curl ${QUIET:+-sS} -L -o "$2" "$1"; thendie "curl download failed: $1"fielif has_wget ; thenif ! wget ${QUIET:+-q} "-O$2" "$1"; thendie "wget download failed: $1"fielse# should already have checked for this, otherwise this message will probably# not be displayed, since dl_to_stdout will be part of a pipelinedie "Neither wget nor curl is available, please install one to continue."fi}# Check for 'curl' or 'wget' and attempt to install 'curl' if neither found,# or fail the script if that is not possible.check_dl_tools() {if ! has_curl && ! has_wget ; thenif ! try_install_pkgs curl ; thendie "Neither wget nor curl is available, please install one to continue."fifi}# Download a Stack bindst and install it in /usr/local/bin/stack.install_from_bindist() {IFB_URL="https://github.com/commercialhaskell/stack/releases/download/v${STACK_VERSION}/stack-${STACK_VERSION}-$1"check_dl_toolsmake_temp_dirdl_to_file "$IFB_URL" "$STACK_TEMP_DIR/$1.bindist"mkdir -p "$STACK_TEMP_DIR/$1"if ! tar xzf "$STACK_TEMP_DIR/$1.bindist" -C "$STACK_TEMP_DIR/$1"; thendie "Extract bindist failed"fiSTACK_TEMP_EXE="$STACK_TEMP_DIR/$(basename "$DEST")"mv "$STACK_TEMP_DIR/$1"/*/stack "$STACK_TEMP_EXE"destdir="$(dirname "$DEST")"if [ ! -d "$destdir" ]; theninfo "$destdir directory does not exist; creating it..."# First try to create directory as current user, then try with sudo if it fails.if ! mkdir -p "$destdir" 2>/dev/null; thenif ! sudocmd "create the destination directory" mkdir -p "$destdir"; thendie "Could not create directory: $DEST"fififi# First attempt to install 'stack' as current user, then try with sudo if it failsinfo "Installing Stack to: $DEST..."if ! install -c -m 0755 "$STACK_TEMP_EXE" "$destdir" 2>/dev/null; thenif ! sudocmd "copy 'stack' to the destination directory" install -c -o 0 -g 0 -m 0755 "$STACK_TEMP_EXE" "$destdir"; thendie "Install to $DEST failed"fifipost_install_separatorinfo "Stack has been installed to: $DEST"info ""check_dest_on_path}install_arm_binary() {install_from_bindist "linux-arm.tar.gz"}install_32bit_standard_binary() {install_from_bindist "linux-i386.tar.gz"}install_64bit_standard_binary() {install_from_bindist "linux-x86_64-static.tar.gz"}install_aarch64_binary() {install_from_bindist "linux-aarch64.tar.gz"}install_64bit_gmp4_linked_binary() {install_from_bindist "linux-x86_64-gmp4.tar.gz"}install_64bit_gmp4_linked_binary() {install_from_bindist "linux-x86_64-gmp4"}install_64bit_osx_binary() {install_from_bindist "osx-x86_64.tar.gz"}install_64bit_freebsd_binary() {install_from_bindist "freebsd-x86_64.tar.gz"}# Attempt to install packages using whichever of apt-get, dnf, yum, or apk is# available.try_install_pkgs() {if has_apt_get ; thenapt_get_install_pkgs "$@"elif has_dnf ; thendnf_install_pkgs "$@"elif has_yum ; thenyum_install_pkgs "$@"elif has_apk ; thenapk_install_pkgs "$@"elsereturn 1fi}# Install packages using apt-getapt_get_install_pkgs() {missing=for pkg in $*; doif ! dpkg -s $pkg 2>/dev/null |grep '^Status:.*installed' >/dev/null; thenmissing="$missing $pkg"fidoneif [ "$missing" = "" ]; theninfo "Already installed!"elif ! sudocmd "install required system dependencies" apt-get install -y ${QUIET:+-qq}$missing; thendie "Installing apt packages failed. Please run 'apt-get update' and try again."fi}# Install packages using dnfdnf_install_pkgs() {if ! sudocmd "install required system dependencies" dnf install -y ${QUIET:+-q} "$@"; thendie "Installing dnf packages failed. Please run 'dnf check-update' and try again."fi}# Install packages using yumyum_install_pkgs() {if ! sudocmd "install required system dependencies" yum install -y ${QUIET:+-q} "$@"; thendie "Installing yum packages failed. Please run 'yum check-update' and try again."fi}# Install packages using apkapk_install_pkgs() {if ! sudocmd "install required system dependencies" apk add --update ${QUIET:+-q} "$@"; thendie "Installing apk packages failed. Please run 'apk update' and try again."fi}# Install packages using pkgpkg_install_pkgs() {if ! sudocmd "install required system dependencies" pkg install -y "$@"; thendie "Installing pkg packages failed. Please run 'pkg update' and try again."fi}# Get installed Stack version, if anyinstalled_stack_version() {stack --version | grep -o 'Version \([[:digit:]]\|\.\)\+' | tr A-Z a-z}# Get installed Stack's pathstack_location() {command -v stack}# Check whether 'stack' command existshas_stack() {if [ "$DEST" != "" ] ; thenhas_cmd "$DEST"elsehas_cmd stackfi}# Check whether 'wget' command existshas_wget() {has_cmd wget}# Check whether 'curl' command existshas_curl() {has_cmd curl}# Check whether 'lsb_release' command existshas_lsb_release() {has_cmd lsb_release}# Check whether 'sudo' command existshas_sudo() {has_cmd sudo}# Check whether 'getconf' command existshas_getconf() {has_cmd getconf}# Check whether 'brew' command exists#has_brew() {# has_cmd brew#}# Check whether 'perl' command existshas_perl() {has_cmd perl}# Check whether 'apt-get' command existshas_apt_get() {has_cmd apt-get}# Check whether 'yum' command existshas_yum() {has_cmd yum}# Check whether 'apk' command existshas_apk() {has_cmd apk}# Check whether 'dnf' command existshas_dnf() {has_cmd dnf}# Check whether the given command existshas_cmd() {command -v "$1" > /dev/null 2>&1}# Check whether the given path is listed in the PATH environment variableon_path() {echo ":$PATH:" | grep -q :"$1":}# Check whether ~/.local/bin is on the PATH, and print a warning if not.check_home_local_bin_on_path() {if ! on_path "$HOME_LOCAL_BIN" ; then#TODO: offer to add it for the user (pull requests welcome!)info "WARNING: '$HOME_LOCAL_BIN' is not on your PATH."info " For best results, please add it to the beginning of PATH in your profile."info ""fi}# Check whether $DEST is on the PATH, and print a warning if not.check_dest_on_path() {if ! on_path "$(dirname $DEST)" ; theninfo "WARNING: '$(dirname $DEST)' is not on your PATH."info ""fi}# Check whether Stack is already installed, and print an error if it is.check_stack_installed() {if has_stack ; thenif [ "$FORCE" = "true" ] ; then[ "$DEST" != "" ] || DEST="$(stack_location)"elseif has_curl; thenget="curl -sSL"elseget="wget -qO-"fi[ "$DEST" != "" ] && location=$(realpath "$DEST") || location=$(stack_location)die "Stack $(installed_stack_version) already appears to be installed at:$locationUse 'stack upgrade' or your OS's package manager to upgrade,or pass '-f' to this script to over-write the existing binary, e.g.:$get https://get.haskellstack.org/ | sh -s - -fTo install to a different location, pass '-d DESTDIR', e.g.:$get https://get.haskellstack.org/ | sh -s - -d /opt/stack-$STACK_VERSION/bin"fifi}trap cleanup_temp_dir EXITwhile [ $# -gt 0 ]; docase "$1" in-q|--quiet)# This tries its best to reduce output by suppressing the script's own# messages and passing "quiet" arguments to tools that support them.QUIET="true"shift;;-f|--force)FORCE="true"shift;;-d|--dest)DEST="$2/stack"shift 2;;*)echo "Invalid argument: $1" >&2exit 1;;esacdonecheck_stack_installeddo_oscheck_home_local_bin_on_path - file addition: docker-compose.yml[40.2]
version: "3.7"services:aftok:image: aftok/aftok-server:latestcontainer_name: aftok-serverexpose:- "8000"depends_on:- aftokdbvolumes:- type: bindsource: ${PWD}/local/conf/servertarget: /etc/aftoknetworks:- front-tier- back-tierinit: truenginx:image: nginx:latestcontainer_name: aftok-nginxports:- "8080:80"- "8443:443"depends_on:- aftokvolumes:- type: bindsource: ${PWD}/deploy/nginx/target: /etc/nginx- type: bindsource: ${PWD}/local/conf/nginx-certstarget: /opt/nginxnetworks:- front-tieraftokdb:image: postgres:9.4container_name: aftok-dbenvironment:POSTGRES_USER: "postgres"POSTGRES_PASSWORD: "postgres"volumes:- type: volumesource: aftok-datatarget: /var/lib/postgresql/datanetworks:- back-tiervolumes:aftok-data:networks:front-tier:back-tier: - replacement in migrations/2016-10-13_05-36-55_user-event-log.txt at line 5
--create extension if not exists "uuid-ossp";-- create extension if not exists "uuid-ossp"; - replacement in server/Aftok/QConfig.hs at line 1
{-# LANGUAGE TypeApplications #-}{-# LANGUAGE TemplateHaskell #-}{-# LANGUAGE OverloadedStrings #-} - edit in server/Aftok/QConfig.hs at line 8
import Control.Lens (makeLenses, (^.)) - edit in server/Aftok/QConfig.hs at line 12
import System.Directory (doesFileExist, doesPathExist, listDirectory) - replacement in server/Aftok/QConfig.hs at line 14
import Filesystem.Path.CurrentOS (FilePath, fromText, encodeString)import Filesystem.Path.CurrentOS (FilePath, fromText, encodeString, parent) - edit in server/Aftok/QConfig.hs at line 21
import Aftok.Currency.Bitcoin (NetworkMode) - replacement in server/Aftok/QConfig.hs at line 23[4.4863]→[4.7029:7086](∅→∅),[4.7086]→[4.32644:32674](∅→∅),[4.7126]→[4.4944:4975](∅→∅),[4.32674]→[4.4944:4975](∅→∅),[4.4944]→[4.4944:4975](∅→∅),[4.4975]→[4.7127:7190](∅→∅),[4.7190]→[4.218:253](∅→∅),[4.253]→[4.32675:32737](∅→∅),[4.32737]→[3.34112:34143](∅→∅)
{ hostname :: ByteString, port :: Int, authSiteKey :: FilePath, cookieTimeout :: Maybe Int, pgsConfig :: PGSConfig, smtpConfig :: SmtpConfig, billingConfig :: BillingConfig, templatePath :: FilePath, staticAssetPath :: FilePath, networkMode :: NetworkMode{ _hostname :: ByteString, _port :: Int, _authSiteKey :: FilePath, _cookieTimeout :: Maybe Int, _pgsConfig :: PGSConfig, _smtpConfig :: SmtpConfig, _billingConfig :: BillingConfig, _templatePath :: FilePath, _staticAssetPath :: FilePath - edit in server/Aftok/QConfig.hs at line 33
makeLenses ''QConfig - edit in server/Aftok/QConfig.hs at line 38
cfgExists <- doesFileExist $ encodeString cfgFilepathExists <- doesPathExist $ encodeString cfgFilefiles <- listDirectory (encodeString $ parent cfgFile)putStrLn $ "Loading config from: " <> (pack . encodeString $ cfgFile)<> "; file exists = " <> (pack . show $ cfgExists)<> "; path exists = " <> (pack . show $ pathExists)<> "; parent dir = " <> (pack . encodeString $ parent cfgFile)<> "; dir contents = " <> (pack . show $ files) - replacement in server/Aftok/QConfig.hs at line 49
readQConfig cfg dbEnvCfgconf <- readQConfig cfg dbEnvCfgputStrLn $ "Config loaded successfully."pure conf - edit in server/Aftok/QConfig.hs at line 64
<*> C.require cfg "networkMode" - replacement in server/Aftok/QConfig.hs at line 67
SC.setHostname (hostname qc) .SC.setPort (port qc)SC.setHostname (qc ^. hostname) .SC.setPort (qc ^. port) - replacement in server/Aftok/Snaplet/Projects.hs at line 85
let SmtpConfig{..} = QC.smtpConfig cfglet SmtpConfig{..} = cfg ^. QC.smtpConfig - replacement in server/Aftok/Snaplet/Projects.hs at line 87
in buildProjectInviteEmail (templatePath cfg) pn fromEmail toEmail invCode >>=in buildProjectInviteEmail (cfg ^. templatePath) pn fromEmail toEmail invCode >>= - replacement in server/Aftok/Snaplet/Projects.hs at line 97
buildProjectInviteEmail templatePath pn fromEmail toEmail invCode = dotemplates <- directoryGroup $ encodeString templatePathbuildProjectInviteEmail tpath pn fromEmail toEmail invCode = dotemplates <- directoryGroup $ encodeString tpath - edit in server/Main.hs at line 5
import Control.Lens ((^.), to) - edit in server/Main.hs at line 16[43.943][3.36813]
import qualified Aftok.Config as C - replacement in server/Main.hs at line 44[4.11874]→[4.37961:38079](∅→∅),[4.19237]→[4.12521:12579](∅→∅),[4.38079]→[4.12521:12579](∅→∅),[4.12521]→[4.12521:12579](∅→∅)
initCookieSessionManager (encodeString $ authSiteKey cfg) "quookie" (Just "aftok.com") (cookieTimeout cfg)pgs <- nestSnaplet "db" db $ pgsInit' (pgsConfig cfg)initCookieSessionManager (cfg ^. authSiteKey . to encodeString)"quookie"(Just "aftok.com")(cfg ^. cookieTimeout)pgs <- nestSnaplet "db" db $ pgsInit' (cfg ^. pgsConfig) - replacement in server/Main.hs at line 51
let nmode = Q.networkMode cfglet nmode = cfg ^. billingConfig . C.networkMode - replacement in server/Main.hs at line 83
submitPaymentRoute = serveJSON paymentIdJSON $ method POST (paymentResponseHandler $ billingConfig cfg)submitPaymentRoute = serveJSON paymentIdJSON $ method POST (paymentResponseHandler $ cfg ^. billingConfig) - replacement in server/Main.hs at line 85
addRoutes [ ("static", serveDirectory . encodeString $ staticAssetPath cfg)addRoutes [ ("static", serveDirectory . encodeString $ cfg ^. staticAssetPath)