Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make heroku friendly #5

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

fembem
Copy link

@fembem fembem commented Jul 13, 2020

To make this app suitable for deploying to Heroku, I moved package.json to the root directory, as Heroku requires that.

To avoid then having to change a lot of require paths, I moved the contents of the server directory into the root directory as well, which is consistent with common practice. This app uses some server side templates, so can't be split up into a client and a server running on separate machines. Therefore eliminating the server directory has less downside to it.

Gulp and gulp plugin dependencies didn't specify a version, and the newest versions weren't compatible with the gulpfile.js code. The gulp file code doesn't work with version 4, so I set it to version 3, which is contemporaneous to the project code. Gulp version 3 is not compatible with the most recent node versions, so I set the node version to 11.15.0 in package.json. I also set all gulp plugin versions to ones contemporaneous with the project code.

Since Heroku has ephemeral storage, I added the ability to save image files to Mongo. The storage mode is decided at app launch by a config var or by an environment variable. On platforms with both storage options, switching between modes will not make previously uploaded images inaccessible, as the two storage modes use a different file path prefix.

The blog name and Disqus app name have also been extracted into config & environment variables for blog customization.

Lastly, I added an npm build task for the javascript and css assets, which Heroku will run automatically on app deploy.

@fembem fembem force-pushed the make-heroku-friendly branch from cf6f2ac to 1ed8079 Compare July 15, 2020 19:27
@fembem fembem force-pushed the make-heroku-friendly branch 4 times, most recently from 4babae5 to 711e57b Compare July 16, 2020 05:27
@fembem fembem force-pushed the make-heroku-friendly branch from 711e57b to 1a84e79 Compare July 16, 2020 05:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant