Skip to content

A JSON API, enabling you to query hand-curated data on horror movie antagonists.

Notifications You must be signed in to change notification settings

StephenCathcart/sanitarium

Repository files navigation

Sanitarium.io

Outline

Welcome to Sanitarium.io, a facility for holding the criminally insane. Our archive exposes a JSON API, enabling you to query hand-curated data on horror movie antagonists.

Patient records contain an in-depth profile and previous criminal activity, including a list of known victims. Our facility basement is used to house our aquatic killers.

Go Commands

Install

Installer: https://dl.google.com/go/go1.11.4.darwin-amd64.pkg

Workspace: /Users/stephencathcart/go/src

Update PATH
# /Users/stephencathcart/.bash_profile
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$PATH

Packages

# Install vendor
go get -u github.com/kardianos/govendor

# Install packages
govendor sync

# Ensure build installs to bin
go install

Format

cd {workspace}
go fmt ./...

Which will format all code in current directory and all of its subdirectories.

Test

cd {workspace}
go test ./...

Which will run all tests in current directory and all of its subdirectories.

Build & Run

Environment variables:

  • PORT: Set port number for local development. Heroku supplies a dynamic port.
  • ENV: Set to DEV for local development. Used to configure api subdomain host.
cd {workspace}
PORT=8000 ENV=DEV go run main.go

Which will run the application.

Localhost Access

Frontend: http://lvh.me:8000

API: http://api.lvh.me:8000/killers/random

Heroku Setup

User: [HIDDEN]

Install Heroku CLI (requires Git)

Installer: https://cli-assets.heroku.com/heroku.pkg

Heroku CLI Commands

Verify Installation
heroku --version
Login
heroku login
Create EU Dyno with Go Buildpack
heroku create sanitarium --region eu --buildpack heroku/go
Create Domains
heroku domains:add sanitarium.io --app sanitarium
heroku domains:add www.sanitarium.io --app sanitarium
heroku domains:add api.sanitarium.io --app sanitarium
List Hosts
host sanitarium.io
host www.sanitarium.io
Deploy
git push https://heroku:{api-key}@git.heroku.com/sanitarium.git HEAD

Cloudflare

User: [HIDDEN]

SSL: Flexible

Universal SSL Status: Active Certificate

Manage DNS settings

Type Name *Value TTL
CNAME api [HIDDEN] Automatic
CNAME sanitarium.io [HIDDEN] Automatic
CNAME www [HIDDEN] Automatic
MX sanitarium.io [HIDDEN], priority: 10 1h
MX sanitarium.io [HIDDEN], priority: 10 1h
MX sanitarium.io [HIDDEN], priority: 5 1h
MX sanitarium.io [HIDDEN], priority: 5 1h
MX sanitarium.io [HIDDEN], priority: 1 1h
TXT sanitarium.io [HIDDEN] Automatic

Note: CNAME values are dynamically generated by Heroku when a new domain is added.

Configure Page Rules

Rule URL Match Type Sub Type Value
1 *www.sanitarium.io/ Forwarding URL 301 - Permanent Redirect http://sanitarium.io
2 http://sanitarium.io/ Always Use HTTPS ... ...

Domain Registrar

Registrar: name.com

User: [HIDDEN]

Configure Nameservers

Nameserver
[HIDDEN]
[HIDDEN]

Bitbucket CI/CD Pipeline

Enable Pipelines: true

Commiting to master will automatically deploy to Heroku.

Repository Variables

Names Value
HEROKU_API_KEY ***
HEROKU_APP_NAME sanitarium

Mailchimp

User: [HIDDEN]

Email: [HIDDEN]

GSuite

User: [HIDDEN]

About

A JSON API, enabling you to query hand-curated data on horror movie antagonists.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages