[OH-Dev] Notes from running OpenHatch on Heroku (patch attached)
Asheesh Laroia
asheesh at asheesh.org
Mon Feb 13 20:02:55 UTC 2012
(Skip this message if sysadminy/deployment-related thoughts aren't
interesting to you.)
I figured that the easiest way to put the OpenHatch redesign on the web
was to use Heroku.
(It's a (proprietary, hosted) web service that makes it easy to deploy web
apps, and has a free-of-cost entry-level account.
http://devcenter.heroku.com/articles/django explains their Django
support.)
Heroku lets one deploy Python apps, and ours is nearly ready to run there
as-is. It needed the following changes, which I have *not* pushed to the
main repo:
* manage.py moves to mysite/manage.py
* Create a 'requirements.txt' that adds a Postgres connector to our
dependencies
* Migrations need to get fixed to run on Postgres
I'm attaching a patch series that implements (in a rushed hackish way)
these changes. I think it'd be really swell to 1) fix OpenHatch so it can
run on Heroku easily, and 2) write documentation suggesting that. It's an
easy way to let any contributor put their OpenHatch instance up on the web
so others can see their changes.
(Since our migrations don't work right now, the patch series simply
disables South.)
If someone wants to look into this (I think armooo might be interested,
actually!), that would be swell. I'm not going to look into this any more
during February, I expect, but I would totally merge patches and give
feedback to anyone who wants to look into this.
I'm not thrilled that we have to move manage.py away from its current
location, which would break people's scripts. I guess we have to do it,
though, if we want to be Heroku-compatible.
-- Asheesh.
-------------- next part --------------
From 2671b20da5eafed8afbc7b6837f6357cca3f480d Mon Sep 17 00:00:00 2001
From: Asheesh Laroia <paulproteus at linode2.openhatch.org>
Date: Mon, 13 Feb 2012 18:38:11 +0000
Subject: [PATCH 01/10] ok
---
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 requirements.txt
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..e69de29
--
1.7.2.5
From e1da57c3907a1866e198acf5529f4f82656300e9 Mon Sep 17 00:00:00 2001
From: Asheesh Laroia <paulproteus at linode2.openhatch.org>
Date: Mon, 13 Feb 2012 18:39:50 +0000
Subject: [PATCH 02/10] y9ow
---
requirements.txt | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/requirements.txt b/requirements.txt
index e69de29..49fe098 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -0,0 +1 @@
+setuptools
--
1.7.2.5
From f4a966b5b17a06d0dcff0323e951d7a5170b3ffc Mon Sep 17 00:00:00 2001
From: Asheesh Laroia <paulproteus at linode2.openhatch.org>
Date: Mon, 13 Feb 2012 18:44:48 +0000
Subject: [PATCH 03/10] moving manage.py
---
manage.py | 15 ---------------
mysite/manage.py | 15 +++++++++++++++
2 files changed, 15 insertions(+), 15 deletions(-)
delete mode 100755 manage.py
create mode 100755 mysite/manage.py
diff --git a/manage.py b/manage.py
deleted file mode 100755
index 934bd2c..0000000
--- a/manage.py
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/env python
-# Use the modules in vendor/
-import vendor
-vendor.vendorify()
-
-# Now we can import from third-party libraries.
-from django.core.management import execute_manager, setup_environ
-
-import mysite.settings
-
-# The first thing execute_manager does is call `setup_environ`.
-setup_environ(mysite.settings)
-
-if __name__ == "__main__":
- execute_manager(mysite.settings)
diff --git a/mysite/manage.py b/mysite/manage.py
new file mode 100755
index 0000000..934bd2c
--- /dev/null
+++ b/mysite/manage.py
@@ -0,0 +1,15 @@
+#!/usr/bin/env python
+# Use the modules in vendor/
+import vendor
+vendor.vendorify()
+
+# Now we can import from third-party libraries.
+from django.core.management import execute_manager, setup_environ
+
+import mysite.settings
+
+# The first thing execute_manager does is call `setup_environ`.
+setup_environ(mysite.settings)
+
+if __name__ == "__main__":
+ execute_manager(mysite.settings)
--
1.7.2.5
From 51380b15e943c55a2e809589708286c97a741766 Mon Sep 17 00:00:00 2001
From: Asheesh Laroia <paulproteus at linode2.openhatch.org>
Date: Mon, 13 Feb 2012 18:47:39 +0000
Subject: [PATCH 04/10] yow
---
mysite/manage.py | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/mysite/manage.py b/mysite/manage.py
index 934bd2c..2aa71aa 100755
--- a/mysite/manage.py
+++ b/mysite/manage.py
@@ -1,4 +1,14 @@
#!/usr/bin/env python
+
+### We must chdir() up one level.
+import os
+import os.path
+import sys
+THIS_FILE=os.path.abspath(__file__)
+THIS_DIR=os.path.dirname(THIS_FILE)
+UP_ONE_DIR=os.path.join(THIS_DIR, '..')
+sys.path.append(UP_ONE_DIR)
+
# Use the modules in vendor/
import vendor
vendor.vendorify()
--
1.7.2.5
From c00e00d28745bc8f21e3bea40b6df611047474fb Mon Sep 17 00:00:00 2001
From: Asheesh Laroia <paulproteus at linode2.openhatch.org>
Date: Mon, 13 Feb 2012 18:49:31 +0000
Subject: [PATCH 05/10] for postgres
---
requirements.txt | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/requirements.txt b/requirements.txt
index 49fe098..a813e56 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1 +1,2 @@
setuptools
+psycopg2
--
1.7.2.5
From ad3032e9a751c6fea158d9a5176071e779f80e8a Mon Sep 17 00:00:00 2001
From: Asheesh Laroia <paulproteus at linode2.openhatch.org>
Date: Mon, 13 Feb 2012 19:01:02 +0000
Subject: [PATCH 06/10] zomg
---
.../migrations/0019_two_new_project_icon_fields.py | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/mysite/search/migrations/0019_two_new_project_icon_fields.py b/mysite/search/migrations/0019_two_new_project_icon_fields.py
index 344e37a..8100fee 100644
--- a/mysite/search/migrations/0019_two_new_project_icon_fields.py
+++ b/mysite/search/migrations/0019_two_new_project_icon_fields.py
@@ -37,6 +37,11 @@ class Migration:
pass
else:
raise
+ except django.db.utils.DatabaseError, e:
+ if str(e).endswith('already exists'):
+ pass
+ else:
+ raise
# Adding field 'Project.icon_raw'
db.add_column('search_project', 'icon_raw', orm['search.project:icon_raw'])
--
1.7.2.5
From ebaef653d5f84654f8d6e8feb15fb67475ba0602 Mon Sep 17 00:00:00 2001
From: Asheesh Laroia <paulproteus at linode2.openhatch.org>
Date: Mon, 13 Feb 2012 19:02:35 +0000
Subject: [PATCH 07/10] bam
---
.../migrations/0019_two_new_project_icon_fields.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/mysite/search/migrations/0019_two_new_project_icon_fields.py b/mysite/search/migrations/0019_two_new_project_icon_fields.py
index 8100fee..a62d0ce 100644
--- a/mysite/search/migrations/0019_two_new_project_icon_fields.py
+++ b/mysite/search/migrations/0019_two_new_project_icon_fields.py
@@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
+import django.db.utils
from south.db import db
from django.db import models
from mysite.search.models import *
--
1.7.2.5
From d21cbbb8479ec536d0235ea4d978e2fcd500ec8d Mon Sep 17 00:00:00 2001
From: Asheesh Laroia <paulproteus at linode2.openhatch.org>
Date: Mon, 13 Feb 2012 19:04:02 +0000
Subject: [PATCH 08/10] bam
---
.../migrations/0019_two_new_project_icon_fields.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/mysite/search/migrations/0019_two_new_project_icon_fields.py b/mysite/search/migrations/0019_two_new_project_icon_fields.py
index a62d0ce..06e7057 100644
--- a/mysite/search/migrations/0019_two_new_project_icon_fields.py
+++ b/mysite/search/migrations/0019_two_new_project_icon_fields.py
@@ -38,7 +38,7 @@ class Migration:
else:
raise
except django.db.utils.DatabaseError, e:
- if str(e).endswith('already exists'):
+ if 'already exists' in str(e):
pass
else:
raise
--
1.7.2.5
From 15a1821295a17356add2cdda31df68940aa9f9b4 Mon Sep 17 00:00:00 2001
From: Asheesh Laroia <paulproteus at linode2.openhatch.org>
Date: Mon, 13 Feb 2012 19:05:38 +0000
Subject: [PATCH 09/10] bam
---
.../migrations/0019_two_new_project_icon_fields.py | 14 --------------
1 files changed, 0 insertions(+), 14 deletions(-)
diff --git a/mysite/search/migrations/0019_two_new_project_icon_fields.py b/mysite/search/migrations/0019_two_new_project_icon_fields.py
index 06e7057..9ad98b4 100644
--- a/mysite/search/migrations/0019_two_new_project_icon_fields.py
+++ b/mysite/search/migrations/0019_two_new_project_icon_fields.py
@@ -29,20 +29,6 @@ class Migration:
def forwards(self, orm):
- try:
- # Adding field 'Bug.bize_size_tag_name'
- db.add_column('search_bug', 'bize_size_tag_name', orm['search.bug:bize_size_tag_name'])
- except OperationalError, args:
- if args[0] == 1060:
- pass
- else:
- raise
- except django.db.utils.DatabaseError, e:
- if 'already exists' in str(e):
- pass
- else:
- raise
-
# Adding field 'Project.icon_raw'
db.add_column('search_project', 'icon_raw', orm['search.project:icon_raw'])
--
1.7.2.5
From 33a418740cef5e9482db74d091907443da132fef Mon Sep 17 00:00:00 2001
From: Asheesh Laroia <paulproteus at linode2.openhatch.org>
Date: Mon, 13 Feb 2012 19:07:46 +0000
Subject: [PATCH 10/10] bam no south
---
mysite/settings.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/mysite/settings.py b/mysite/settings.py
index bfceb99..c8550b5 100644
--- a/mysite/settings.py
+++ b/mysite/settings.py
@@ -158,7 +158,7 @@ INSTALLED_APPS = (
'registration',
'django_authopenid',
'django_extensions',
- 'south',
+# 'south',
'django_assets',
'celery',
'invitation',
--
1.7.2.5
More information about the Devel
mailing list