diff --git a/Procfile b/Procfile new file mode 100644 index 00000000..ac3a3657 --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: gunicorn --pythonpath app app.wsgi diff --git a/README.md b/README.md index 6e29387d..5af4775a 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,11 @@ Doccano can be deployed to Azure ([Web App for Containers](https://azure.microso ### Heroku -Doccano can be deployed to [Heroku](https://www.heroku.com/) by following these steps: +Doccano can be deployed to [Heroku](https://www.heroku.com/) by clicking on the button below: + +[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy) + +Of course, you can deploy doccano by using [heroku-cli](https://devcenter.heroku.com/articles/heroku-cli). ```bash heroku create diff --git a/app.json b/app.json new file mode 100644 index 00000000..f47e8f2f --- /dev/null +++ b/app.json @@ -0,0 +1,50 @@ +{ + "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": "" + }, + "DEBUG": { + "description": "Debug mode or not.", + "required": false, + "value": "False" + } + }, + "scripts": { + "postdeploy": "sh tools/heroku.sh deploy" + }, + "addons": [ + { + "plan": "heroku-postgresql:hobby-dev" + } + ], + "buildpacks": [ + { + "url": "heroku/nodejs" + }, + { + "url": "heroku/python" + } + ] +} diff --git a/package.json b/package.json new file mode 100644 index 00000000..46116e60 --- /dev/null +++ b/package.json @@ -0,0 +1,8 @@ +{ + "engines": { + "node": "8.x" + }, + "scripts": { + "heroku-postbuild": "sh tools/heroku.sh build" + } +} diff --git a/requirements.txt b/requirements.txt index e8d2c90b..ddeac3b2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,7 +15,7 @@ flake8==3.6.0 gunicorn==19.9.0 mixer==6.1.3 model-mommy==1.6.0 -psycopg2==2.7.5 +psycopg2-binary==2.7.7 python-dateutil==2.7.3 pytz==2018.4 six==1.11.0 diff --git a/tools/heroku.sh b/tools/heroku.sh new file mode 100644 index 00000000..8c6535fd --- /dev/null +++ b/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