My FeedDiscussionsHashnode Enterprise
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

Post hidden from Hashnode

Posts can be hidden from Hashnode network for various reasons. Contact the moderators for more details.

Spring Boot Microservices, Docker and Configuration

Spring Boot Microservices, Docker and Configuration

Fagun Patel's photo
Fagun Patel
·Oct 15, 2021·

1 min read

  1. Developing Microservices:
    • Spring Boot
    • Spring Data JPA
    • MySQL
  2. Build, Deploy and Scale Microservices using Docker
  3. Configurations in Microservices : Spring Cloud Config

Step 1 - Create the database

  • download and run the docker image - MySQL
    docker run -d -p 3306:3306 -e MYSQL_ROOT_PASSWORD=password mysql
    
  • run the database script

    create database if not exists microservice_demo;
    use microservice_demo;
    DROP TABLE IF EXISTS students;
    DROP TABLE IF EXISTS addresses;
    
    CREATE TABLE `students` (
                              `student_id` int AUTO_INCREMENT  PRIMARY KEY,
                              `first_name` varchar(50) NOT NULL,
                              `last_name` varchar(50) NOT NULL,
                              `email` varchar(100) NOT NULL
    );
    
    CREATE TABLE `addresses` (
                              `student_id` int NOT NULL,
                              `address_id` int AUTO_INCREMENT PRIMARY KEY,
                              `city` varchar(50) NOT NULL,
                              `state` varchar(50) NOT NULL,
                              `country` varchar(50) NOT NULL
    );
    
    insert into students (student_id, first_name, last_name, email)
    values (1, 'John' , 'Doe' , '');
    
    insert into addresses (student_id, address_id, city, state, country)
    value (1, 12345 , 'Orlando' , 'FL' , 'USA');