Skip to content

penzur/bishack.dev

 
 

Repository files navigation



JOIN US ON SLACK

 

CircleCI codecov Go Report Card

 

Folder Structure

├── assets/             // Static files (go-bindatable/private)
│   ├── css/
│   ├── scripts/
│   └── templates/
│
├── handler/            // Handler package.
|
├── middleware/         // Middleware central :D
│
├── public/             // For publicly available static content.
│   └── images/
│
├── services/           // Anything that does i/o goes here.
│   └── user/
│
├── testing/            // Includes a nifty little tricks for testing.
│
└── utils/              // None service related stuff like: session, crypto, etc...
    └── session/

 

Foreword

This application heavily relies on managed external services like: Cognito, DynamoDB, Lambda et cetera. So setting up a local development environment for this project needs a bit of an extra work.

If you want to contribute to this project, do let me know so I can assist you on setting up credentials and what not.

 

Prerequisites

  • Go - 1.12 or higher

  • Docker

  • AWS buffet - you can always sign up for a free tier

    • IAM Key Pair - to be loaded into your ~/.aws/credentials config file.

      On mac you can actually just $ brew install aws-cli and then run $ aws config from your terminal. The prompt will ask you to input the credentials and will load them to the file I mentioned above.

    • Cognito User Pool (with client key and secret) - you can create one from AWS console.

      Ping me on slack if you need help on this one.

    • DynamoDB Tables - See DynamoDB Setup

  • Github oauth credentials this one is easy

  • Slack token (optional)

 

DynamoDB Setup (local)

Before you start you need to have docker installed on your system first.

  1. Run the the following command:

    $ docker run -d -p 8000:8000 amazon/dynamodb-local -jar DynamoDBLocal.jar -inMemory -sharedDb

    The above command will run a localized version of dynamodb with shared database.

  2. Go to http://localhost:8000/shell and copy, paste and run every files inside the ./assets/dynamo folder.

    See example below:

    ss

 

Dev Setup

Install a live-reload command line utility called Gin with the following command:

$ go get -u github.com/codegangsta/gin

And then install up.

$ curl -sf https://up.apex.sh/install | sh

Start the server with this command:

$ SLACK_TOKEN=<slack api token (optional)> \
  SESSION_KEY=<32-bytes-key> \
  CSRF_KEY=<32-bytes-key> \
  COGNITO_CLIENT_ID=<key> \
  COGNITO_CLIENT_SECRET=<secret> \
  GITHUB_CLIENT_ID=<id> \
  GITHUB_CLIENT_SECRET=<secret> \
  GITHUB_CALLBACK=http://localhost:3000/signup \
  DYNAMO_TABLE_POSTS=posts \
  DYNAMO_ENDPOINT=http://localhost:8000 \
  make dev

Head to http://localhost:3000/ on your browser.

 

Happy Hacking! 🖖 🤓

 

About

Bisdak Dev Community Portal

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 88.8%
  • CSS 6.4%
  • JavaScript 3.0%
  • Makefile 1.8%