Skip to content
Snippets Groups Projects
Commit 6e5e8f5a authored by Tom Robinson's avatar Tom Robinson
Browse files

Add metabase-deploy script and addons to app.json

parent f5fa7fcb
No related branches found
No related tags found
No related merge requests found
......@@ -11,15 +11,14 @@
"repository": "https://github.com/metabase/metabase",
"logo": "https://avatars3.githubusercontent.com/u/10520629?v=3&s=200",
"success_url": "/setup",
"buildpacks": [
{
"url": "https://github.com/heroku/heroku-buildpack-nodejs"
},
{
"url": "https://github.com/heroku/heroku-buildpack-clojure"
}
],
"env": {
"NPM_CONFIG_LOGLEVEL": "info"
}
},
"addons": [
"heroku-postgresql",
"mailgun"
],
"buildpacks": [
{ "url": "https://github.com/heroku/heroku-buildpack-nodejs" },
{ "url": "https://github.com/heroku/heroku-buildpack-clojure" }
]
}
#!/usr/bin/env bash
set -eu
set -o pipefail
SRC_DIR="$PWD"
DEPLOY_DIR="$PWD/.metabase_deploy"
if [ "$#" -gt 0 ]; then
DEPLOY_TAG="$1"
else
DEPLOY_TAG="$(./bin/version | tr ' ' '_')"
fi
DEPLOY_REPO="git@github.com:metabase/metabase-deploy.git"
DEPLOY_REPO_SLUG="$(echo "$DEPLOY_REPO" | grep -Eo "[a-zA-Z0-9_-]+/[a-zA-Z0-9_-]+")"
DEPLOY_TREE="$DEPLOY_REPO_SLUG/tree/$DEPLOY_TAG"
# build the app
./bin/build
# clone the metabase-deploy repo
git clone "$DEPLOY_REPO" "$DEPLOY_DIR"
# copy required files over
FILES="Procfile app.json bin/start target/uberjar/metabase-standalone.jar"
for FILE in $FILES; do
mkdir -p "$DEPLOY_DIR/$(dirname $FILE)"
cp "$FILE" "$DEPLOY_DIR/$FILE"
done
# change to the deploy directory
cd "$DEPLOY_DIR"
# modify app.json to use null-buildpack since we're using a pre-compiled jar
node <<EOF
var fs = require("fs");
var app = JSON.parse(fs.readFileSync("app.json"));
app.buildpacks = [{ "url": "http://github.com/ryandotsmith/null-buildpack.git" }];
delete app.env.NPM_CONFIG_LOGLEVEL;
fs.writeFileSync("app.json", JSON.stringify(app, null, 2));
EOF
# generate a README
cat > README.md <<EOF
[![Deploy to Heroku](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/$DEPLOY_TREE)
EOF
# add, commit, tag, and push
git add .
git commit -m "Deploy $DEPLOY_TAG"
git tag "$DEPLOY_TAG"
git push --tags "$DEPLOY_REPO" master
# change back
cd "$SRC_DIR"
# pretend like this never happened
rm -rf "$DEPLOY_DIR"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment