Skip to content

Latest commit

 

History

History
204 lines (154 loc) · 6.86 KB

README.md

File metadata and controls

204 lines (154 loc) · 6.86 KB

CRYPTO WALLET STATUS

Tag Latest Go Reference Go Report Card codeclimate Maintainability codeclimate Issue Count Docker Pulls MIT License jeffdecola.com

*** THE REPO IS UNDER CONSTRUCTION - CHECK BACK SOON ***

Check all your public cryptocurrency wallets via a webpage (iPhone App coming soon).

Table of Contents

Documentation and Reference

OVERVIEW

Here is an overview of what we're going to do,

IMAGE - crypto-wallet-status-overview - IMAGE

PREREQUISITES

You will need the following go packages,

go get -u -v github.com/sirupsen/logrus
go get -u -v github.com/cweill/gotests/...

SOFTWARE STACK

Where,

  • GUI golang net/http package and ReactJS
  • Routing & REST API framework golang gorilla/mux package
  • Backend golang
  • Database N/A

RUN

To run.sh,

cd crypto-wallet-status-code
go run main.go

As a placeholder, every 2 seconds it will print,

    INFO[0000] Let's Start this!
    Hello everyone, count is: 1
    Hello everyone, count is: 2
    Hello everyone, count is: 3
    etc...

CREATE BINARY

To create-binary.sh,

cd crypto-wallet-status-code/bin
go build -o crypto-wallet-status ../main.go
./crypto-wallet-status

This binary will not be used during a docker build since it creates it's own.

STEP 1 - TEST

To create unit _test files,

cd crypto-wallet-status-code
gotests -w -all main.go

To run unit-tests.sh,

go test -cover ./... | tee test/test_coverage.txt
cat test/test_coverage.txt

STEP 2 - BUILD (DOCKER IMAGE VIA DOCKERFILE)

To build.sh with a Dockerfile,

cd crypto-wallet-status-code
docker build -f build/Dockerfile -t jeffdecola/crypto-wallet-status .

You can check and test this docker image,

docker images jeffdecola/crypto-wallet-status:latest
docker run --name crypto-wallet-status -dit jeffdecola/crypto-wallet-status
docker exec -i -t crypto-wallet-status /bin/bash
docker logs crypto-wallet-status
docker rm -f crypto-wallet-status

In stage 1, rather than copy a binary into a docker image (because that can cause issues), the Dockerfile will build the binary in the docker image,

FROM golang:alpine AS builder
RUN go get -d -v
RUN go build -o /go/bin/crypto-wallet-status main.go

In stage 2, the Dockerfile will copy the binary created in stage 1 and place into a smaller docker base image based on alpine, which is around 13MB.

STEP 3 - PUSH (TO DOCKERHUB)

You must be logged in to DockerHub,

docker login

To push.sh,

docker push jeffdecola/crypto-wallet-status

Check the crypto-wallet-status docker image at DockerHub.

STEP 4 - DEPLOY (TO DOCKER)

To deploy.sh,

cd crypto-wallet-status-code
docker run --name crypto-wallet-status -dit jeffdecola/crypto-wallet-status
docker exec -i -t crypto-wallet-status /bin/bash
docker logs crypto-wallet-status
docker rm -f crypto-wallet-status

CONTINUOUS INTEGRATION & DEPLOYMENT

Refer to ci-README.md on how I automated the above steps.