Merge pull request #789 from ocdtrekkie/upstream-sandstorm

Upstream Sandstorm build files
This commit is contained in:
Simon Michael 2018-06-06 07:57:48 -07:00 committed by GitHub
commit 8226335c4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 717 additions and 0 deletions

4
.gitignore vendored
View File

@ -73,4 +73,8 @@ hledger-web/static/tmp/
hledger-web/yesod-devel/
.hledger-web_client_session_key.aes
# sandstorm stuff
.vagrant
*.spk
# recent stuff

111
.sandstorm/Vagrantfile vendored Normal file
View File

@ -0,0 +1,111 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Guess at a reasonable name for the VM based on the folder vagrant-spk is
# run from. The timestamp is there to avoid conflicts if you have multiple
# folders with the same name.
VM_NAME = File.basename(File.dirname(File.dirname(__FILE__))) + "_sandstorm_#{Time.now.utc.to_i}"
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
# ugly hack to prevent hashicorp's bitrot. See https://github.com/hashicorp/vagrant/issues/9442
# this setting is required for pre-2.0 vagrant, but causes an error as of 2.0.3,
# remove entirely when confident nobody uses vagrant 1.x for anything.
unless Vagrant::DEFAULT_SERVER_URL.frozen?
Vagrant::DEFAULT_SERVER_URL.replace('https://vagrantcloud.com')
end
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Base on the Sandstorm snapshots of the official Debian 9 (stretch) box with vboxsf support.
config.vm.box = "debian/contrib-stretch64"
config.vm.box_version = "9.3.0"
if Vagrant.has_plugin?("vagrant-vbguest") then
# vagrant-vbguest is a Vagrant plugin that upgrades
# the version of VirtualBox Guest Additions within each
# guest. If you have the vagrant-vbguest plugin, then it
# needs to know how to compile kernel modules, etc., and so
# we give it this hint about operating system type.
config.vm.guest = "debian"
end
# We forward port 6080, the Sandstorm web port, so that developers can
# visit their sandstorm app from their browser as local.sandstorm.io:6080
# (aka 127.0.0.1:6080).
config.vm.network :forwarded_port, guest: 6080, host: 6080, host_ip: "127.0.0.1"
# Use a shell script to "provision" the box. This installs Sandstorm using
# the bundled installer.
config.vm.provision "shell", inline: "sudo bash /opt/app/.sandstorm/global-setup.sh", keep_color: true
# Then, do stack-specific and app-specific setup.
config.vm.provision "shell", inline: "sudo bash /opt/app/.sandstorm/setup.sh", keep_color: true
# Shared folders are configured per-provider since vboxsf can't handle >4096 open files,
# NFS requires privilege escalation every time you bring a VM up,
# and 9p is only available on libvirt.
# Calculate the number of CPUs and the amount of RAM the system has,
# in a platform-dependent way; further logic below.
cpus = nil
total_kB_ram = nil
host = RbConfig::CONFIG['host_os']
if host =~ /darwin/
cpus = `sysctl -n hw.ncpu`.to_i
total_kB_ram = `sysctl -n hw.memsize`.to_i / 1024
elsif host =~ /linux/
cpus = `nproc`.to_i
total_kB_ram = `grep MemTotal /proc/meminfo | awk '{print $2}'`.to_i
elsif host =~ /mingw/
# powershell may not be available on Windows XP and Vista, so wrap this in a rescue block
begin
cpus = `powershell -Command "(Get-WmiObject Win32_Processor -Property NumberOfLogicalProcessors | Select-Object -Property NumberOfLogicalProcessors | Measure-Object NumberOfLogicalProcessors -Sum).Sum"`.to_i
total_kB_ram = `powershell -Command "Get-CimInstance -class cim_physicalmemory | % $_.Capacity}"`.to_i / 1024
rescue
end
end
# Use the same number of CPUs within Vagrant as the system, with 1
# as a default.
#
# Use at least 512MB of RAM, and if the system has more than 2GB of
# RAM, use 1/4 of the system RAM. This seems a reasonable compromise
# between having the Vagrant guest operating system not run out of
# RAM entirely (which it basically would if we went much lower than
# 512MB) and also allowing it to use up a healthily large amount of
# RAM so it can run faster on systems that can afford it.
if cpus.nil? or cpus.zero?
cpus = 1
end
if total_kB_ram.nil? or total_kB_ram < 2048000
assign_ram_mb = 512
else
assign_ram_mb = (total_kB_ram / 1024 / 2)
end
# Actually apply these CPU/memory values to the providers.
config.vm.provider :virtualbox do |vb, override|
vb.cpus = cpus
vb.memory = assign_ram_mb
vb.name = VM_NAME
vb.customize ["modifyvm", :id, "--nictype1", "Am79C973"]
# /opt/app and /host-dot-sandstorm are used by vagrant-spk
override.vm.synced_folder "..", "/opt/app"
override.vm.synced_folder ENV["HOME"] + "/.sandstorm", "/host-dot-sandstorm"
# /vagrant is not used by vagrant-spk; we need this line so it gets disabled; if we removed the
# line, vagrant would automatically insert a synced folder in /vagrant, which is not what we want.
override.vm.synced_folder "..", "/vagrant", disabled: true
end
config.vm.provider :libvirt do |libvirt, override|
libvirt.cpus = cpus
libvirt.memory = assign_ram_mb
libvirt.default_prefix = VM_NAME
# /opt/app and /host-dot-sandstorm are used by vagrant-spk
override.vm.synced_folder "..", "/opt/app", type: "9p", accessmode: "passthrough"
override.vm.synced_folder ENV["HOME"] + "/.sandstorm", "/host-dot-sandstorm", type: "9p", accessmode: "passthrough"
# /vagrant is not used by vagrant-spk; we need this line so it gets disabled; if we removed the
# line, vagrant would automatically insert a synced folder in /vagrant, which is not what we want.
override.vm.synced_folder "..", "/vagrant", type: "9p", accessmode: "passthrough", disabled: true
end
end

