Last active
July 4, 2017 23:41
-
-
Save jamesbeedy/134e1dcc0fe3fefc6936ee9fbe194153 to your computer and use it in GitHub Desktop.
track snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: track | |
version: '0.1' | |
summary: CreativeDrive's Track. | |
description: | | |
This snap sprovides CreativeDrive's Track web application. | |
grade: devel | |
confinement: devmode | |
apps: | |
nginx: | |
plugs: [network,network-bind] | |
command: wrappers/start_nginx.sh | |
daemon: simple | |
apps: | |
rake: | |
command: wrappers/rake | |
railsc: | |
command: wrappers/railsc | |
parts: | |
track: | |
plugin: ruby | |
ruby-version: "2.3.1" | |
gems: [rack] | |
stage: | |
- bin | |
- usr | |
- lib | |
- track-app | |
- nginx | |
- passenger | |
prime: | |
- bin | |
- usr | |
- lib | |
- track-app | |
- nginx | |
- passenger | |
stage-packages: [libpq-dev, wget] | |
build-packages: [libpq-dev, wget] | |
install: | | |
# Export the vars | |
export LD_LIBRARY_PATH | |
LD_LIBRARY_PATH=$SNAPCRAFT_PART_INSTALL/lib:$SNAPCRAFT_PART_INSTALL/usr/lib/$(uname -p)-linux-gnu/ | |
export RUBYDIR=$SNAPCRAFT_PART_INSTALL/lib/ruby | |
export RUBYLIB=$RUBYDIR/2.3.0 | |
RUBYLIB=$RUBYLIB/x86_64-linux/:$RUBYLIB | |
export GEM_HOME=$RUBYDIR/gems/2.3.0 | |
export GEM_PATH=$RUBYDIR/gems/2.3.0 | |
export PASSENGER_BUILD_DIR=$SNAPCRAFT_PART_INSTALL/passenger | |
# Pull/build nginx-passenger | |
mkdir -p $PASSENGER_BUILD_DIR | |
wget https://www.phusionpassenger.com/latest_stable_tarball | |
tar -xzvf latest_stable_tarball -C $PASSENGER_BUILD_DIR --strip 1 | |
$PASSENGER_BUILD_DIR/bin/passenger-install-nginx-module --auto --auto-download --prefix=$SNAPCRAFT_PART_INSTALL/nginx | |
# Precompile application assets | |
$SNAPCRAFT_PART_INSTALL/bin/ruby $SNAPCRAFT_PART_INSTALL/bin/bundle exec $SNAPCRAFT_PART_INSTALL/bin/rake assets:precompile | |
mkdir -p $SNAPCRAFT_PART_INSTALL/track-app | |
cp -r ./* $SNAPCRAFT_PART_INSTALL/track-app/ | |
# Render the nginx conf | |
rm -f $SNAPCRAFT_PART_INSTALL/nginx/conf/nginx.conf.default | |
cp -r ./scripts/nginx.conf.snap.template $SNAPCRAFT_PART_INSTALL/nginx/conf/nginx.conf | |
wrappers: | |
plugin: dump | |
source: snap/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
export RAILS_ENV=production | |
exec "$SNAP/nginx/sbin/nginx" -c "$SNAP/nginx/conf/nginx.conf" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment