Giter Site home page Giter Site logo

bitcoinschema / gobitcoinsv Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 1.0 465 KB

A collection of go projects for building on Bitcoin SV

Home Page: https://gobitcoinsv.com

License: MIT License

HTML 69.72% Makefile 30.28%
bitcoin bitcoinsv bsv go golang

gobitcoinsv's Introduction

A collection of Go projects for building on BitcoinSV

last commit Release Mergify Status app health
standard-readme compliant Sponsor Donate


GoBitcoinSV


Table of Contents


Installation

Install the web application

make install

View the site: open /public/index.html in a web browser


Deployment & Hosting

This repository has CI integration using AWS CodePipeline.

The build in AWS will deploy to firebase.

The actual build process can be found in the buildspec.yml file.

The application relies on AWS Secrets Manager and AWS SSM to store environment variables. Sensitive environment variables are encrypted using AWS KMS and then decrypted at runtime.

Deploy different environments by changing the <stage> to production or development as example. The default stage is production if it's not specified.

Firebase Hosting Setup
  1. Start a new project and assign a CNAME
  2. Make sure the region is us-central
  3. Generate a CI firebase_token using the command: firebase login:ci
Create Environment Encryption Key(s) (AWS)

Create a KMS Key per <stage> for your application(s) to encrypt environment variables

make create-env-key stage="<stage>"

This will also store the kms_key_id in SSM located at: /<application>/<stage>/kms_key_id

Manage Environment Variables (AWS)

Add or update your project information (all parameters are required)

make firebase-save-project \
      app_id="YOUR_APP_ID" \
      project="YOUR_PROJECT_ID" \
      sender_id="YOUR_SENDER_ID" \
      stage="<stage>"
Manage Environment Secrets (AWS)
  • firebase_api_key is found in the Firebase console for that specific project
  • firebase_token is the ci:login token that is generated from firebase login:ci
  • github_token is a personal token with access to make a webhook
  • kms_key_id is from the previous step (Create Environment Encryption Keys)

Add or update your secrets (all parameters are required)

make save-secrets \
      firebase_api_key="YOUR_FIREBASE_API_KEY" \
      firebase_token="YOUR_FIREBASE_CI_TOKEN" \
      github_token="YOUR_GITHUB_TOKEN" \
      kms_key_id="YOUR_KMS_KEY_ID" \
      stage="<stage>"
Create CI Environment (AWS)
infrastructure diagram

Prerequisites

This will create a new AWS CloudFormation stack with:

NOTE: Requires an existing S3 bucket for artifacts and sam-cli deployments (located in the Makefile)

One command will build, test, package and deploy the application to AWS. After initial deployment, updating is as simple as committing to Github.

make deploy

(Example) Customized deployment for another stage

make deploy stage="development" branch="development"

(Example) Customized deployment for a feature branch

make deploy stage="development" branch="some-feature" feature="some-feature"

(Example) Customized S3 bucket location

make deploy bucket="some-S3-bucket-location"

(Example) Customized tags for the deployment

make deploy tags="MyTag=some-value AnotherTag=some-value"
Tear Down CI Environment (AWS)

Remove the stack (using default stage: staging)

make teardown

(Example) Teardown another stack via stage

make teardown stage="development"

(Example) Teardown a feature/branch stack

make teardown stage="development" feature="some-feature"

Documentation

No documentation at this time. View the source code of the website.

Release Deployment

goreleaser for easy binary or library deployment to Github and can be installed via: brew install goreleaser.

The .goreleaser.yml file is used to configure goreleaser.

Use make release-snap to create a snapshot version of the release, and finally make release to ship to production.

Makefile Commands

View all makefile commands

make help

List of all current commands:

audit                         Checks for any packages that are vulnerable
aws-param-certificate         Returns the ssm location for the domain ssl certificate id
aws-param-zone                Returns the ssm location for the host zone id
clean                         Remove previous builds, cache or install modules
create-env-key                Creates a new key in KMS for a new stage
create-secret                 Creates an secret into AWS SecretsManager
decrypt                       Decrypts data using a KMY Key ID (awscli v2)
decrypt-deprecated            Decrypts data using a KMY Key ID (awscli v1)
deploy                        Build, prepare and deploy
encrypt                       Encrypts data using a KMY Key ID (awscli v2)
env-key-location              Returns the environment encryption key location
firebase-deploy-simple        Deploys to firebase with limited flags
firebase-get-env              Gets the current environment variables in the associated project
firebase-param-app-id         Returns the location of the app_id parameter in SSM
firebase-param-location       Creates a parameter location (for Firebase details in SSM)
firebase-param-project        Returns the location of the project-id parameter in SSM
firebase-param-sender-id      Returns the location of the sender_id parameter in SSM
firebase-save-project         Saves the firebase project information for use by CloudFormation
firebase-set-env              Set an environment variable in a firebase project
firebase-update               Update the firebase tools
help                          Show this help message
install                       Install the application
invalidate-cache              Invalidates a cloudfront cache based on path
lint                          Run the JS linter
outdated                      Checks for any outdated packages
package                       Process the CF template and prepare for deployment
reinstall                     Removes all files and re-installs from scratch
release                       Full production release (creates release in Github)
release-snap                  Test the full release (build binaries)
release-test                  Full production test release (everything except deploy)
replace-version               Replaces the version in HTML/JS (pre-deploy)
save-domain-info              Saves the zone id and the ssl id for use by CloudFormation
save-param                    Saves a plain-text string parameter in SSM
save-param-encrypted          Saves an encrypted string value as a parameter in SSM
save-secrets                  Helper for saving sensitive credentials to Secrets Manager
tag                           Generate a new tag and push (tag version=0.0.0)
tag-remove                    Remove a tag if found (tag-remove version=0.0.0)
tag-update                    Update an existing tag to current commit (tag-update version=0.0.0)
teardown                      Deletes the entire stack
update-secret                 Updates an existing secret in AWS SecretsManager
upload-files                  Upload/puts files into S3 bucket

Examples

View the live website


Code Standards

Always use the language's best practices!


Usage

We're using it! Visit the GoBitcoinSV website.


Maintainers

Satchmo MrZ
Satchmo MrZ

Contributing

View the contributing guidelines and follow the code of conduct.

How can I help?

All kinds of contributions are welcome ๐Ÿ™Œ! The most basic way to show your support is to star ๐ŸŒŸ the project, or to raise issues ๐Ÿ’ฌ. You can also support this project by becoming a sponsor on GitHub ๐Ÿ‘ or by making a bitcoin donation to ensure this journey continues indefinitely! ๐Ÿš€

Stars


License

License

gobitcoinsv's People

Contributors

dependabot[bot] avatar mergify[bot] avatar mrz1836 avatar rohenaz avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

0xgoerlimainnet

gobitcoinsv's Issues

Feature: fork & add!

Add a link / icon for Github - allow users to fork the repo easily and contribute their own Go projects!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.