From a37c9d1ab1f6b21871d120c490d9129cb7b72f94 Mon Sep 17 00:00:00 2001 From: taise Date: Thu, 28 Feb 2019 11:17:49 +0900 Subject: [PATCH 1/4] :wrench: fix psycopg2 warning by updating to psycopg2-binary wanring log ``` $ docker exec doccano tools/create-admin.sh "admin" "admin@example.com" "password" /usr/local/lib/python3.6/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: . """) /usr/local/lib/python3.6/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: . """) Operations to perform: Apply all migrations: admin, auth, contenttypes, server, sessions, social_django Running migrations: No migrations to apply. Superuser created successfully. /usr/local/lib/python3.6/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: . """) ``` normal(fixed) log ``` $ docker exec doccano tools/create-admin.sh "admin" "admin@example.com" "password" Operations to perform: Apply all migrations: admin, auth, contenttypes, server, sessions, social_django Running migrations: No migrations to apply. Superuser created successfully. ``` --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 7bc17c00..00e39ac1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,7 +10,7 @@ Faker==0.8.8 flake8==3.6.0 gunicorn==19.9.0 mixer==6.1.3 -psycopg2==2.7.5 +psycopg2-binary==2.7.7 python-dateutil==2.7.3 pytz==2018.4 six==1.11.0 From 78a7ad473ef38bd7555df16fe0a247ec46eb9f00 Mon Sep 17 00:00:00 2001 From: icoxfog417 Date: Wed, 27 Feb 2019 15:47:52 +0900 Subject: [PATCH 2/4] 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 3/4] 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 4/4] 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": {