Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: build and startup of the components #12

Merged
merged 2 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,4 @@ logs/*.gz
### Custom user certificates ###
docker/ca-trust/*


LOG_FILE_IS_UNDEFINED*

LOG_FILE_IS_UNDEFINED*
15 changes: 9 additions & 6 deletions .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@ image:

vscode:
extensions:
- "redhat.java"
- "vscjava.vscode-gradle@3.13.5"
- "vscjava.vscode-java-pack"
- "vscjava.vscode-gradle"

tasks:
# Download the Grafana OpenTelemetry Java agent and saves it in the instrumentation directory
- name: Download Grafana OpenTelemetry Java agent
before: mkdir -p instrumentation
command: curl -L https://github.com/grafana/grafana-opentelemetry-java/releases/download/v2.4.0-beta.1/grafana-opentelemetry-java.jar -o instrumentation/grafana-opentelemetry-java.jar
command: bash scripts/download-agent.sh && gp sync-done agent
- name: Execute a first gradle task
command: ./gradlew tasks && gp sync-done gradle
- name: Build and start all the infrastructure
command: docker compose up -d --build
init: gp sync-await agent && gp sync-await gradle
env:
COMPOSE_PARALLEL_LIMIT: 1
command: docker compose -f compose.yml -f compose.gitpod.yml up -d --build
12 changes: 1 addition & 11 deletions api-gateway/src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
FROM eclipse-temurin:21-jdk-alpine as build

ENV USE_SYSTEM_CA_CERTS=1

# INSTALL CA Certificates (useful for companies with SSL inspection)
ADD --chmod=644 docker/ca-trust/* /certificates/
RUN export USE_SYSTEM_CA_CERTS=1 && /__cacert_entrypoint.sh

WORKDIR /workspace/app

ENV SERVICE=api-gateway
Expand All @@ -16,15 +10,11 @@ COPY gradle gradle
COPY gradlew .
COPY settings.gradle.kts .

RUN --mount=type=cache,target=/root/.gradle /__cacert_entrypoint.sh ./gradlew :${SERVICE}:clean :${SERVICE}:build -x test
RUN --mount=type=cache,target=/root/.gradle ./gradlew :${SERVICE}:clean :${SERVICE}:build -x test --info
RUN mkdir -p ${SERVICE}/build/dependency && (cd ${SERVICE}/build/dependency && jar -xf ../libs/*-SNAPSHOT.jar)

FROM eclipse-temurin:21-jre-alpine

# INSTALL CA Certificates (useful for companies with SSL inspection)
ADD --chmod=644 docker/ca-trust/* /certificates/
RUN export USE_SYSTEM_CA_CERTS=1 && /__cacert_entrypoint.sh

ENV SERVICE=api-gateway
ENV LOGS_DIRECTORY=/logs/

Expand Down
30 changes: 30 additions & 0 deletions compose.gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
services:
config-server:
build:
args:
UID: 33333
GID: 33333

discovery-server:
build:
args:
UID: 33333
GID: 33333

api-gateway:
build:
args:
UID: 33333
GID: 33333

fraudetect:
build:
args:
UID: 33333
GID: 33333

merchantbo:
build:
args:
UID: 33333
GID: 33333
8 changes: 0 additions & 8 deletions config-server/src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
FROM eclipse-temurin:21-jdk-alpine as build

# INSTALL CA Certificates (useful for companies with SSL inspection)
ADD --chmod=644 docker/ca-trust/* /certificates/
RUN export USE_SYSTEM_CA_CERTS=1 && /__cacert_entrypoint.sh

WORKDIR /workspace/app

ENV SERVICE=config-server
Expand All @@ -19,10 +15,6 @@ RUN mkdir -p ${SERVICE}/build/dependency && (cd ${SERVICE}/build/dependency && j

FROM eclipse-temurin:21-jre-alpine

# INSTALL CA Certificates (useful for companies with SSL inspection)
ADD --chmod=644 docker/ca-trust/* /certificates/
RUN export USE_SYSTEM_CA_CERTS=1 && /__cacert_entrypoint.sh

ENV SERVICE=config-server
ENV LOGS_DIRECTORY=/logs/

Expand Down
8 changes: 0 additions & 8 deletions discovery-server/src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
FROM eclipse-temurin:21-jdk-alpine as build

# INSTALL CA Certificates (useful for companies with SSL inspection)
ADD --chmod=644 docker/ca-trust/* /certificates/
RUN export USE_SYSTEM_CA_CERTS=1 && /__cacert_entrypoint.sh

WORKDIR /workspace/app

ENV SERVICE=discovery-server
Expand All @@ -19,10 +15,6 @@ RUN mkdir -p ${SERVICE}/build/dependency && (cd ${SERVICE}/build/dependency && j

FROM eclipse-temurin:21-jre-alpine

# INSTALL CA Certificates (useful for companies with SSL inspection)
ADD --chmod=644 docker/ca-trust/* /certificates/
RUN export USE_SYSTEM_CA_CERTS=1 && /__cacert_entrypoint.sh

ENV SERVICE=discovery-server
ENV LOGS_DIRECTORY=/logs/

Expand Down
8 changes: 0 additions & 8 deletions fraudetect-service/src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
FROM eclipse-temurin:21-jdk-alpine as build

# INSTALL CA Certificates (useful for companies with SSL inspection)
ADD --chmod=644 docker/ca-trust/* /certificates/
RUN export USE_SYSTEM_CA_CERTS=1 && /__cacert_entrypoint.sh

WORKDIR /workspace/app

ENV SERVICE=fraudetect-service
Expand All @@ -19,10 +15,6 @@ RUN mkdir -p ${SERVICE}/build/dependency && (cd ${SERVICE}/build/dependency && j

FROM eclipse-temurin:21-jre-alpine

# INSTALL CA Certificates (useful for companies with SSL inspection)
ADD --chmod=644 docker/ca-trust/* /certificates/
RUN export USE_SYSTEM_CA_CERTS=1 && /__cacert_entrypoint.sh

ENV SERVICE=fraudetect-service
ENV LOGS_DIRECTORY=/logs/

Expand Down
Empty file added logs/.gitkeep
Empty file.
8 changes: 0 additions & 8 deletions merchant-backoffice/src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
FROM eclipse-temurin:21-jdk-alpine as build

# INSTALL CA Certificates (useful for companies with SSL inspection)
ADD --chmod=644 docker/ca-trust/* /certificates/
RUN export USE_SYSTEM_CA_CERTS=1 && /__cacert_entrypoint.sh

WORKDIR /workspace/app

ENV SERVICE=merchant-backoffice
Expand All @@ -19,10 +15,6 @@ RUN mkdir -p ${SERVICE}/build/dependency && (cd ${SERVICE}/build/dependency && j

FROM eclipse-temurin:21-jre-alpine

# INSTALL CA Certificates (useful for companies with SSL inspection)
ADD --chmod=644 docker/ca-trust/* /certificates/
RUN export USE_SYSTEM_CA_CERTS=1 && /__cacert_entrypoint.sh

ENV SERVICE=merchant-backoffice
ENV LOGS_DIRECTORY=/logs/

Expand Down
20 changes: 20 additions & 0 deletions scripts/download-agent.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

VERSION=v2.4.0-beta.1

# Define the URL of the Grafana OpenTelemetry agent
AGENT_URL="https://github.com/grafana/grafana-opentelemetry-java/releases/download/${VERSION}/grafana-opentelemetry-java.jar"

# Define the path to the instrumentation directory
#INSTRUMENTATION_DIR="$(dirname "$(dirname "${BASH_SOURCE[0]}")")/instrumentation"

INSTRUMENTATION_DIR="$(dirname "${BASH_SOURCE[0]}")/../instrumentation"

# Create the instrumentation directory if it doesn't exist
mkdir -p "$INSTRUMENTATION_DIR"

# Download the Grafana OpenTelemetry agent and save it in the instrumentation directory
curl -L "$AGENT_URL" -o "$INSTRUMENTATION_DIR/grafana-opentelemetry-java.jar"

# Print a success message
echo "Grafana OpenTelemetry agent downloaded successfully in $INSTRUMENTATION_DIR"
Loading