Coder Social home page Coder Social logo

darkosancanin / crypto_in_the_black Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 24.66 MB

CryptoInTheBlack.com - AWS Serverless Application Project

Home Page: https://www.cryptointheblack.com

HTML 0.12% CSS 0.04% JavaScript 1.99% C# 97.62% PowerShell 0.23%

crypto_in_the_black's Introduction

CryptoInTheBlack.com - AWS Serverless Application Project

Simple SPA app created to play around with some of the following technologies: React, AWS serverless (Lambda, S3, API Gateway, CloudFront, Route53, CloudFormation/SAM templates).

URL: https://www.cryptointheblack.com

The environment is completely serverless and a new environment can be spun up in AWS with the following powershell script (which simply wraps some aws cli calls):

./deploy-env.ps1

The SAM/CloudFormation template creates a new environment in AWS and does the following:

  • Deploys Lamda functions
  • Configures API Gateway for these Lambda functions
  • DNS entry for api.cryptointheblack.com -> API Gateway
  • Creates S3 Bucket to host SPA website
  • Configures CloudFront distribution to serve the SPA static website
  • DNS entry for www.cryptointheblack.com -> CloudFront distribution

In order to deploy/update the code in the static SPA website hosted in S3 I just need to run the following:

./deploy-client-code.ps1

Multiple environments such as test and staging can be handled by passing in an environment prefix into these scripts e.g. ./deploy-env.ps1 "staging-" This will create a completely separate environment in AWS with a site that can be accessed at https://staging-www.cryptointheblack.com (utilizing https://staging-api.cryptointheblack.com)

https://www.cryptointheblack.com

In order to delete a environment I can just run the following:

./delete-env.ps1 "staging-"

The project is made up of the following sub-projects:

/client/

React app created using create-react-app (https://github.com/facebook/create-react-app).

build & deploy
# start the development server
npm run start

# build the production build:
npm run build

# deploy AWS cloudformation stack (change stackname as required):
aws cloudformation deploy --template template.yml --stack-name dev-www-cryptointheblack

# copy files to S3 bucket
aws s3 cp build/ s3://www.cryptointheblack.com --recursive

# set environment prefix 
$env:REACT_APP_ENV_PREFIX="dev-"
delete
# delete all files from S3 Bucket
aws s3 rm s3://dev-www.cryptointheblack.com --recursive

# delete stack (change stackname as required)
aws cloudformation delete-stack --stack-name dev-www-cryptointheblack

/server/CryptoInTheBlack/

.NET Core project for the API using AWS Lambda functions.

build & deploy
# build the project (using SAM)
# note: artifacts are saved to '.aws-sam\build'
sam build

# change directory to the build directory
cd .aws-sam\build

# package SAM template
sam package --template-file template.yaml --s3-bucket cryptointheblack --output-template-file packaged.yml

# deploy packaged SAM template (change stackname as required):
sam deploy --template-file packaged.yml --stack-name staging-cryptointheblack --capabilities CAPABILITY_IAM --parameter-overrides EnvironmentPrefix=staging

# build and run in local docker container
sam build -s ./server/CryptoInTheBlack/; sam local start-api -s ./server/CryptoInTheBlack/ -p 4000
delete
# delete stack (change stackname as required)
aws cloudformation delete-stack --stack-name dev-api-cryptointheblack

/server/CryptoInTheBlack.IntegrationTests/

Integration tests for the /CryptoInTheBlack/ .NET Core project.

#run tests
dotnet test

/server/CryptoInTheBlack.Tests/

Unit tests for the /CryptoInTheBlack/ .NET Core project.

#run tests
dotnet test

/server/CryptoInTheBlack.Cli/

Console app created to run some periodic offline processes, currently used to generate the sitemap.xml file and also dynamically creates the CoinData file which stores basic information for each coin so users can search without having to hit the CoinGecko api for every call.

# generate sitemap (change output location as required)
dotnet run sitemap -o C:\location\of\sitemap.xml

# generate CoinData file (change output location as required)
dotnet run coindata -o C:\location\of\CoinData.cs

crypto_in_the_black's People

Contributors

darkosancanin avatar

Watchers

 avatar James Cloos avatar

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.