Giter Club home page Giter Club logo

pizzas-back's Introduction

Final proyect: Pizza application

RampUp

Pizza application in Spring Boot and deploy in AWS.

Architecture

For the application backend, the infastructure deploy will be:

  • Internet gateway.
  • Application load balancer.
  • Amazon Elastic Container Service with EC2 instances.
  • Amazon RDS for MYSQL.

The application frontend is located here

Software requirements

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

  • Maven
  • Java
  • terraform

Also, an AWS and CircleCI account is required.

Deploy

First, you need to create a 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
24 IP_VPC VPC IP for the application
30 IP_paSUB1 IP for subnet
42 IP_paSUB2 IP for subnet
68 asg_max-instances Maximum running instances in group
74 asg_min-instances Minimum running instances in group
68 asg_desired Desired running instances in group
99 docker-image Docker image for instances

Manual

  1. Compile with Maven.
mvn compile
  1. Create a database and set the environment variables.
export MYSQL_DB_HOST=localhost
export MYSQL_DB_PORT=3306
export MYSQL_DB_DATABASE=pizzasdb
export MYSQL_DB_USER=root
export MYSQL_DB_PASSWORD=example
  1. Package and run unit test.
mvn package
  1. Build and push the image into docker hub.

  2. Enter the terraform directory and run the following commands:

# Initialize Terraform
terraform init
# Infrastructure checkout
terraform plan
# Infrastructure deploy
terraform apply

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
DOCKER_LOGIN Docker username
DOCKER_PASSWORD Docker password
MYSQL_DB_PASSWORD MySQL password
MYSQL_DB_USER MySQL password
  1. Modify some variables in the CircleCI pipeline.
Line Variable Description
15 TF_VAR_db_user MySQL user
53 image Change for your docker repository
56 image Change for your docker repository

In the line 112, change the command with your cluster name and service if you change it before in the terraform variables.

  1. Build the project.

Usage

In the terraform output, a variable called API_Backend_url contains the backend API.


NOTE

To destroy the application manually:

terraform destroy

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


pizzas-back's People

Contributors

mnl359 avatar

Watchers

James Cloos avatar

Forkers

zelfick

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.