Code Monkey home page Code Monkey logo

bookstore_v3's Introduction

Demo Bookstore v3

This is a simple Maven project that builds a standalone JAR which contains a Jetty webserver and a simple bookstore servlet. The application is able to be built into a container and then available to be deployed as an Azure Web App.

bookstore

The Workflow files in this repository provide the following features:

  • Pull Requests code is built and tested using Maven and a Docker container published
  • Code QL scanning performed on each push
  • Each time a container is built, scanning of the containers will be performed and reported back in the security findings
  • Ability to deploy from a PR into review environment using labels:
    • deploy to test
    • deploy to qa
    • deploy to staging
  • Azure review environments are destroyed once PR is closed (using Ansible triggered from deployment transitions)
  • Any commit to the default branch main will result in the prod Azure web application being updated to the latest code (Continuous Delivery)

For a step-by-step guide see: Bookstore Demo

Running the Web Application locally

You can run the web application locally using Maven for development purposes, which can be done either directly if you have Maven and a JDK installed, or inside a container that has Maven and JDK installed.

GitHub Codespaces

This repository is configured with GitHub Codespaces to make it easy to start with a development environment fully configured.

The container used for the development environment is available from https://github.com/octodemo/container-java-development and is publically available. There are multiple versions of this, all with the tags providing a specific combination of tools for various cloud vendors. By default you will get a container with:

  • Maven 3.6.3 or later
  • JDK 11
  • Azure CLI tools

Running locally:

To build the software run the following command:

$ mvn package

This will generate a jar file at target/bookstore-v2-1.0.0-SNAPSHOT.jar directory that when run with the command java -jar target/bookstore-v2-1.0.0-SNAPSHOT.jar will run the jetty web server. The logs from the jar file should report the url to access the web server on, which is port 8080 by default.

Running in a Docker container:

The Codespace is configured to build and execute the container as a tasks.

  • docker: build container will build the java project and then the container for you, prompting for details along the way
  • docker: run container will allow you to run the container that you built allowing you to select the port that is bound to (8080 by default).

Building and running the container locally without the tasks in GitHub Codespaces can be done using the following;

  • mvn package
  • docker build . --build-arg VERSION=1.0.0-SNAPSHOT --tag bookstore:latest (update to the correct version that mvn package will build for you)
  • docker run -p 8080:8080 bookstore:latest to execute the container and bind to port 8080 to serve requests from

Flow diagram

The flow diagram below depicts the Actions' workflows that are pre-configured, the events that trigger each of them and the different Azure environments that are spinned up during the demo.

Azure_Bookstore_Demo drawio

Update for building and running it on MacOS M1

modify the version
$ mvn package
$ docker build . --build-arg VERSION=1.0.0-SNAPSHOT --tag bookstore-v3:latest
$ docker run -p 8080:8080 bookstore-v3:latest

bookstore_v3's People

Contributors

yuuki1967 avatar

Watchers

 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.