From 78a7ad473ef38bd7555df16fe0a247ec46eb9f00 Mon Sep 17 00:00:00 2001 From: icoxfog417 Date: Wed, 27 Feb 2019 15:47:52 +0900 Subject: [PATCH 1/3] Implement Heroku Button --- Procfile | 1 + app.json | 45 +++++++++++++++++++++++++++++++++++++++++++++ package.json | 8 ++++++++ tools/heroku.sh | 17 +++++++++++++++++ 4 files changed, 71 insertions(+) create mode 100644 Procfile create mode 100644 app.json create mode 100644 package.json create mode 100644 tools/heroku.sh 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/app.json b/app.json new file mode 100644 index 00000000..7f61deac --- /dev/null +++ b/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" + } + ] +} 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/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 From 474362741707bed2e2ecb4ba10a65541adf95f43 Mon Sep 17 00:00:00 2001 From: icoxfog417 Date: Thu, 28 Feb 2019 16:57:54 +0900 Subject: [PATCH 2/3] Update deployment description for Heroku --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 From b2f261bb8b9aa9f02f03faa01be4c7e455a5236b Mon Sep 17 00:00:00 2001 From: icoxfog417 Date: Thu, 28 Feb 2019 17:20:13 +0900 Subject: [PATCH 3/3] Add DEBUG environment variable for Heroku Button --- app.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app.json b/app.json index 7f61deac..f47e8f2f 100644 --- a/app.json +++ b/app.json @@ -24,6 +24,11 @@ "description": "Google Analytics tracking id.", "required": false, "value": "" + }, + "DEBUG": { + "description": "Debug mode or not.", + "required": false, + "value": "False" } }, "scripts": {