From ffe92b7e3b0f75734b205c2ca7a2dad7c551b7e3 Mon Sep 17 00:00:00 2001 From: John Bintz <27256+johnbintz@users.noreply.github.com> Date: Sat, 12 Jun 2021 10:54:30 -0400 Subject: [PATCH] 0.83.1 extended and improve some automation --- .sandstorm/Vagrantfile | 26 ++++++++++++++------------ .sandstorm/app-marketing-version | 2 +- .sandstorm/global-setup.sh | 17 +++++++++++++++-- .sandstorm/sandstorm-files.list | 17 ++++++++++++----- .sandstorm/sandstorm-pkgdef.capnp | 2 +- .sandstorm/setup.sh | 2 +- CHANGELOG.md | 5 +++++ README.md | 8 ++++++++ bin/pack_hugo | 5 +++++ bin/publish_hugo | 10 ++++++++++ bin/test_hugo | 2 +- bin/upgrade_hugo | 2 +- hugo-version | 2 +- pages/index.vue | 2 +- 14 files changed, 76 insertions(+), 26 deletions(-) create mode 100755 bin/pack_hugo create mode 100755 bin/publish_hugo diff --git a/.sandstorm/Vagrantfile b/.sandstorm/Vagrantfile index 19502f2..22c02c2 100644 --- a/.sandstorm/Vagrantfile +++ b/.sandstorm/Vagrantfile @@ -1,6 +1,8 @@ # -*- mode: ruby -*- # vi: set ft=ruby : +# CAUTION: DO NOT MAKE CHANGES TO THIS FILE. The vagrant-spk upgradevm process will overwrite it. + # 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. @@ -9,14 +11,18 @@ VM_NAME = File.basename(File.dirname(File.dirname(__FILE__))) + "_sandstorm_#{Ti # 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 8 (jessie) box. + # Base on the Sandstorm snapshots of the official Debian 9 (stretch) box with vboxsf support. config.vm.box = "debian/contrib-buster64" - config.vm.box_version = ">= 0" + config.vm.post_up_message = "Your virtual server is running at http://local.sandstorm.io:6090." + if Vagrant.has_plugin?("vagrant-vbguest") then # vagrant-vbguest is a Vagrant plugin that upgrades @@ -27,10 +33,10 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 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 + # We forward port 6090, the vagrant-spk web port, so that developers can + # visit their Sandstorm app from their browser as local.sandstorm.io:6090 + # (aka 127.0.0.1:6090). + config.vm.network :forwarded_port, guest: 6090, host: 6090, host_ip: "127.0.0.1" # Use a shell script to "provision" the box. This installs Sandstorm using # the bundled installer. @@ -55,12 +61,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 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 + 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 "[math]::Round((Get-WmiObject -Class Win32_ComputerSystem).TotalPhysicalMemory)"`.to_i / 1024 end # Use the same number of CPUs within Vagrant as the system, with 1 # as a default. diff --git a/.sandstorm/app-marketing-version b/.sandstorm/app-marketing-version index bf72f28..de30871 100644 --- a/.sandstorm/app-marketing-version +++ b/.sandstorm/app-marketing-version @@ -1 +1 @@ -0.82.0~2021-03-25 +0.83.1~2021-05-02 diff --git a/.sandstorm/global-setup.sh b/.sandstorm/global-setup.sh index d08e19d..0122740 100755 --- a/.sandstorm/global-setup.sh +++ b/.sandstorm/global-setup.sh @@ -1,6 +1,9 @@ #!/bin/bash set -euo pipefail +# CAUTION: DO NOT MAKE CHANGES TO THIS FILE. The vagrant-spk upgradevm process will overwrite it. +# App-specific setup should be done in the setup.sh file. + # 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 @@ -8,9 +11,15 @@ set -euo pipefail CURL_OPTS="--silent --show-error" echo localhost > /etc/hostname hostname localhost + +# Grub updates don't silent install well +apt-mark hold grub-pc +apt-get update +apt-get upgrade -y + # Install curl that is needed below. -apt-get -y 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 @@ -25,7 +34,7 @@ if [[ ! -f /host-dot-sandstorm/caches/$SANDSTORM_PACKAGE ]] ; then 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 + bash /host-dot-sandstorm/caches/install.sh -d -e -p 6090 "/host-dot-sandstorm/caches/$SANDSTORM_PACKAGE" >/dev/null echo "...done." fi modprobe ip_tables @@ -36,6 +45,10 @@ usermod -a -G 'sandstorm' 'vagrant' sudo sed --in-place='' \ --expression='s/^BIND_IP=.*/BIND_IP=0.0.0.0/' \ /opt/sandstorm/sandstorm.conf + +# Force vagrant-spk to use the strict CSP, see sandstorm#3424 for details. +echo 'ALLOW_LEGACY_RELAXED_CSP=false' >> /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) diff --git a/.sandstorm/sandstorm-files.list b/.sandstorm/sandstorm-files.list index 25c08ae..7d069fe 100644 --- a/.sandstorm/sandstorm-files.list +++ b/.sandstorm/sandstorm-files.list @@ -9,7 +9,6 @@ etc/group etc/inputrc etc/ld.so.cache etc/localtime -etc/mailname etc/mime.types etc/python2.7/sitecustomize.py etc/ssl/openssl.cnf @@ -18,13 +17,13 @@ lib64 opt/app opt/app/.babelrc opt/app/.cloudcmd.menu.js -opt/app/.nuxt/dist/0.nuxt.bundle.47b21c7660f061fa62c7.js +opt/app/.nuxt/dist/0.nuxt.bundle.ff5d3c72edc61cda7156.js opt/app/.nuxt/dist/1.nuxt.bundle.89a9958091c34dcc68ed.js opt/app/.nuxt/dist/index.html -opt/app/.nuxt/dist/manifest.ce03c54105ef38282e06.js -opt/app/.nuxt/dist/nuxt.bundle.72f3ab16750ef4db3d3c.js +opt/app/.nuxt/dist/manifest.e172cc78b348e5bde134.js +opt/app/.nuxt/dist/nuxt.bundle.fc2156ddead258940f90.js opt/app/.nuxt/dist/server-bundle.json -opt/app/.nuxt/dist/vendor.bundle.ce03c54105ef38282e06.js +opt/app/.nuxt/dist/vendor.bundle.e172cc78b348e5bde134.js opt/app/.sandstorm/launcher.sh opt/app/README.md opt/app/hugo-version @@ -1898,10 +1897,14 @@ opt/app/node_modules/edward/modules/ace-builds/src-min/ace.js opt/app/node_modules/edward/modules/ace-builds/src-min/ext-language_tools.js opt/app/node_modules/edward/modules/ace-builds/src-min/ext-modelist.js opt/app/node_modules/edward/modules/ace-builds/src-min/ext-searchbox.js +opt/app/node_modules/edward/modules/ace-builds/src-min/mode-html.js opt/app/node_modules/edward/modules/ace-builds/src-min/mode-javascript.js +opt/app/node_modules/edward/modules/ace-builds/src-min/mode-json.js opt/app/node_modules/edward/modules/ace-builds/src-min/mode-markdown.js opt/app/node_modules/edward/modules/ace-builds/src-min/mode-toml.js opt/app/node_modules/edward/modules/ace-builds/src-min/theme-tomorrow_night_blue.js +opt/app/node_modules/edward/modules/ace-builds/src-min/worker-html.js +opt/app/node_modules/edward/modules/ace-builds/src-min/worker-json.js opt/app/node_modules/edward/package.json opt/app/node_modules/edward/server/edit.js opt/app/node_modules/edward/server/index.js @@ -4160,6 +4163,8 @@ usr/lib/node_modules/npm/node_modules/meant/index.js usr/lib/node_modules/npm/node_modules/meant/package.json usr/lib/node_modules/npm/node_modules/minimatch/minimatch.js usr/lib/node_modules/npm/node_modules/minimatch/package.json +usr/lib/node_modules/npm/node_modules/minimist/index.js +usr/lib/node_modules/npm/node_modules/minimist/package.json usr/lib/node_modules/npm/node_modules/mkdirp/index.js usr/lib/node_modules/npm/node_modules/mkdirp/package.json usr/lib/node_modules/npm/node_modules/node-fetch-npm/package.json @@ -4575,6 +4580,7 @@ usr/lib/x86_64-linux-gnu/libnsl-2.28.so usr/lib/x86_64-linux-gnu/libnsl.so.1 usr/lib/x86_64-linux-gnu/libnss_compat-2.28.so usr/lib/x86_64-linux-gnu/libnss_compat.so.2 +usr/lib/x86_64-linux-gnu/libnss_dns-2.28.so usr/lib/x86_64-linux-gnu/libnss_dns.so.2 usr/lib/x86_64-linux-gnu/libnss_files-2.28.so usr/lib/x86_64-linux-gnu/libnss_files.so.2 @@ -4590,6 +4596,7 @@ usr/lib/x86_64-linux-gnu/libpthread-2.28.so usr/lib/x86_64-linux-gnu/libpthread.so.0 usr/lib/x86_64-linux-gnu/libreadline.so.7 usr/lib/x86_64-linux-gnu/libreadline.so.7.0 +usr/lib/x86_64-linux-gnu/libresolv-2.28.so usr/lib/x86_64-linux-gnu/libresolv.so.2 usr/lib/x86_64-linux-gnu/librt-2.28.so usr/lib/x86_64-linux-gnu/librt.so.1 diff --git a/.sandstorm/sandstorm-pkgdef.capnp b/.sandstorm/sandstorm-pkgdef.capnp index 4253712..63e93b1 100644 --- a/.sandstorm/sandstorm-pkgdef.capnp +++ b/.sandstorm/sandstorm-pkgdef.capnp @@ -19,7 +19,7 @@ const pkgdef :Spk.PackageDefinition = ( appTitle = (defaultText = "Hugo"), - appVersion = 23, # Increment this for every release. + appVersion = 25, # Increment this for every release. appMarketingVersion = (defaultText = (embed "app-marketing-version")), # Human-readable representation of appVersion. Should match the way you diff --git a/.sandstorm/setup.sh b/.sandstorm/setup.sh index 9b00a27..7265ba4 100755 --- a/.sandstorm/setup.sh +++ b/.sandstorm/setup.sh @@ -43,6 +43,6 @@ apt-get install -y python-pip asciidoctor pip install pygments cd /tmp -wget https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_Linux-64bit.deb -O hugo.deb +wget https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_Linux-64bit.deb -O hugo.deb dpkg -i hugo.deb rm hugo.deb diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b4446a..979eab7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.83.1 (2021-06-12) + +* Upgrade Hugo to 0.83.1 extended +* More automation around packing/publish Hugo spk + ## 0.79.1 (2020-12-22) * Upgrade Hugo to 0.79.1 to deal with security issue diff --git a/README.md b/README.md index 7380dee..1f792a1 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ git clone https://github.com/sandstorm-io/vagrant-spk git clone https://github.com/johnbintz/hugo-sandstorm export PATH=$(pwd)/vagrant-spk:$PATH cd hugo-sandstorm +bin/test_hugo vagrant-spk vm up vagrant-spk dev ``` @@ -40,3 +41,10 @@ store you would need either the original app key or * You'll need Ruby 2.6 and `gem install httparty`. * Run `bin/upgrade_hugo `. * Follow the directions. + +## Pack and publish + +* Run `bin/pack_hugo` to create an spk in the parent directory to ths one +* Try loading that spk into a separate Sandstorm instance for testing +* If it works, run `bin/publish_hugo` to publish that version to the App Market + diff --git a/bin/pack_hugo b/bin/pack_hugo new file mode 100755 index 0000000..1db22c2 --- /dev/null +++ b/bin/pack_hugo @@ -0,0 +1,5 @@ +#!/bin/sh + +vagrant-spk vm up +vagrant-spk pack ../hugo-sandstorm-$(cat hugo-version).spk +vagrant-spk vm halt diff --git a/bin/publish_hugo b/bin/publish_hugo new file mode 100755 index 0000000..f22e654 --- /dev/null +++ b/bin/publish_hugo @@ -0,0 +1,10 @@ +#!/bin/sh + +if [ ! -f ../hugo-sandstorm-$(cat hugo-version).spk ]; then + echo "You need to bin/pack_hugo first!" + exit 1 +fi + +vagrant-spk vm up +vagrant-spk publish ../hugo-sandstorm-$(cat hugo-version).spk +vagrant-spk vm halt diff --git a/bin/test_hugo b/bin/test_hugo index 92fd769..48068c5 100755 --- a/bin/test_hugo +++ b/bin/test_hugo @@ -9,4 +9,4 @@ vagrant-spk dev echo "If everything went well:" echo -echo "vagrant-spk pack ../hugo-sandstorm.spk" +echo "bin/pack_hugo" diff --git a/bin/upgrade_hugo b/bin/upgrade_hugo index 5254819..5488142 100755 --- a/bin/upgrade_hugo +++ b/bin/upgrade_hugo @@ -11,7 +11,7 @@ unless version exit 1 end -verify_url = "https://github.com/gohugoio/hugo/releases/download/v#{version}/hugo_#{version}_Linux-64bit.deb" +verify_url = "https://github.com/gohugoio/hugo/releases/download/v#{version}/hugo_extended_#{version}_Linux-64bit.deb" response = HTTParty.get(verify_url) diff --git a/hugo-version b/hugo-version index 92fc430..2a04905 100644 --- a/hugo-version +++ b/hugo-version @@ -1 +1 @@ -0.82.0 +0.83.1 diff --git a/pages/index.vue b/pages/index.vue index 9a2b051..15469b3 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -1,6 +1,6 @@