Giter Site home page Giter Site logo

eurekaserver's Introduction

XMD Eureka Server Service

로컬 호스트에서 서비스 시작 vs 도커 컨테이너로 서비스 시작

1. 로컬 호스트에서 서비스 시작

1.1 컴파일

maven으로 프로젝트를 만들었기에 gradle build 방식과 컴파일 방식이 다르다. 기존 소스가 있다면 삭제 한다.

   ./mvnw clean 

maven을 통한 컴파일 및 jar 파일 생성

  ./mvnw package 

1.2 서비스 시작

각자 환경에 맞춰서 셋팅한다. http://{signoz install ip}:4317

OTEL_EXPORTER_OTLP_ENDPOINT="http://{signoz install ip}:4317" OTEL_RESOURCE_ATTRIBUTES=service.name=xmd-eureka-server \
java -javaagent:/Users/{사용자ID}/xmd/opentelemetry_agent/opentelemetry-javaagent.jar \
-jar /Users/{사용자ID}/xmd/EurekaServer/target/EurekaServer-0.0.1-SNAPSHOT.jar

2. 도커 컨테이너로 서비스 시작

2.1 필요한 파일 생성

  • 도커 파일 생성 : Dockerfile
    FROM openjdk:11

    WORKDIR /app

    VOLUME /tmp 

    COPY ./opentelemetry_agent/*.jar opentelemetry-javaagent.jar

    COPY mvnw .
    COPY .mvn .mvn
    COPY pom.xml .
    COPY src src
    COPY entry.sh run.sh

    RUN chmod 774 run.sh

    RUN ./mvnw install -DskipTests

    ENV PROFILE="local"
    ENV OTEL_EXPORTER_OTLP_ENDPOINT="127.0.0.1"

    EXPOSE 8761

    ENTRYPOINT [ "./run.sh" ]
  • 컨테이너 안에서 실행할 shell 프로그램 생성 : entry.sh
    #!/bin/sh

    ACTIVE_PROFILE="${PROFILE:-dev}"
    ACTIVE_OTEL_EXPORTER_OTLP_ENDPOINT="${OTEL_EXPORTER_OTLP_ENDPOINT:-127.0.0.1}"

    echo "ACTIVE_PROFILE=${ACTIVE_PROFILE}"
    echo "ACTIVE_OTEL_EXPORTER_OTLP_ENDPOINT=${ACTIVE_OTEL_EXPORTER_OTLP_ENDPOINT}"

    exec java -javaagent:./opentelemetry-javaagent.jar \
            -Dotel.exporter.otlp.endpoint=http://${ACTIVE_OTEL_EXPORTER_OTLP_ENDPOINT}:4317 \
            -Dotel.resource.attributes=service.name=xmd-Eureka-server \
            -Dspring.profiles.active=${ACTIVE_PROFILE} \
            -jar target/EurekaServer-0.0.1-SNAPSHOT.jar
            

2.2 docker 이미지 만들기

docker build -t xmdeurekasvc:0.1 .    

2.2 docker 이미지로 xmd-eureka-server 컨테이너 시작

docker run --name xmd-eureka-server -p 8761:8761 -e "PROFILE=dev" -e "OTEL_EXPORTER_OTLP_ENDPOINT=192.168.10.157" xmdeurekasvc:0.1  

eurekaserver's People

Contributors

heungsikyu 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.