Coder Social home page Coder Social logo

javawebappsample's Introduction

A Simple Java Web App for Azure

Build

mvn package

Run Locally

mvn jetty:run

To run in a different port

mvn jetty:run -Djetty.port=<your port>

Debug Locally

set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=n
mvn jetty:run

Deploy to Azure Web App using FTP

Rename the .war file in target folder to ROOT.war and upload it to your Azure Web App through Git or FTP.

Containerize Your Web App

  1. Build a docker image using Dockerfile:
    docker build -t calculator .
    
  2. Run docker image locally
    docker run --rm -p 8080:8080 calculator
    
  3. Then you can access the web app at http://localhost:8080 in browser

Deploy to Azure Web App using Container Image

  1. Create a Container Registry on Azure
  2. Push your local image to ACR:
    docker login -u <client id> -p <client secret> <your ACR server>
    docker tag calculator <your ACR server>/calculator
    docker push <your ACR server>/calculator
    
  3. Create a Web App in Linux on Azure
  4. In Docker Container settings of Web App, fill in image name, server URL, username and password of your ACR.
  5. Save the changes and you'll be able to access the web app in a few seconds.

Setup Continous Integration with Azure using Jenkins

  1. Go to Settings -> Integration & services, click Add service, choose Jenkins (GitHub plugin), fill in Jenkins hook url with http://<your jenkins server>/github-webhook/

  2. Make sure your Jenkins has the following components installed:

    • JDK
    • Maven
    • Docker

    And the following plugins installed:

    • Azure credentials
    • Docker pipeline
    • Credentials binding
  3. To deploy using FTP, create a Jenkins pipeline with Jenkinsfile as pipeline file.

  4. To deploy using container, create a Jenkins pipeline with Jenkinsfile2 as pipeline file.

javawebappsample's People

Contributors

chenkennt avatar jeffsm222 avatar puicchan 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.