openplans / shareabouts

Shareabouts is a mapping application for crowdsourced info gathering.
GNU General Public License v3.0
276 stars 151 forks source link

Deploy to Heroku fails #175

Open stevenjan opened 7 years ago

stevenjan commented 7 years ago

Hi all - totally new to all of this but I'm looking to build a shareabouts platform for bicycle consultation for a local shire and went the easy route by clicking the 'Deploy to Heroku' button after signing up and paying at Heroky. It all comes to a halt when deploying the app in the 'Build app' dialogue box - any help would be greatly appreciated!

-----> Preparing static assets

Collectstatic configuration error. To debug, run:

$ heroku run python ./src/manage.py collectstatic --noinput

-----> Running post-compile hook

-----> In post-compile hook

-----> Collecting static files

Traceback (most recent call last):

django.core.exceptions.ImproperlyConfigured: Cannot determine PostGIS version for database "d6g2cig4dkmrbt". GeoDjango requires at least PostGIS version 1.3. Was the database created from a spatial database template?

! Push rejected, failed to compile Multipack app.

! Push failed

allthesignals commented 7 years ago

Same. Any luck?

stevenjan commented 7 years ago

Glad Im not the only one but still no luck....

Just tried a moment ago and still getting the same error.... help please anyone?

mjumbewu commented 7 years ago

Hey @allthesignals @stevenjan,

The issue here is that Shareabouts currently requires a geo-database (e.g., PostGIS). Heroku currently only supports postgis on production-teir databases. The deploy to heroku button tries to provision a free-tier database. I've started some work on allowing Shareabuts to use a spatial database only if it's installed (if anyone would like to help with that, please let me know!), but right now, in order to deploy on Heroku you'll need to:

  1. Updagrade the database, and
  2. Run CREATE EXTENSION postgis query on the database.
allthesignals commented 7 years ago

Thanks, @mjumbewu - do you know if it's possible to point the app to a remote spatially-enabled database? To solve this problem, we typically point Heroku apps to AWS-hosted database servers.

mjumbewu commented 7 years ago

@allthesignals that's totally possible. In the Heroku settings (e.g., https://dashboard.heroku.com/apps/[yourappname]/settings) you would want to update the DATABASE_URL environment variable to point to the remote database (something of the form postgis://[username]:[password]@[hostname.rds.amazon.com]/[databasename]). Then, you'll have to run the database migrations from a command line (say, heroku run -a [yourappname] src/manage.py migrate). That should be sufficient.

(everything in square brackets above is just an example and would need to be replaced by appropriate values)

allthesignals commented 7 years ago

Thanks, @mjumbewu - it worked. I had to follow the manual instructions here, but ignore the buildpacks part: https://github.com/openplans/shareabouts/blob/master/doc/DEPLOY.md#deploying-to-heroku-manually.

For others, the only buildpack I'm using is the one in the auto-deploy: https://github.com/ddollar/heroku-buildpack-multi.git. The instructions also call for installing rediscloud, so be sure to do that.

Thanks again!

BenSturmfels commented 1 year ago

I don't use Heroku myself, but I suspect that since they no longer provide a free-of-charge tier, this is likely no longer an issue. From my brief reading of the current https://devcenter.heroku.com/articles/heroku-postgres-extensions-postgis-full-text-search#postgis page, it looks like this should work on lowest-tier "essentials" accounts. Even if not, this is more of an operational issue than an issue with Shareabouts.

@mjumbewu I think this is issue is probably safe to close.