Giter VIP home page Giter VIP logo

docker_springboot_tomcat_mysql_demo's Introduction

Docker with SpringBoot, tomcat and MySQL

Read how to build this project from scratch here -> tutorial
(It's very messy right now)

How to run this demo?

Step 0 - Requirements

Here are the tools you need:

  1. Docker (duh)
  2. Eclipse (I'm using Eclipse Photon)
  3. Java10

Step 1 - Clone this repo

git clone https://github.com/HechengLi/Docker_SpringBoot_Tomcat_MySQL_Demo.git

Step 2 - Import TianMiao into eclipse as a maven project

Open your eclipse
On the taskbar click File -> Import -> Maven -> Existing Maven Project
Select the folder TianMiao the Root Directory (You should see /pom.xml com.example:TianMiao:0.0.1-SNAPSHOT:war in Projects)
Click Finish

Step 3 - Build TianMiao as a war file

Right click TianMiao in Package Explorer -> Run As -> Run Configurations
Type 'clean install -Dmaven.test.skip=true' in Goals
Click Apply then Run (you should have TianMiao.war under Docker_SpringBoot_Tomcat_MySQL\TianMiao\target)

Step 4 - Run the project with docker

Open your commandline, cd to the git directory
Make sure you have docker app running
Run 'docker-compose -f stack.yml up' (add -d if you want it to run in background)

Step 5 - Rerun if there's an error on first run

If you get an error while starting tomcat, it probably is because the docker container running Tomcat doesn't wait for MySQL to finish running it's setup script.
Wait for MySQL to finish running its script (it will log ...ready for connections...)
Stop all containers and start again should fix the problem.

Step 6 - Check if it works (suggestion - use postman)

Send Get Request to 'http://localhost:8080/TianMiao/api/users' to retrive data
Send Post Request to 'http://localhost:8080/TianMiao/api/users' with json {'username': 'anyusername'} to add data

docker_springboot_tomcat_mysql_demo's People

Contributors

chrisli-03 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.