Code Monkey home page Code Monkey logo

appdockerizada's Introduction

appDockerizada

Simple application which uses Spring Boot, Swagger and contains the Maven plugin to generate Docker Images. Example about docker-compose too.

First part:

If you want to start you should run the class "AppDockerizada" like a simple main. In addition, you have to install Mongo service and run it.

Ubuntu -> https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/ Windows -> https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/

There are three different endpoints:

localhost:8090/healthCheck -> it checks if the application has run correctly.

localhost:8090/generateChange -> it changes a text to uppercase, it is a simple POST method, the importance of this project is that you can use Swagger, Spring Boot and generate a Docker image. Example: RequestBody {"text":"JAIME"}. ResponseBody {"text":"IÑIGO", "change":"jaime"}

localhost:8090/getAllChanges -> it shows all the changes that the application has done.

localhost:8090 -> You can see the endpoints with Swagger Documentation.

Second part:

If you want to generate the Docker Image of this application you should change the class com.demo.docker.config.SpringMongoConfig and uncomment return new MongoClient("mongo"); and comment the other one. After that you have to put in a terminal: mvn clean package docker:build.

You can use docker-compose to connect this docker with a Mongo Docker. The docker-compose should be this one:

version: "2"
services:
mongo:
    image: mongo:latest
    container_name: mongo
    ports:
    - "27017:27017"

  demo-docker:
  image: demo-docker:latest
  container_name: demo-docker
     ports:
     - "8090:8090"
     depends_on:
     - mongo

You can use the endpoints, but the difference is that you are connecting to the Docker-compose.

appdockerizada's People

Contributors

jaimemorales52 avatar pejarru avatar lpmi-13 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.