Skip to content

Instantly share code, notes, and snippets.

@thinkmicroservices
thinkmicroservices / ApiGatewayService: pom.xml
Created March 2, 2020 02:16
ApiGatewayService: pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.7.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
@thinkmicroservices
thinkmicroservices / ApiGatewayService:APIGatewayApplication
Created March 2, 2020 02:19
ApiGatewayService:APIGatewayApplication
package com.thinkmicroservices.ri.spring.gateway;
import javax.annotation.PostConstruct;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
@Slf4j
@thinkmicroservices
thinkmicroservices / ApiGatewayService: bootstrap.yml
Created March 2, 2020 02:25
ApiGatewayService: bootstrap.yml
spring:
application:
name: API-GATEWAY-SERVICE
cloud:
config:
fail-fast: true
retry:
max-attempts: 10
initial-interval: 1500
multiplier: 1.5
@thinkmicroservices
thinkmicroservices / ApiGatewayService:application.yml
Created March 2, 2020 02:30
ApiGatewayService:application.yml
server:
port: 8080
eureka:
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka
spring:
cloud.gateway:
discovery:
@thinkmicroservices
thinkmicroservices / ApiGatewayService: Dockerfile
Created March 2, 2020 02:47
ApiGatewayService:Dockerfile
# grab the base image
FROM openjdk:8-jdk-alpine
# install curl
RUN apk add --update \
curl \
&& rm -rf /var/cache/apk/*
# create a working volume in tmp
@thinkmicroservices
thinkmicroservices / APIGatewayService:dc-04-api-gateway.ym;
Created March 2, 2020 02:52
APIGatewayService:dc-04-api-gateway.ym;
## docker-compose -f ./dc-04-authentication.yml up -d
version: "3.7"
services:
##############################################################
# INFRASTRUCTURE SERVICES
################
@thinkmicroservices
thinkmicroservices / AuthenticationService:postgreSQL-rabbitMQ-containers
Last active March 3, 2020 03:12
AuthenticationService:postgreSQL-rabbitMQ-containers
############
# Postgres #
############
postgresDB:
image: postgres
restart: always
ports:
- 5432:5432
@thinkmicroservices
thinkmicroservices / AuthenticationService: User.java
Created March 4, 2020 02:23
AuthenticationService: User.java
package com.thinkmicroservices.ri.spring.auth.repository.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import java.util.Set;
import javax.persistence.*;
import lombok.*;
/**
*
* @author cwoodward
@thinkmicroservices
thinkmicroservices / AuthenticationService: Role.java
Created March 4, 2020 02:26
AuthenticationService: Role.java
package com.thinkmicroservices.ri.spring.auth.repository.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.*;
import lombok.*;
/**
*
@thinkmicroservices
thinkmicroservices / AuthenticationService: UserRepository.java
Created March 4, 2020 02:28
AuthenticationService: UserRepository.java
package com.thinkmicroservices.ri.spring.auth.repository;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import com.thinkmicroservices.ri.spring.auth.repository.model.User;
import java.util.Collection;
import java.util.List;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;