Browse Source

Implement Heroku Button

pull/101/head
icoxfog417 6 years ago
parent
commit
78a7ad473e
4 changed files with 71 additions and 0 deletions
  1. 1
      Procfile
  2. 45
      app.json
  3. 8
      package.json
  4. 17
      tools/heroku.sh

1
Procfile

@ -0,0 +1 @@
web: gunicorn --pythonpath app app.wsgi

45
app.json

@ -0,0 +1,45 @@
{
"name": "doccano",
"description": "Open source text annotation tool for machine learning practitioner.",
"keywords": ["Python", "Machine Learning", "Annotation"],
"website": "https://doccano.herokuapp.com/",
"repository": "https://github.com/chakki-works/doccano",
"logo": "https://github.com/chakki-works/doccano/wiki/images/doccano.png",
"success_url": "/",
"env": {
"ADMIN_USER_NAME": {
"description": "The user name for the admin account."
},
"ADMIN_CONTACT_EMAIL": {
"description": "The contact email address for the admin account."
},
"ADMIN_PASSWORD": {
"description": "The password for the admin account."
},
"SECRET_KEY": {
"description": "The value to use as the Django secret key.",
"generator": "secret"
},
"GOOGLE_TRACKING_ID": {
"description": "Google Analytics tracking id.",
"required": false,
"value": ""
}
},
"scripts": {
"postdeploy": "sh tools/heroku.sh deploy"
},
"addons": [
{
"plan": "heroku-postgresql:hobby-dev"
}
],
"buildpacks": [
{
"url": "heroku/nodejs"
},
{
"url": "heroku/python"
}
]
}

8
package.json

@ -0,0 +1,8 @@
{
"engines": {
"node": "8.x"
},
"scripts": {
"heroku-postbuild": "sh tools/heroku.sh build"
}
}

17
tools/heroku.sh

@ -0,0 +1,17 @@
#!/usr/bin/env bash
set -o errexit
if [ "$1" = "build" ]; then
cd app/server
npm install --only=prod
npm install --only=dev
./node_modules/.bin/webpack --config ./webpack.config.js --mode production
echo "Done webpack build."
ls ./static/bundle
else
python app/manage.py migrate
python app/manage.py collectstatic --noinput
python app/manage.py create_admin --noinput --username="$ADMIN_USER_NAME" --email="$ADMIN_CONTACT_EMAIL" --password="$ADMIN_PASSWORD"
fi
Loading…
Cancel
Save