diff --git a/stacks/meteor/build.sh b/stacks/meteor/build.sh index 1af0c05..2c207fd 100755 --- a/stacks/meteor/build.sh +++ b/stacks/meteor/build.sh @@ -3,12 +3,19 @@ set -euo pipefail # Make meteor bundle -METEOR_WAREHOUSE_DIR="${METEOR_WAREHOUSE_DIR:-/home/vagrant/.meteor}" -METEOR_DEV_BUNDLE=$(dirname $(readlink -f "$METEOR_WAREHOUSE_DIR/meteor"))/dev_bundle +export NODE_ENV=production +sudo chown vagrant:vagrant /home/vagrant -R cd /opt/app +meteor npm install --production meteor build --directory /home/vagrant/ -(cd /home/vagrant/bundle/programs/server && "$METEOR_DEV_BUNDLE/bin/npm" install) +# Use npm and node from the Meteor dev bundle to install the bundle's dependencies. +TOOL_VERSION=$(meteor show --ejson $(<.meteor/release) | grep '^ *"tool":' | + sed -re 's/^.*"(meteor-tool@[^"]*)".*$/\1/g') +TOOLDIR=$(echo $TOOL_VERSION | tr @ /) +PATH=$HOME/.meteor/packages/$TOOLDIR/mt-os.linux.x86_64/dev_bundle/bin:$PATH +cd /home/vagrant/bundle/programs/server +npm install --production # Copy our launcher script into the bundle so the grain can start up. mkdir -p /home/vagrant/bundle/opt/app/.sandstorm/ diff --git a/stacks/meteor/setup.sh b/stacks/meteor/setup.sh index 2f024b1..3794e51 100755 --- a/stacks/meteor/setup.sh +++ b/stacks/meteor/setup.sh @@ -6,10 +6,13 @@ set -euo pipefail CURL_OPTS="--silent --show-error" +apt-get update +apt-get install -y build-essential git cd /opt/ -PACKAGE=meteor-spk-0.1.8 +NODE_ENV=production +PACKAGE=meteor-spk-0.4.1 PACKAGE_FILENAME="$PACKAGE.tar.xz" CACHE_TARGET="/host-dot-sandstorm/caches/${PACKAGE_FILENAME}" @@ -36,7 +39,7 @@ cp -a /lib/x86_64-linux-gnu/libtinfo.so.* /opt/meteor-spk/meteor-spk.deps/lib/x8 # Unfortunately, Meteor does not explicitly make it easy to cache packages, but # we know experimentally that the package is mostly directly extractable to a # user's $HOME/.meteor directory. -METEOR_RELEASE=1.1.0.2 +METEOR_RELEASE=1.6.1.1 METEOR_PLATFORM=os.linux.x86_64 METEOR_TARBALL_FILENAME="meteor-bootstrap-${METEOR_PLATFORM}.tar.gz" METEOR_TARBALL_URL="https://d3sqy0vbqsdhku.cloudfront.net/packages-bootstrap/${METEOR_RELEASE}/${METEOR_TARBALL_FILENAME}" @@ -55,3 +58,4 @@ cd /home/vagrant/ su -c "tar xf '${METEOR_CACHE_TARGET}'" vagrant # Link into global PATH if [ ! -e /usr/bin/meteor ] ; then ln -s /home/vagrant/.meteor/meteor /usr/bin/meteor ; fi +chown vagrant:vagrant /home/vagrant -R