-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a84c18f
Showing
21 changed files
with
913 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Include any files or directories that you don't want to be copied to your | ||
# container here (e.g., local build artifacts, temporary files, etc.). | ||
# | ||
# For more help, visit the .dockerignore file reference guide at | ||
# https://docs.docker.com/go/build-context-dockerignore/ | ||
|
||
**/.classpath | ||
**/.dockerignore | ||
.env | ||
**/.git | ||
**/.gitignore | ||
**/.project | ||
**/.settings | ||
**/.toolstarget | ||
**/.vs | ||
**/.vscode | ||
**/.next | ||
**/.cache | ||
**/*.*proj.user | ||
**/*.dbmdl | ||
**/*.jfm | ||
**/charts | ||
**/docker-compose* | ||
**/compose.y*ml | ||
**/target | ||
**/Dockerfile* | ||
**/node_modules | ||
**/npm-debug.log | ||
**/obj | ||
**/secrets.dev.yaml | ||
**/values.dev.yaml | ||
**/vendor | ||
LICENSE | ||
README.md | ||
**/.logs/ | ||
**/.run/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
PORT=8761 | ||
SERVICE_REGISTRY=http://eurekauser:eureka124!localhost:${PORT}/eureka |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
HELP.md | ||
target/ | ||
!.mvn/wrapper/maven-wrapper.jar | ||
!**/src/main/**/target/ | ||
!**/src/test/**/target/ | ||
|
||
### STS ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
|
||
### IntelliJ IDEA ### | ||
.idea | ||
*.iws | ||
*.iml | ||
*.ipr | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
build/ | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
|
||
### VS Code ### | ||
.vscode/ | ||
|
||
.logs/ |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip | ||
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="EurekaServerApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true"> | ||
<option name="envFilePaths"> | ||
<option value="$PROJECT_DIR$/.env" /> | ||
</option> | ||
<module name="simple-eureka-server" /> | ||
<selectedOptions> | ||
<option name="environmentVariables" /> | ||
</selectedOptions> | ||
<option name="SPRING_BOOT_MAIN_CLASS" value="io.github.justedlev.microservice.EurekaServerApplication" /> | ||
<option name="VM_PARAMETERS" value="@.vmoptions" /> | ||
<method v="2"> | ||
<option name="Make" enabled="true" /> | ||
</method> | ||
</configuration> | ||
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-Duser.timezone=UTC | ||
-Dlogging.level.web=trace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
# Comments are provided throughout this file to help you get started. | ||
# If you need more help, visit the Dockerfile reference guide at | ||
# https://docs.docker.com/go/dockerfile-reference/ | ||
|
||
# Want to help us make this template better? Share your feedback here: https://forms.gle/ybq9Krt8jtBL3iCk7 | ||
|
||
################################################################################ | ||
|
||
# Create a stage for resolving and downloading dependencies. | ||
FROM eclipse-temurin:17-jdk-jammy as deps | ||
|
||
WORKDIR /build | ||
|
||
# Copy the mvnw wrapper with executable permissions. | ||
COPY --chmod=0755 mvnw mvnw | ||
COPY .mvn/ .mvn/ | ||
|
||
# Download dependencies as a separate step to take advantage of Docker's caching. | ||
# Leverage a cache mount to /root/.m2 so that subsequent builds don't have to | ||
# re-download packages. | ||
RUN --mount=type=bind,source=pom.xml,target=pom.xml \ | ||
--mount=type=cache,target=/root/.m2 ./mvnw dependency:go-offline -DskipTests | ||
|
||
################################################################################ | ||
|
||
# Create a stage for building the application based on the stage with downloaded dependencies. | ||
# This Dockerfile is optimized for Java applications that output an uber jar, which includes | ||
# all the dependencies needed to run your app inside a JVM. If your app doesn't output an uber | ||
# jar and instead relies on an application server like Apache Tomcat, you'll need to update this | ||
# stage with the correct filename of your package and update the base image of the "final" stage | ||
# use the relevant app server, e.g., using tomcat (https://hub.docker.com/_/tomcat/) as a base image. | ||
FROM deps as package | ||
|
||
WORKDIR /build | ||
|
||
COPY ./src src/ | ||
RUN --mount=type=bind,source=pom.xml,target=pom.xml \ | ||
--mount=type=cache,target=/root/.m2 \ | ||
./mvnw package -DskipTests && \ | ||
mv target/$(./mvnw help:evaluate -Dexpression=project.artifactId -q -DforceStdout)-$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout).jar target/app.jar | ||
|
||
################################################################################ | ||
|
||
# Create a stage for extracting the application into separate layers. | ||
# Take advantage of Spring Boot's layer tools and Docker's caching by extracting | ||
# the packaged application into separate layers that can be copied into the final stage. | ||
# See Spring's docs for reference: | ||
# https://docs.spring.io/spring-boot/docs/current/reference/html/container-images.html | ||
FROM package as extract | ||
|
||
WORKDIR /build | ||
|
||
RUN java -Djarmode=layertools -jar target/app.jar extract --destination target/extracted | ||
|
||
################################################################################ | ||
|
||
# Create a new stage for running the application that contains the minimal | ||
# runtime dependencies for the application. This often uses a different base | ||
# image from the install or build stage where the necessary files are copied | ||
# from the install stage. | ||
# | ||
# The example below uses eclipse-turmin's JRE image as the foundation for running the app. | ||
# By specifying the "17-jre-jammy" tag, it will also use whatever happens to be the | ||
# most recent version of that tag when you build your Dockerfile. | ||
# If reproducability is important, consider using a specific digest SHA, like | ||
# eclipse-temurin@sha256:99cede493dfd88720b610eb8077c8688d3cca50003d76d1d539b0efc8cca72b4. | ||
FROM eclipse-temurin:17-jre-jammy AS final | ||
|
||
# Create a non-privileged user that the app will run under. | ||
# See https://docs.docker.com/go/dockerfile-user-best-practices/ | ||
ARG UID=10001 | ||
RUN adduser \ | ||
--disabled-password \ | ||
--gecos "" \ | ||
--home "/nonexistent" \ | ||
--shell "/sbin/nologin" \ | ||
--no-create-home \ | ||
--uid "${UID}" \ | ||
appuser | ||
USER appuser | ||
|
||
# Copy the executable from the "package" stage. | ||
COPY --from=extract build/target/extracted/dependencies/ ./ | ||
COPY --from=extract build/target/extracted/spring-boot-loader/ ./ | ||
COPY --from=extract build/target/extracted/snapshot-dependencies/ ./ | ||
COPY --from=extract build/target/extracted/application/ ./ | ||
|
||
EXPOSE 8761 | ||
|
||
ENTRYPOINT [ "java", "org.springframework.boot.loader.launch.JarLauncher" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
### Building and running your application | ||
|
||
When you're ready, start your application by running: | ||
`docker compose up --build`. | ||
|
||
Your application will be available at http://localhost:8761. | ||
|
||
### Deploying your application to the cloud | ||
|
||
First, build your image, e.g.: `docker build -t myapp .`. | ||
If your cloud uses a different CPU architecture than your development | ||
machine (e.g., you are on a Mac M1 and your cloud provider is amd64), | ||
you'll want to build the image for that platform, e.g.: | ||
`docker build --platform=linux/amd64 -t myapp .`. | ||
|
||
Then, push it to your registry, e.g. `docker push myregistry.com/myapp`. | ||
|
||
Consult Docker's [getting started](https://docs.docker.com/go/get-started-sharing/) | ||
docs for more detail on building and pushing. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<div id="header" align="center"> | ||
<h1>Simple Eureka Server</h1> | ||
<h3>🚚 Service Discovery</h3> | ||
<div id="badges"> | ||
<img alt="language" src="https://img.shields.io/badge/Java%2017-e6892e"> | ||
<img alt="framework" src="https://img.shields.io/badge/Spring%20Framework%206-6cb52d"> | ||
<img alt="framework" src="https://img.shields.io/badge/Spring%20Boot%203-6cb52d"> | ||
<img alt="GitHub" src="https://img.shields.io/github/license/Justedlev/bridgewayhub"> | ||
<img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/Justedlev/bridgewayhub"> | ||
<img alt="GitHub issues" src="https://img.shields.io/github/issues/Justedlev/bridgewayhub"> | ||
</div> | ||
</div> | ||
|
||
## 📋 About | ||
|
||
__Simple Eureka Server__ it's an *Service Discovery* for easy launch and using, based on the Spring framework 6 and | ||
eureka server. | ||
|
||
## ▶️ Run | ||
|
||
### 🛠️ Intellij | ||
|
||
Clone the repository using `git clone https://github.com/Justedlev/simple-eureka-server.git` and after that run the app local, | ||
you can use the simple [run configuration](.run%2FDefault.run.xml), that based on [.env](.env) | ||
and [jvm options](.vmoptions) | ||
|
||
### 🚢 Docker | ||
|
||
Run with [Docker](README.Docker.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: justedlev-microservice | ||
services: | ||
eureka-server: | ||
build: | ||
context: . | ||
container_name: eureka-server | ||
image: justedlev/eureka-server:1.0.0-SNAPSHOT | ||
env_file: | ||
- docker.env | ||
ports: | ||
- 8761:8761 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
PORT=8761 | ||
SERVICE_REGISTRY=http://eureka-server:${PORT}/eureka |
Oops, something went wrong.