Giter Club home page Giter Club logo

pizzas-frontend's Introduction

RampUp 2020: Pizza application

RampUp

Pizza application in React and deploy in AWS S3 Bucket.

Architecture

Only for the application frontend, an S3 bucket will be deploying it. The application backend is located here

Software requirements

To run this application without a CI/CD tool, the software needed is:

  • NPM
  • terraform

Also, an AWS and CircleCI account is required.

Deploy

  1. You need to create an S3 bucket and a DynamoDB table to store the Terraform state. Also, change the following variables in the state_config.tf:
Line Variable Description
3 bucket Your bucket name
4 key Path to the state file in the bucket
6 dynamodb_table Table to store the terraform Lock
  1. Change the projects variables
Line Variable Description
1 profile AWS profile to execute the terraform
14 tags Adjust the tags for your needs
23 s3_name Bucket name

Manual

  1. Install the node modules.
npm i

NOTE

You can launch the test runner with:

npm test

Also, you can run the app in the development mode:

http://localhost:3000

npm start

  1. Set the API endpoint into .env
echo "REACT_APP_API_URL=$BACKEND_API_ENV" >> .env
  1. Build it.
npm run build
  1. Enter the terraform directory and run the following commands:
# Initialize Terraform
terraform init
# Infrastructure checkout
terraform plan
# Infrastructure deploy
terraform apply
  1. Upload the built frontend to the bucket
aws s3 sync . s3://<bucket name>

Pipeline

  1. Follow the project from your CircleCI account.

  2. Set the environment variables in CircleCI:

Variable Description
AWS_ACCESS_KEY_ID AWS access key
AWS_DEFAULT_REGION AWS default region
AWS_SECRET_ACCESS_KEY AWS secret access key
BACKEND_API Backend API URL
  1. You need to change the configuration pipeline in the step deploy to change the bucket name
aws s3 sync . s3://<bucket name>
  1. Build the project.

Usage

In the terraform output, a variable called website_endpoint contains the application URL.


NOTE

To destroy the application manually:

terraform destroy

In the pipeline, commit to a branch called "destroy".


pizzas-frontend's People

Contributors

mnl359 avatar desckjet avatar

Watchers

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.