What’s that? It’s time for another Deployment tutorial! The last three (trip planner, twitter.js and wikistack) went pretty well but here we have another challenge - seed media files on top of simply seeding a PostgreSQL database!
So the core instructions are sited at the wikistack tutorial. Do not push to heroku until i tell you to. Here I will focus on the incremental difference.
- to configure
process.env.DATABASE_URL
, go toserver/db/db.js
and add it in there alongsiderequire(path.join(__dirname, '../env')).DATABASE_URI
- old
pg
dependency is gone - remember to create a table in SQL. this time, call it
juke
. refer to the wikistack tutorial for instructions - ok so it gets tricky from here! We aren’t going to use webpack to rebuild the app on heroku so we need
public/bundle.js
to be served. delete that andpublic/bundle.map.js
from the.gitignore
so you will be able to push it to heroku. you may want to do this in a different branch (git checkout -b herokubranch
) so you still have the right gitignore for github, but i didn’t bother. (nothing secret inpublic
anyway). - remove the
postinstall
process frompackage.json
. you’ll seed your database manually… - Time to push to heroku!
git add . && git commit -m "heroku deploy"
. MAKE SURE BUNDLE.JS is ADDED!! and now when you push here the difference is you are pushing a specific BRANCH instead of master. However, heroku only runs master. how to do that?git push heroku <YOURBRANCHNAME>:master
. - ok hopefully that went well. to seed the db,
heroku run node ./bin/seed
heroku open
!
contact me @swyx on twitter if you run into any issues. My app is deployed here https://swyx-juke.herokuapp.com/#/