Skip to content

Showcasing the world's largest collection of vintage postcards from Waltham, MA.

Notifications You must be signed in to change notification settings

joshuamcginnis/postalpast

Repository files navigation

PostalPast.com

Waltham Watch Company - FrontWaltham Watch Company - Back

PostalPast.com is a repository of postcards from the early 20th century collected by me (@joshuamcginnis) over the years.

Most postcards have a connection to Waltham, Massachusetts, USA which is often referred to as The Birthplace of the Industrial Revolution. Citation Needed

The website was primarily created as a way for me to track which postcards I already own so that I can easily search through my collection when looking for new postcards to collect.

In addition, my hope is that this projects affords me the ability to learn and implement:

  • A fully-tested and production-ready app to add to my portfolio
  • Server-side image processing using ImageMagick
  • Performance optimization techniques (caching, redis, etc)
  • Data Analysis and Charting of postcard metadata using R
  • Interactive UI / UX using modern javascript

Nothing would please me more than if local historians, other postcard collectors or the general public find the information useful and interesting.

Project Setup

Get started by first installing all require dependencies.

  1. Install rvm to manage ruby versions.
  2. Use rvm to install ruby using the version stated at the top of the Gemfile (e.g. rvm install 2.3.2)
  3. Using homebrew or your favorite package manager:
    • brew install postgres redis
  4. Install bundler: gem install bundler
  5. Run bundle install: bundle install
  6. Prepare the database:
    • rake db:setup
    • RAILS_ENV=test rake db:setup #for test db
  7. Start the server! rails s
  8. Visit: http://localhost:3000

Hosting

Infrastructure is managed with Dokku hosted at DigitalOcean.

Domains

Two DNS records are created to manage apps and resolve to the DO droplet: app.mcginnis.io and *.app.mcginnis.io

App domains following the following convention:

  • Dev: name.dev.app.mcginnis.io
  • Staging: name.staging.app.mcginnis.io
  • Production: name.prod.app.mcginnis.io

Dokku Usage

PreDeployment Checklist Per the Dokku app deployment guide, one must create the application and enabled plugins before deploying.

dokku apps:create postalpast

Required Buildpacks

Both buildpacks are required to build both ruby and yarn (js) apps.

dokku buildpacks:add postalpast https://github.com/heroku/heroku-buildpack-ruby.git
dokku buildpacks:add postalpast https://github.com/heroku/heroku-buildpack-nodejs.git

Environment Variables

The following vars must be set prior to deployment:

dokku config:set postalpast ENVIRONMENT=production
dokku config:set postalpast SHRINE_SECRET_KEY=#{SecureRandom.hex}
dokku config:set AWS_S3_ACCESS_KEY_ID
dokku config:set AWS_S3_SECRET_ACCESS_KEY
dokku config:set AWS_S3_REGION
dokku config:set AWS_S3_BUCKET

Required Plugins

PostgreSQL To setup PG, the plugin must be installed, the service must be created and linked to the app. Linking will set the DATABASE_URL environment variable.

sudo dokku plugin:install https://github.com/dokku/dokku-postgres.git
dokku postgres:create postalpast
dokku postgres:link postalpast postalpaste

Deploying the App

Add the remote to the local GIT repository and push:

git remote add dokku [email protected]:postalpast
git push dokku main:master

Running Rake Tasks and Accessing Console

dokku run postalpast bundle exec rake [task]
dokku run postalpast bundle exec rails c
Disabling autocomplete in IRB & Rails Console

Add IRB.conf[:USE_AUTOCOMPLETE] = false in ~/.irbrc

About

Showcasing the world's largest collection of vintage postcards from Waltham, MA.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published