51
.sandstorm/appGrid.svg Normal file
View File

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="-415 217 128 128" style="enable-background:new -415 217 128 128;" xml:space="preserve">
<style type="text/css">
.st0{opacity:0.6;fill:#D6D2CC;}
.st1{fill:#D87E12;}
.st2{fill:#B26508;}
.st3{fill:url(#SVGID_1_);}
.st4{fill:#F4B519;stroke:#EDA421;stroke-width:0.5;stroke-miterlimit:10;}
.st5{fill:#FFE54A;}
.st6{fill:#EDA421;}
</style>
<path class="st0" d="M-294.3,345h-108.5c-4,0-7.3-3.2-7.3-7.3V229.2c0-4,3.2-7.3,7.3-7.3h108.5c4,0,7.3,3.2,7.3,7.3v108.5
C-287,341.7-290.2,345-294.3,345z"/>
<path class="st1" d="M-299.6,338h-109.8c-3.1,0-5.6-2.5-5.6-5.6V222.6c0-3.1,2.5-5.6,5.6-5.6h109.8c3.1,0,5.6,2.5,5.6,5.6v109.8
C-294,335.5-296.5,338-299.6,338z"/>
<circle class="st2" cx="-352.5" cy="280" r="48.2"/>
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="-330.3968" y1="319.248" x2="-378.6032" y2="235.752">
<stop offset="0" style="stop-color:#F9C21E"/>
<stop offset="1" style="stop-color:#F9DB5E"/>
</linearGradient>
<circle class="st3" cx="-354.5" cy="277.5" r="48.2"/>
<circle class="st4" cx="-354.5" cy="277.3" r="41.5"/>
<g>
<path class="st1" d="M-339.4,267c-0.3-0.3-0.8-0.7-1.6-1.2c-0.8-0.5-1.7-1-2.8-1.5c-1.1-0.5-2.3-1-3.6-1.4
c-1.3-0.4-2.7-0.7-4.1-0.8v12.5l1.8,0.4c2.5,0.7,4.8,1.4,6.8,2.2c2.1,0.8,3.8,1.7,5.2,2.9c1.4,1.2,2.5,2.5,3.3,4.2
c0.8,1.6,1.2,3.6,1.2,6c0,2.7-0.5,4.9-1.4,6.8s-2.2,3.4-3.8,4.6c-1.6,1.2-3.5,2.1-5.6,2.7c-2.1,0.6-4.4,1-6.7,1v8h-4.3v-8
c-3.4-0.2-6.7-0.9-9.9-2.1c-3.2-1.1-6.2-2.6-8.8-4.5l4.4-8.6c0.4,0.4,1,0.9,2,1.5c0.9,0.6,2.1,1.3,3.4,1.9c1.4,0.6,2.8,1.2,4.5,1.7
c1.6,0.5,3.3,0.9,5,1v-12.5l-2.7-0.7c-2.5-0.7-4.6-1.4-6.4-2.2c-1.8-0.8-3.3-1.7-4.5-2.8c-1.2-1.1-2.1-2.3-2.7-3.8
c-0.6-1.4-0.9-3.2-0.9-5.1c0-2.5,0.4-4.6,1.3-6.6c0.8-1.9,2-3.5,3.5-4.9c1.5-1.3,3.2-2.4,5.3-3.2c2-0.8,4.2-1.3,6.6-1.4v-7.4h4.3
v7.3c3.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-363.1,265.7z M-345.5,289.2c0-1.7-0.7-3-2-3.9c-1.4-0.9-3.2-1.8-5.6-2.5v11.7
C-348,294.3-345.5,292.6-345.5,289.2z"/>
</g>
<g>
<path class="st6" d="M-353.5,236.8c10.9,0,22.3,5.7,29.7,12.5c-8.2-9-20.4-14.3-33.7-13.4c-20.5,1.4-37.1,18-38.6,38.6
c-0.9,13.3,4.4,25.5,13.4,33.7c-6.8-7.4-12.5-18.9-12.5-29.7C-395.2,255.4-376.6,236.8-353.5,236.8z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.4 KiB

25
.sandstorm/build.sh Executable file
View File

@ -0,0 +1,25 @@
#!/bin/bash
set -euo pipefail
# This script is run in the VM each time you run `vagrant-spk dev`. This is
# the ideal place to invoke anything which is normally part of your app's build
# process - transforming the code in your repository into the collection of files
# which can actually run the service in production
#
# Some examples:
#
# * For a C/C++ application, calling
# ./configure && make && make install
# * For a Python application, creating a virtualenv and installing
# app-specific package dependencies:
# virtualenv /opt/app/env
# /opt/app/env/bin/pip install -r /opt/app/requirements.txt
# * Building static assets from .less or .sass, or bundle and minify JS
# * Collecting various build artifacts or assets into a deployment-ready
# directory structure
# By default, this script does nothing. You'll have to modify it as
# appropriate for your application.
cd /opt/app
stack setup
stack install hledger-web
sudo cp /home/vagrant/.local/bin/hledger-web /usr/local/bin

15
.sandstorm/changelog.md Normal file
View File

@ -0,0 +1,15 @@
# V1.9.2 (2018-06-05)
* Upgrade to HLedger 1.9.2
# V1.1-sandstorm2 (2017-03-21)
* Upgrade to HLedger 1.1
# V1.0.1-sandstorm1 (2016-11-15)
* Upgrade to HLedger 1.0.1
# V0
* Initial release

View File

@ -0,0 +1,5 @@
hledger (http://hledger.org) is a dependable, precise, cross-platform program for tracking money, time, or any other commodity, using double-entry accounting and a simple plain text file format. It is a haskell reimplementation of Ledger, provides command-line, curses and web interfaces, and aims to be a robust, practical tool for daily use.
In double-entry accounting, each transaction must be balanced: An equal amount added to one account must be subtracted from another. You may wish to consult hledger documentation or other tutorials on the web to learn how to use double-entry accounting.
Sandstorm users, thanks for your feedback. hledger's web UI is a simple one to fit current development resources, and I'm sorry that Sandstorm integration is lacking. Your help is needed. We have an open issue for this where you can add a bounty or contribute patches (https://github.com/simonmichael/hledger/issues/425). We also welcome bug reports with more detail (http://bugs.hledger.org/new), general hledger-web improvements, backers and sponsors (http://hledger.org).

View File

@ -0,0 +1,48 @@
#!/bin/bash
set -euo pipefail
# Set options for curl. Since we only want to show errors from these curl commands, we also use
# 'cat' to buffer the output; for more information:
# https://github.com/sandstorm-io/vagrant-spk/issues/158
CURL_OPTS="--silent --show-error"
echo localhost > /etc/hostname
hostname localhost
# Install curl that is needed below.
apt-get update
apt-get install -y curl
# The following line copies stderr through stderr to cat without accidentally leaving it in the
# output file. Be careful when changing. See: https://github.com/sandstorm-io/vagrant-spk/pull/159
curl $CURL_OPTS https://install.sandstorm.io/ 2>&1 > /host-dot-sandstorm/caches/install.sh | cat
SANDSTORM_CURRENT_VERSION=$(curl $CURL_OPTS -f "https://install.sandstorm.io/dev?from=0&type=install")
SANDSTORM_PACKAGE="sandstorm-$SANDSTORM_CURRENT_VERSION.tar.xz"
if [[ ! -f /host-dot-sandstorm/caches/$SANDSTORM_PACKAGE ]] ; then
echo -n "Downloading Sandstorm version ${SANDSTORM_CURRENT_VERSION}..."
curl $CURL_OPTS --output "/host-dot-sandstorm/caches/$SANDSTORM_PACKAGE.partial" "https://dl.sandstorm.io/$SANDSTORM_PACKAGE" 2>&1 | cat
mv "/host-dot-sandstorm/caches/$SANDSTORM_PACKAGE.partial" "/host-dot-sandstorm/caches/$SANDSTORM_PACKAGE"
echo "...done."
fi
if [ ! -e /opt/sandstorm/latest/sandstorm ] ; then
echo -n "Installing Sandstorm version ${SANDSTORM_CURRENT_VERSION}..."
bash /host-dot-sandstorm/caches/install.sh -d -e "/host-dot-sandstorm/caches/$SANDSTORM_PACKAGE" >/dev/null
echo "...done."
fi
modprobe ip_tables
# Make the vagrant user part of the sandstorm group so that commands like
# `spk dev` work.
usermod -a -G 'sandstorm' 'vagrant'
# Bind to all addresses, so the vagrant port-forward works.
sudo sed --in-place='' \
--expression='s/^BIND_IP=.*/BIND_IP=0.0.0.0/' \
/opt/sandstorm/sandstorm.conf
sudo service sandstorm restart
# Enable apt-cacher-ng proxy to make things faster if one appears to be running on the gateway IP
GATEWAY_IP=$(ip route | grep ^default | cut -d ' ' -f 3)
if nc -z "$GATEWAY_IP" 3142 ; then
echo "Acquire::http::Proxy \"http://$GATEWAY_IP:3142\";" > /etc/apt/apt.conf.d/80httpproxy
fi
# Configure apt to retry fetching things that fail to download.
echo "APT::Acquire::Retries \"10\";" > /etc/apt/apt.conf.d/80sandstorm-retry

48
.sandstorm/grain.svg Normal file
View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="-467 269 24 24" style="enable-background:new -467 269 24 24;" xml:space="preserve">
<style type="text/css">
.st0{fill:#B26508;}
.st1{fill:url(#SVGID_1_);}
.st2{fill:#F4B519;stroke:#EDA421;stroke-width:0.5;stroke-miterlimit:10;}
.st3{fill:#D87E12;}
.st4{fill:#FFE54A;}
.st5{fill:#EDA421;}
</style>
<g>
<circle class="st0" cx="-454.8" cy="281.5" r="11.1"/>
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="-449.6649" y1="290.5602" x2="-460.801" y2="271.2719">
<stop offset="0" style="stop-color:#F9C21E"/>
<stop offset="1" style="stop-color:#F9DB5E"/>
</linearGradient>
<circle class="st1" cx="-455.2" cy="280.9" r="11.1"/>
<circle class="st2" cx="-455.2" cy="280.9" r="9.6"/>
<g>
<path class="st3" d="M-451.8,278.5c-0.1-0.1-0.2-0.2-0.4-0.3c-0.2-0.1-0.4-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.5c0.5,0.2,0.9,0.4,1.2,0.7c0.3,0.3,0.6,0.6,0.8,1
c0.2,0.4,0.3,0.8,0.3,1.4c0,0.6-0.1,1.1-0.3,1.6c-0.2,0.4-0.5,0.8-0.9,1.1c-0.4,0.3-0.8,0.5-1.3,0.6c-0.5,0.1-1,0.2-1.6,0.2v1.8
h-1v-1.9c-0.8-0.1-1.5-0.2-2.3-0.5c-0.7-0.3-1.4-0.6-2-1l1-2c0.1,0.1,0.2,0.2,0.5,0.4c0.2,0.1,0.5,0.3,0.8,0.4
c0.3,0.1,0.7,0.3,1,0.4c0.4,0.1,0.8,0.2,1.2,0.2v-2.9l-0.6-0.2c-0.6-0.2-1.1-0.3-1.5-0.5c-0.4-0.2-0.8-0.4-1-0.6
c-0.3-0.2-0.5-0.5-0.6-0.9c-0.1-0.3-0.2-0.7-0.2-1.2c0-0.6,0.1-1.1,0.3-1.5c0.2-0.4,0.5-0.8,0.8-1.1c0.3-0.3,0.7-0.5,1.2-0.7
c0.5-0.2,1-0.3,1.5-0.3v-1.7h1v1.7c0.7,0.1,1.4,0.2,2,0.5c0.6,0.3,1.2,0.5,1.6,0.8L-452.1,278z M-457.2,278.2
c0,0.4,0.1,0.7,0.4,0.9c0.3,0.2,0.7,0.4,1.2,0.5v-2.7C-456.7,276.9-457.2,277.4-457.2,278.2z M-453.1,283.6c0-0.4-0.2-0.7-0.5-0.9
c-0.3-0.2-0.7-0.4-1.3-0.6v2.7C-453.7,284.8-453.1,284.4-453.1,283.6z"/>
</g>
<g>
<path class="st5" d="M-455,271.5c2.5,0,5.2,1.3,6.9,2.9c-1.9-2.1-4.7-3.3-7.8-3.1c-4.7,0.3-8.6,4.2-8.9,8.9
c-0.2,3.1,1,5.9,3.1,7.8c-1.6-1.7-2.9-4.4-2.9-6.9C-464.6,275.8-460.3,271.5-455,271.5z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

32
.sandstorm/launcher.sh Executable file
View File

@ -0,0 +1,32 @@
#!/bin/bash
set -euo pipefail
# This script is run every time an instance of our app - aka grain - starts up.
# This is the entry point for your application both when a grain is first launched
# and when a grain resumes after being previously shut down.
#
# This script is responsible for launching everything your app needs to run. The
# thing it should do *last* is:
#
# * Start a process in the foreground listening on port 8000 for HTTP requests.
#
# This is how you indicate to the platform that your application is up and
# ready to receive requests. Often, this will be something like nginx serving
# static files and reverse proxying for some other dynamic backend service.
#
# Other things you probably want to do in this script include:
#
# * Building folder structures in /var. /var is the only non-tmpfs folder
# mounted read-write in the sandbox, and when a grain is first launched, it
# will start out empty. It will persist between runs of the same grain, but
# be unique per app instance. That is, two instances of the same app have
# separate instances of /var.
# * Preparing a database and running migrations. As your package changes
# over time and you release updates, you will need to deal with migrating
# data from previous schema versions to new ones, since users should not have
# to think about such things.
# * Launching other daemons your app needs (e.g. mysqld, redis-server, etc.)
mkdir -p /var/lib/hledger
touch /var/lib/hledger/Ledger
cd /var
hledger-web --serve --base-url='' -f /var/lib/hledger/Ledger --port 8000

47
.sandstorm/market.svg Normal file
View File

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="-404 206 150 150" style="enable-background:new -404 206 150 150;" xml:space="preserve">
<style type="text/css">
.st0{fill:#D87E12;}
.st1{fill:#B26508;}
.st2{fill:url(#SVGID_1_);}
.st3{fill:#F4B519;stroke:#EDA421;stroke-width:0.5;stroke-miterlimit:10;}
.st4{fill:#FFE54A;}
.st5{fill:#EDA421;}
</style>
<rect x="-404" y="206" class="st0" width="150" height="150"/>
<circle class="st1" cx="-326.5" cy="284.1" r="59.8"/>
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="-299.12" y1="332.7537" x2="-358.88" y2="229.2463">
<stop offset="0" style="stop-color:#F9C21E"/>
<stop offset="1" style="stop-color:#F9DB5E"/>
</linearGradient>
<circle class="st2" cx="-329" cy="281" r="59.8"/>
<circle class="st3" cx="-329" cy="280.8" r="51.5"/>
<g>
<path class="st0" d="M-310.3,267.9c-0.4-0.4-1-0.9-2-1.5c-1-0.6-2.2-1.2-3.5-1.8s-2.8-1.2-4.4-1.7c-1.6-0.5-3.3-0.9-5-1v15.5
l2.2,0.5c3.1,0.8,5.9,1.7,8.5,2.7c2.5,1,4.7,2.2,6.5,3.6c1.8,1.4,3.1,3.2,4.1,5.2c1,2,1.4,4.5,1.4,7.4c0,3.3-0.6,6.1-1.8,8.4
c-1.2,2.3-2.8,4.3-4.8,5.7c-2,1.5-4.3,2.6-7,3.4c-2.6,0.7-5.4,1.2-8.3,1.3v9.9h-5.4v-10c-4.2-0.3-8.3-1.2-12.3-2.6
c-4-1.4-7.6-3.2-10.9-5.5l5.5-10.7c0.5,0.5,1.3,1.1,2.5,1.9c1.2,0.8,2.6,1.6,4.3,2.3c1.7,0.8,3.5,1.5,5.5,2.1
c2,0.6,4.1,1.1,6.2,1.3v-15.4l-3.3-0.9c-3.1-0.8-5.7-1.8-7.9-2.7c-2.2-1-4.1-2.1-5.6-3.5c-1.5-1.3-2.6-2.9-3.4-4.7
c-0.7-1.8-1.1-3.9-1.1-6.4c0-3.1,0.5-5.8,1.6-8.1c1-2.4,2.5-4.4,4.3-6c1.8-1.6,4-2.9,6.5-3.9c2.5-1,5.2-1.6,8.2-1.8v-9.2h5.4v9.1
c3.9,0.3,7.5,1.1,10.8,2.5c3.3,1.3,6.2,2.9,8.8,4.5L-310.3,267.9z M-337.6,268.8c0,2,0.7,3.6,2.2,4.6c1.4,1,3.6,2,6.5,2.8v-14.5
C-334.7,262.1-337.6,264.5-337.6,268.8z M-315.8,298c0-2.1-0.8-3.7-2.5-4.8c-1.7-1.1-4-2.2-7-3.1v14.5
C-319,304.4-315.8,302.2-315.8,298z"/>
</g>
<g>
<path class="st4" d="M-312.3,265.4c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,253.7-356.3,230.5-327.8,230.5z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
.sandstorm/pgp-keyring Normal file

Binary file not shown.

1
.sandstorm/pgp-signature Normal file
View File

@ -0,0 +1 @@
£›ÀËÌÀÅè:AöOšE ãéÊ$†h1õ(O…Ä\…ŒT…ÄÒŒü"…ü40/81/¥¸$¿(W/3_!± @¡<³$,“Ÿ““_ž™—®àéb¥`Qah”aV`Pa<50>WT•mnœVhV•a”UQ^YU•\Ri^XœX<58>nž•n”[UnšgiÐÉhÌÂÀÈÅ +¦È"¸hÙ¬Ç/×)>ŠRs+Èa 07/Ùÿi3m¹þТ)<29>G,$î}Þ¶‰WŠÚ ú%Ö§-x™gÙ´àO£5¿FŸÄÆE¦±OŽ™äÍË<C38D> ½iðÈY®Ö½vU”äÔ5†2Õ—=YLd·V®*»=k Îÿis}ÄfnxwÕõ×½Og<E28098>fß®ÇqþãZ¶mßÝ\ÎîÒÑÓûê2_­ëá/µK™¦+¶¨ýÔ=¾:‡oÒ¿èŸoWÌ8mûJõˆ¡¶Í¯ãoNõâß9ÅýÔÖýÿÿèÖ¼­v±x·ò¬£<C2AC>»Wï±ö§·Ü_.t<|x…ŽeéYGÃÎ/·<>,¯ò|øŸìج“pŽ±oêÊðˆyìn÷ço{ð@Ã÷U{o˜+ZOùÔïòä„™ÍþŸ¦»

View File

@ -0,0 +1,57 @@
# *** WARNING: GENERATED FILE ***
# This file is automatically updated and rewritten in sorted order every time
# the app runs in dev mode. You may manually add or remove files, but don't
# expect comments or ordering to be retained.
bin/bash
bin/mkdir
bin/touch
etc/gai.conf
etc/ld.so.cache
etc/localtime
lib/terminfo/d/dumb
lib/x86_64-linux-gnu/ld-2.24.so
lib/x86_64-linux-gnu/libc-2.24.so
lib/x86_64-linux-gnu/libc.so.6
lib/x86_64-linux-gnu/libdl-2.24.so
lib/x86_64-linux-gnu/libdl.so.2
lib/x86_64-linux-gnu/libgcc_s.so.1
lib/x86_64-linux-gnu/libm-2.24.so
lib/x86_64-linux-gnu/libm.so.6
lib/x86_64-linux-gnu/libncurses.so.5
lib/x86_64-linux-gnu/libncurses.so.5.9
lib/x86_64-linux-gnu/libnsl-2.24.so
lib/x86_64-linux-gnu/libnsl.so.1
lib/x86_64-linux-gnu/libnss_compat-2.24.so
lib/x86_64-linux-gnu/libnss_compat.so.2
lib/x86_64-linux-gnu/libnss_files-2.24.so
lib/x86_64-linux-gnu/libnss_files.so.2
lib/x86_64-linux-gnu/libnss_nis-2.24.so
lib/x86_64-linux-gnu/libnss_nis.so.2
lib/x86_64-linux-gnu/libpcre.so.3
lib/x86_64-linux-gnu/libpcre.so.3.13.3
lib/x86_64-linux-gnu/libpthread-2.24.so
lib/x86_64-linux-gnu/libpthread.so.0
lib/x86_64-linux-gnu/librt-2.24.so
lib/x86_64-linux-gnu/librt.so.1
lib/x86_64-linux-gnu/libselinux.so.1
lib/x86_64-linux-gnu/libtinfo.so.5
lib/x86_64-linux-gnu/libtinfo.so.5.9
lib/x86_64-linux-gnu/libutil-2.24.so
lib/x86_64-linux-gnu/libutil.so.1
lib/x86_64-linux-gnu/libz.so.1
lib/x86_64-linux-gnu/libz.so.1.2.8
lib64/ld-linux-x86-64.so.2
opt/app/.sandstorm/launcher.sh
proc/cpuinfo
sandstorm-http-bridge
sandstorm-http-bridge-config
sandstorm-manifest
usr/bin/touch
usr/lib/x86_64-linux-gnu/gconv/UTF-32.so
usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache
usr/lib/x86_64-linux-gnu/libffi.so.6
usr/lib/x86_64-linux-gnu/libgmp.so.10
usr/lib/x86_64-linux-gnu/libgmp.so.10.3.2
usr/local/bin/hledger-web
usr/share/zoneinfo/GMT
usr/share/zoneinfo/GMT+0

View File

@ -0,0 +1,247 @@
@0xbc169f81a53d625c;
using Spk = import "/sandstorm/package.capnp";
# This imports:
# $SANDSTORM_HOME/latest/usr/include/sandstorm/package.capnp
# Check out that file to see the full, documented package definition format.
const pkgdef :Spk.PackageDefinition = (
# The package definition. Note that the spk tool looks specifically for the
# "pkgdef" constant.
id = "8x12h6p0x0nrzk73hfq6zh2jxtgyzzcty7qsatkg7jfg2mzw5n90",
# Your app ID is actually its public key. The private key was placed in
# your keyring. All updates must be signed with the same key.
manifest = (
# This manifest is included in your app package to tell Sandstorm
# about your app.
appTitle = (defaultText = "HLedger Web"),
appVersion = 3, # Increment this for every release.
appMarketingVersion = (defaultText = "1.9.2"),
# Human-readable representation of appVersion. Should match the way you
# identify versions of your app in documentation and marketing.
actions = [
# Define your "new document" handlers here.
( title = (defaultText = "New Ledger"),
command = .myCommand
# The command to run when starting for the first time. (".myCommand"
# is just a constant defined at the bottom of the file.)
)
],
continueCommand = .myCommand,
# This is the command called to start your app back up after it has been
# shut down for inactivity. Here we're using the same command as for
# starting a new instance, but you could use different commands for each
# case.
metadata = (
# Data which is not needed specifically to execute the app, but is useful
# for purposes like marketing and display. These fields are documented at
# https://docs.sandstorm.io/en/latest/developing/publishing-apps/#add-required-metadata
# and (in deeper detail) in the sandstorm source code, in the Metadata section of
# https://github.com/sandstorm-io/sandstorm/blob/master/src/sandstorm/package.capnp
icons = (
# Various icons to represent the app in various contexts.
appGrid = (svg = embed "appGrid.svg"),
grain = (svg = embed "grain.svg"),
market = (svg = embed "market.svg"),
#marketBig = (svg = embed "path/to/market-big-300x300.svg"),
),
website = "http://hledger.org",
# This should be the app's main website url.
codeUrl = "https://github.com/simonmichael/hledger",
# URL of the app's source code repository, e.g. a GitHub URL.
# Required if you specify a license requiring redistributing code, but optional otherwise.
license = (openSource = gpl3),
# The license this package is distributed under. See
# https://docs.sandstorm.io/en/latest/developing/publishing-apps/#license
categories = [office, productivity],
# A list of categories/genres to which this app belongs, sorted with best fit first.
# See the list of categories at
# https://docs.sandstorm.io/en/latest/developing/publishing-apps/#categories
author = (
# Fields relating to the author of this app.
contactEmail = "inbox@jacobweisz.com",
# Email address to contact for any issues with this app. This includes end-user support
# requests as well as app store administrator requests, so it is very important that this be a
# valid address with someone paying attention to it.
pgpSignature = embed "pgp-signature",
# PGP signature attesting responsibility for the app ID. This is a binary-format detached
# signature of the following ASCII message (not including the quotes, no newlines, and
# replacing <app-id> with the standard base-32 text format of the app's ID):
#
# "I am the author of the Sandstorm.io app with the following ID: <app-id>"
#
# You can create a signature file using `gpg` like so:
#
# echo -n "I am the author of the Sandstorm.io app with the following ID: <app-id>" | gpg --sign > pgp-signature
#
# Further details including how to set up GPG and how to use keybase.io can be found
# at https://docs.sandstorm.io/en/latest/developing/publishing-apps/#verify-your-identity
upstreamAuthor = "HLedger Team",
# Name of the original primary author of this app, if it is different from the person who
# produced the Sandstorm package. Setting this implies that the author connected to the PGP
# signature only "packaged" the app for Sandstorm, rather than developing the app.
# Remove this line if you consider yourself as the author of the app.
),
pgpKeyring = embed "pgp-keyring",
# A keyring in GPG keyring format containing all public keys needed to verify PGP signatures in
# this manifest (as of this writing, there is only one: `author.pgpSignature`).
#
# To generate a keyring containing just your public key, do:
#
# gpg --export <key-id> > keyring
#
# Where `<key-id>` is a PGP key ID or email address associated with the key.
description = (defaultText = embed "description.md"),
# The app's description description in Github-flavored Markdown format, to be displayed e.g.
# in an app store. Note that the Markdown is not permitted to contain HTML nor image tags (but
# you can include a list of screenshots separately).
shortDescription = (defaultText = "Web-based Accounting"),
# A very short (one-to-three words) description of what the app does. For example,
# "Document editor", or "Notetaking", or "Email client". This will be displayed under the app
# title in the grid view in the app market.
screenshots = [
# Screenshots to use for marketing purposes. Examples below.
# Sizes are given in device-independent pixels, so if you took these
# screenshots on a Retina-style high DPI screen, divide each dimension by two.
#(width = 746, height = 795, jpeg = embed "path/to/screenshot-1.jpeg"),
#(width = 640, height = 480, png = embed "path/to/screenshot-2.png"),
],
changeLog = (defaultText = embed "changelog.md"),
# Documents the history of changes in Github-flavored markdown format (with the same restrictions
# as govern `description`). We recommend formatting this with an H1 heading for each version
# followed by a bullet list of changes.
),
),
sourceMap = (
# Here we defined where to look for files to copy into your package. The
# `spk dev` command actually figures out what files your app needs
# automatically by running it on a FUSE filesystem. So, the mappings
# here are only to tell it where to find files that the app wants.
searchPath = [
( sourcePath = "." ), # Search this directory first.
( sourcePath = "/", # Then search the system root directory.
hidePaths = [ "home", "proc", "sys",
"etc/passwd", "etc/hosts", "etc/host.conf",
"etc/nsswitch.conf", "etc/resolv.conf" ]
# You probably don't want the app pulling files from these places,
# so we hide them. Note that /dev, /var, and /tmp are implicitly
# hidden because Sandstorm itself provides them.
)
]
),
fileList = "sandstorm-files.list",
# `spk dev` will write a list of all the files your app uses to this file.
# You should review it later, before shipping your app.
alwaysInclude = [],
# Fill this list with more names of files or directories that should be
# included in your package, even if not listed in sandstorm-files.list.
# Use this to force-include stuff that you know you need but which may
# not have been detected as a dependency during `spk dev`. If you list
# a directory here, its entire contents will be included recursively.
#bridgeConfig = (
# # Used for integrating permissions and roles into the Sandstorm shell
# # and for sandstorm-http-bridge to pass to your app.
# # Uncomment this block and adjust the permissions and roles to make
# # sense for your app.
# # For more information, see high-level documentation at
# # https://docs.sandstorm.io/en/latest/developing/auth/
# # and advanced details in the "BridgeConfig" section of
# # https://github.com/sandstorm-io/sandstorm/blob/master/src/sandstorm/package.capnp
# viewInfo = (
# # For details on the viewInfo field, consult "ViewInfo" in
# # https://github.com/sandstorm-io/sandstorm/blob/master/src/sandstorm/grain.capnp
#
# permissions = [
# # Permissions which a user may or may not possess. A user's current
# # permissions are passed to the app as a comma-separated list of `name`
# # fields in the X-Sandstorm-Permissions header with each request.
# #
# # IMPORTANT: only ever append to this list! Reordering or removing fields
# # will change behavior and permissions for existing grains! To deprecate a
# # permission, or for more information, see "PermissionDef" in
# # https://github.com/sandstorm-io/sandstorm/blob/master/src/sandstorm/grain.capnp
# (
# name = "editor",
# # Name of the permission, used as an identifier for the permission in cases where string
# # names are preferred. Used in sandstorm-http-bridge's X-Sandstorm-Permissions HTTP header.
#
# title = (defaultText = "editor"),
# # Display name of the permission, e.g. to display in a checklist of permissions
# # that may be assigned when sharing.
#
# description = (defaultText = "grants ability to modify data"),
# # Prose describing what this role means, suitable for a tool tip or similar help text.
# ),
# ],
# roles = [
# # Roles are logical collections of permissions. For instance, your app may have
# # a "viewer" role and an "editor" role
# (
# title = (defaultText = "editor"),
# # Name of the role. Shown in the Sandstorm UI to indicate which users have which roles.
#
# permissions = [true],
# # An array indicating which permissions this role carries.
# # It should be the same length as the permissions array in
# # viewInfo, and the order of the lists must match.
#
# verbPhrase = (defaultText = "can make changes to the document"),
# # Brief explanatory text to show in the sharing UI indicating
# # what a user assigned this role will be able to do with the grain.
#
# description = (defaultText = "editors may view all site data and change settings."),
# # Prose describing what this role means, suitable for a tool tip or similar help text.
# ),
# (
# title = (defaultText = "viewer"),
# permissions = [false],
# verbPhrase = (defaultText = "can view the document"),
# description = (defaultText = "viewers may view what other users have written."),
# ),
# ],
# ),
# #apiPath = "/api",
# # Apps can export an API to the world. The API is to be used primarily by Javascript
# # code and native apps, so it can't serve out regular HTML to browsers. If a request
# # comes in to your app's API, sandstorm-http-bridge will prefix the request's path with
# # this string, if specified.
#),
);
const myCommand :Spk.Manifest.Command = (
# Here we define the command used to start up your server.
argv = ["/sandstorm-http-bridge", "8000", "--", "/opt/app/.sandstorm/launcher.sh"],
environ = [
# Note that this defines the *entire* environment seen by your app.
(key = "PATH", value = "/usr/local/bin:/usr/bin:/bin"),
(key = "SANDSTORM", value = "1"),
# Export SANDSTORM=1 into the environment, so that apps running within Sandstorm
# can detect if $SANDSTORM="1" at runtime, switching UI and/or backend to use
# the app's Sandstorm-specific integration code.
]
);

25
.sandstorm/setup.sh Normal file
View File

@ -0,0 +1,25 @@
#!/bin/bash
set -euo pipefail
# This script is run in the VM once when you first run `vagrant-spk up`. It is
# useful for installing system-global dependencies. It is run exactly once
# over the lifetime of the VM.
#
# This is the ideal place to do things like:
#
# export DEBIAN_FRONTEND=noninteractive
# apt-get install -y nginx nodejs nodejs-legacy python2.7 mysql-server
#
# If the packages you're installing here need some configuration adjustments,
# this is also a good place to do that:
#
# sed --in-place='' \
# --expression 's/^user www-data/#user www-data/' \
# --expression 's#^pid /run/nginx.pid#pid /var/run/nginx.pid#' \
# --expression 's/^\s*error_log.*/error_log stderr;/' \
# --expression 's/^\s*access_log.*/access_log off;/' \
# /etc/nginx/nginx.conf
# By default, this script does nothing. You'll have to modify it as
# appropriate for your application.
apt-get install -y libtinfo-dev
curl -ssl https://get.haskellstack.org/ | sh

1
.sandstorm/stack Normal file
View File

@ -0,0 +1 @@
diy