Skip to content

markgravity/golang-ic

Repository files navigation

[![Build Status](CI_BADGE_URL goes here)](REPO_URL goes here)

Introduction

An amazing Mark Golang IC!

Project Setup

Prerequisites

Development

Create an ENV file

To start the development server, .env file must be created.

  • Copy .env.example file and rename to .env

Build dependencies

  • air is used for live reloading

  • goose is used for database migration.

  • forego manages Procfile-based applications.

They need to be built as a binary file in $GOPATH.

make install-dependencies

Start development server

make dev

The application runs locally at http://localhost:8080

Test

Execute all unit tests:

make test

Migration

Create migration

make migration/create MIGRATION_NAME={migration name}

List the migration status

make migration/status

Migrate the database

make db/migrate

Rollback the migration

make db/rollback

Deploy to Heroku with Terraform

Prerequisites

To deploy the application to Heroku with Terraform, we need to create the Heroku API Key first:

$ heroku login
$ heroku authorizations:create --description <api key description>

And then, move to the deploy/heroku folder and run the following steps:

Step 1: Copy the variable file and update the variables

$ cp terraform.tfvars.sample terraform.tfvars

You can get the tfvars files from 1Password

Step 2: Initialize Terraform

$ terraform init

Step 3: Generate an execution plan

$ terraform plan -var-file="terraform.tfvars"

Step 5: Execute the generated plan

$ terraform apply -var-file="terraform.tfvars"

Step 6: Build the application and push to heroku

You can check .github/workflows/deploy.yml workflow for more details

Make sure you set the following Github secrets before deploying the application:

HEROKU_ACCOUNT_EMAIL       # Heroku email
HEROKU_API_KEY             # Heroku OAuth token
HEROKU_APP_NAME_PRODUCTION # Heroku app name for production
HEROKU_APP_NAME_STAGING    # Heroku app name for staging

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published