Skip to content

Instantly share code, notes, and snippets.

package com.thinkmicroservices.ri.spring.config;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.config.server.EnableConfigServer;
@EnableConfigServer
@SpringBootApplication
public class ConfigurationService {
@thinkmicroservices
thinkmicroservices / configuration-service:pom.xml
Last active February 22, 2020 02:05
Configuration Service Pom
<?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/>
</parent>
@thinkmicroservices
thinkmicroservices / configuration-service: Dockerfile
Last active February 22, 2020 02:08
Configuration Service Dockerfile
# grab the base image
FROM openjdk:8-jdk-alpine
# create a working volume in tmp
VOLUME /tmp
#define the jar dependency files
ARG DEPENDENCY=target/dependency
COPY ${DEPENDENCY}/BOOT-INF/lib /app/lib
@thinkmicroservices
thinkmicroservices / fluent:fluentd Dockerfile
Last active February 22, 2020 02:04
Fluentd Dockerfile
FROM fluent/fluentd:v1.6-debian-1
USER root
RUN ["gem", "install", "fluent-plugin-elasticsearch", "--no-document", "--version", "3.5.2"]
USER fluent
@thinkmicroservices
thinkmicroservices / fluent:Fluent.conf
Last active February 22, 2020 02:04
Fluentd Docker configuration
<source>
@type forward
port 24224
bind 0.0.0.0
<filter foo.bar>
@type parser
format json
key_name log
reserve_data true
</filter>
@thinkmicroservices
thinkmicroservices / config:Configuration Service application.yml
Last active February 22, 2020 02:03
Configuration Service application.yml
spring:
security:
user:
name: think
password: microservices
profiles:
active: native
cloud:
config:
@thinkmicroservices
thinkmicroservices / configuration-service:dc-01-config.yaml
Last active February 22, 2020 02:06
Docker-Compose file for ConfigurationService, Fluentd, ElasticSearch and Kibana
## docker-compose -f ./dc-01-config.yml up -d
## starts up:
## - elasticsearch
## - fluentd
## - kibana
## - ConfigurationService
version: "3.1"
services:
@thinkmicroservices
thinkmicroservices / Discovery Service pom.xml
Created February 25, 2020 00:34
discovery-service: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 / DiscoveryService.java
Created February 25, 2020 00:47
discovery-service:DiscoveryService.java
package com.thinkmicroservices.ri.spring.discovery;
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;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
@EnableEurekaServer
@thinkmicroservices
thinkmicroservices / discovery-service bootstrap.yml
Created February 25, 2020 00:55
discovery-service:bootstrap.yml
spring:
application:
name: DISCOVERY-SERVICE
cloud:
config:
fail-fast: true
retry:
max-attempts: 10
initial-interval: 1500
multiplier: 1.5