Skip to content

Latest commit

 

History

History
38 lines (37 loc) · 1.47 KB

DEPLOY.md

File metadata and controls

38 lines (37 loc) · 1.47 KB

Deploy Locally

  • Prerequisites:
    - Install git, mvn, JDK8 and MongoDB
    - Deploy parent-pom-sample: https://gitlab.com/kmponis-examples/parent-pom-sample.git
  • Open CLI and move to your workspace:
    > git clone https://gitlab.com/kmponis-examples/web-service-sample.git
  • Open CLI and move to web-service-sample:
    > mvn clean install
    > java -jar target/web-service-sample.jar
  • Test Manually on browser:
    > http://localhost:8880/swagger-ui.html#/sample-controller/
  • Test Automatically (Jacoco code coverage (100%)):
    - Open CLI and move to web-service-sample:
    > mvn clean test
    - Go to file explorer on directory:
    C:/**/web-service-sample/target/jacoco-reports/index.html

Deploy using Docker

  • Prerequisites:
    - Install docker and docker-machine on host machine and check the versions.
    > docker --version
    > docker-machine --version
    - Create docker VM, assign it as default and save IP address (VM_IP)
    > docker-machine create newvm
    > docker-machine ls
    > eval $(docker-machine env newvm)
    - Test configuration
    > docker info
  • Build application image
    - Make sure you are changing application.properties mongoDB host to VM_IP
    > docker build -t webservicesample -f Dockerfile .
    > docker image ls
  • Run mongo in background
    > docker pull mongo
    > docker run -d -p 27027:27017 -t mongo
  • Run image in background
    > docker run -p 8880:8880 webservicesample
    > docker container ls