0.83.1 extended and improve some automation

This commit is contained in:
John Bintz 2021-06-12 10:54:30 -04:00
parent b427eed037
commit ffe92b7e3b
14 changed files with 76 additions and 26 deletions

View File

@ -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.

View File

@ -1 +1 @@
0.82.0~2021-03-25
0.83.1~2021-05-02

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 <new version>`.
* 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

5
bin/pack_hugo Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
vagrant-spk vm up
vagrant-spk pack ../hugo-sandstorm-$(cat hugo-version).spk
vagrant-spk vm halt

10
bin/publish_hugo Executable file
View File

@ -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

View File

@ -9,4 +9,4 @@ vagrant-spk dev
echo "If everything went well:"
echo
echo "vagrant-spk pack ../hugo-sandstorm.spk"
echo "bin/pack_hugo"

View File

@ -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)

View File

@ -1 +1 @@
0.82.0
0.83.1

View File

@ -1,6 +1,6 @@
<template>
<div>
<h1>hugo-sandstorm version {{hugoVersion}}</h1>
<h1>hugo-sandstorm version {{hugoVersion}} extended</h1>
<template v-if="isLoading">
<p>
Loading public site information. This may take a while!