- 18.104.22.168.1. Install Heroku
- Already installed.
- 22.214.171.124.2. Add your SSH keys to Heroku
- Already done from an earlier project.
- 126.96.36.199.3. Verifying your Heroku account
- Grudgingly done. I didn't really want to hand out my credit card for this.
- 188.8.131.52.4. Setup Amazon S3
- Grudgingly done. (Later, in Step 9, I learned I should have selected US Standard as the region for my bucket.)
- 184.108.40.206.5. Setup environment variables
- As instructed, though I changed the admin password.
- 220.127.116.11.6. Download the Makahiki source
- Skipped this step, since I still have it from the local installation.
- 18.104.22.168.7. Initialize Makahiki
This was probably unnecessary, but: I wasn't sure if this initialization would mess up my existing local installation. I created a new virtualenv with
In the next step, I realized I also needed to run
pip install -r requirements.txtat this point.
The upload process took about 20 minutes or so.
- 22.214.171.124.8. Start the server
Everything loaded fine, but the pages lacked style and images. I checked my S3 bucket and it was empty. Trying again, I found this in the output:
Do you wish to continue (Y/n)? Y resetting the db... Resetting HEROKU_POSTGRESQL_RED_URL (DATABASE_URL)... done syncing and migrating db... Running `python makahiki/manage.py syncdb --noinput --migrate --verbosity 0` attached to terminal... up, run.4074 collecting static and media files... Traceback (most recent call last): File "/home/ztomasze/makahiki/makahiki/manage.py", line 9, in <module> from django.core.management import execute_from_command_line ImportError: No module named django.core.management s3put -q -a AKIAJC76TME6N23PKRMA -s [...omitted...] -b ztomasze-makahiki -g public-read -p `pwd` media sh: 1: s3put: not found s3put -q -a AKIAJC76TME6N23PKRMA -s [...omitted...] -b ztomasze-makahiki -g public-read -p `pwd`/site_media site_media/static sh: 1: s3put: not found loading base data...
Both django.core and the s3put commands seem to be missing. I remembered that I had created a new virtualenv, so I ran
pip install -r requirements.txtand tried again. Problem solved.
- 126.96.36.199.9. Verify that Makahiki is running
The links to images and stylesheets were still failing, even though the files were now in place on S3.
As an example, in the source code of the main page, the logo gif had this URL: https://s3.amazonaws.com/ztomasze-makahiki/static/images/old-logo.png
Accessing this URL directly got me this error message:
<Error> <Code>PermanentRedirect</Code> <Message> The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint. </Message> [...snip...] <Endpoint>ztomasze-makahiki.s3.amazonaws.com</Endpoint> </Error>
And indeed, accessing https://ztomasze-makahiki.s3.amazonaws.com/static/images/old-logo.png instead worked fine.
Feedback from Yongwen, the current Makahiki admin, suggested that this URL difference is due to which region you select when creating the S3 bucket. I originally went with S3's suggestion of Oregon, but apparently US Standard gives you the URLs assumed by Makahiki. To try this, I deleted and tried to recreate my bucket. There was a temporary name conflict, so I had to choose a different bucket name. I updated the MAKAHIKI_AWS_STORAGE_BUCKET_NAME environment variable and reinitialized Makahiki (step 7).
It looks like everything now works.
Conclusion: Total Time: 3 hours. This was longer than the local install, although there were fewer steps. This time difference was mainly due to waiting for downloads and uploads. Overall, this process was about as painful as any Heroku deployment, though each one gets easier with more practice.