-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
062857c
commit 0033a3b
Showing
17 changed files
with
479 additions
and
38 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 |
---|---|---|
|
@@ -46,4 +46,6 @@ bin/ | |
app.key | ||
app.pub | ||
*.key | ||
*.pub | ||
*.pub | ||
|
||
prometheus-data/ |
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
FROM openjdk:21-slim-buster | ||
|
||
WORKDIR /ticketsifsp/api/ | ||
ARG JAR_FILE=tickets-ifsp-api.jar | ||
WORKDIR /ticketsapi/api/ | ||
ARG JAR_FILE=tickets-api.jar | ||
|
||
COPY ./build/libs/${JAR_FILE} ./api.jar | ||
|
||
VOLUME /ticketsifsp/uploads | ||
VOLUME /ticketsapi/uploads | ||
|
||
ENTRYPOINT ["java","-jar","api.jar", "-Dfile.encoding=UTF-8", "-Dsun.jnu.encoding=UTF-8"] |
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,60 @@ | ||
services: | ||
db: | ||
container_name: psql-db | ||
image: postgres:16.4 | ||
environment: | ||
POSTGRES_DB: ifspcbt | ||
POSTGRES_USER: root | ||
POSTGRES_PASSWORD: password | ||
TZ: America/Sao_Paulo | ||
volumes: | ||
- db_data:/var/lib/postgresql/data | ||
ports: | ||
- "5432:5432" | ||
networks: | ||
- ifspcbt | ||
restart: always | ||
|
||
backend: | ||
container_name: ifspcbt-api | ||
image: ghcr.io/ifspcbt-devspace/ifspcbt-devspace/tickets-ifsp-api:latest | ||
environment: | ||
- TZ=America/Sao_Paulo | ||
- JWT_SECRET_KEY=secret | ||
- MAIL_HOST=smtp.gmail.com | ||
- MAIL_PORT=587 | ||
- MAIL_USERNAME=example@gmail.com | ||
- MAIL_PASSWORD=password | ||
- DATASOURCE_URL=jdbc:postgresql://localhost:5432/ifspcbt | ||
- DATASOURCE_USERNAME=root | ||
- DATASOURCE_PASSWORD=password | ||
- ENCRYPTOR_VALUE=secret | ||
- FRONTEND_TICKET_CHECK_URL=https://eventos.ifspcbt.shop/admin/ticket/%s/check | ||
- MERCADOPAGO_ACCESSTOKEN=token | ||
- ENV_NAME=dev | ||
- LOG_PATH=/ticketsapi/logs/ | ||
- UPLOAD_PATH=/ticketsapi/uploads/ | ||
volumes: | ||
- /home/ticketsapi/uploads:/ticketsapi/uploads | ||
- /home/ticketsapi/logs:/ticketsapi/logs | ||
ports: | ||
- "8091:8091" | ||
depends_on: | ||
- db | ||
networks: | ||
- ifspcbt | ||
|
||
watchtower: | ||
privileged: true | ||
image: containrrr/watchtower | ||
volumes: | ||
- /var/run/docker.sock:/var/run/docker.sock | ||
- /root/.docker/config.json:/config.json | ||
command: --interval 30 | ||
|
||
volumes: | ||
db_data: | ||
|
||
networks: | ||
ifspcbt: | ||
driver: bridge |
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
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
3 changes: 1 addition & 2 deletions
3
infrastructure/src/main/java/br/com/ifsp/tickets/infra/Main.java
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 |
---|---|---|
@@ -1,13 +1,12 @@ | ||
package br.com.ifsp.tickets.infra; | ||
|
||
import br.com.ifsp.tickets.infra.config.WebServerConfig; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
@SpringBootApplication | ||
public class Main { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(WebServerConfig.class, args); | ||
SpringApplication.run(Main.class, args); | ||
} | ||
} |
71 changes: 71 additions & 0 deletions
71
infrastructure/src/main/java/br/com/ifsp/tickets/infra/config/ObservabilityConfig.java
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,71 @@ | ||
package br.com.ifsp.tickets.infra.config; | ||
|
||
import io.micrometer.core.instrument.Tag; | ||
import io.micrometer.core.instrument.config.MeterFilter; | ||
import io.opentelemetry.api.OpenTelemetry; | ||
import io.opentelemetry.api.common.Attributes; | ||
import io.opentelemetry.context.propagation.ContextPropagators; | ||
import io.opentelemetry.exporter.otlp.logs.OtlpGrpcLogRecordExporter; | ||
import io.opentelemetry.instrumentation.logback.appender.v1_0.OpenTelemetryAppender; | ||
import io.opentelemetry.sdk.OpenTelemetrySdk; | ||
import io.opentelemetry.sdk.logs.LogRecordProcessor; | ||
import io.opentelemetry.sdk.logs.SdkLoggerProvider; | ||
import io.opentelemetry.sdk.logs.SdkLoggerProviderBuilder; | ||
import io.opentelemetry.sdk.logs.export.BatchLogRecordProcessor; | ||
import io.opentelemetry.sdk.resources.Resource; | ||
import io.opentelemetry.sdk.trace.SdkTracerProvider; | ||
import io.opentelemetry.semconv.ResourceAttributes; | ||
import org.springframework.beans.factory.ObjectProvider; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.core.env.Environment; | ||
|
||
import java.time.ZoneId; | ||
import java.util.List; | ||
import java.util.UUID; | ||
|
||
@Configuration | ||
public class ObservabilityConfig { | ||
|
||
@Bean | ||
public MeterFilter commonTagsMeterFilter() { | ||
return MeterFilter.commonTags( | ||
List.of( | ||
Tag.of("instance.uuid", UUID.randomUUID().toString()), | ||
Tag.of("zone.id", ZoneId.systemDefault().toString()) | ||
) | ||
); | ||
} | ||
|
||
@Bean | ||
public OpenTelemetry openTelemetry(SdkLoggerProvider sdkLoggerProvider, SdkTracerProvider sdkTracerProvider, ContextPropagators contextPropagators) { | ||
final OpenTelemetrySdk openTelemetrySdk = OpenTelemetrySdk.builder() | ||
.setLoggerProvider(sdkLoggerProvider) | ||
.setTracerProvider(sdkTracerProvider) | ||
.setPropagators(contextPropagators) | ||
.build(); | ||
OpenTelemetryAppender.install(openTelemetrySdk); | ||
return openTelemetrySdk; | ||
} | ||
|
||
@Bean | ||
public SdkLoggerProvider otelSdkLoggerProvider(Environment environment, ObjectProvider<LogRecordProcessor> logRecordProcessors) { | ||
final String applicationName = environment.getProperty("spring.application.name", "tickets-api"); | ||
final Resource springResource = Resource.create(Attributes.of(ResourceAttributes.SERVICE_NAME, applicationName)); | ||
final SdkLoggerProviderBuilder builder = SdkLoggerProvider.builder() | ||
.setResource(Resource.getDefault().merge(springResource)); | ||
logRecordProcessors.orderedStream().forEach(builder::addLogRecordProcessor); | ||
return builder.build(); | ||
} | ||
|
||
@Bean | ||
public LogRecordProcessor otelLogRecordProcessor() { | ||
return BatchLogRecordProcessor | ||
.builder( | ||
OtlpGrpcLogRecordExporter.builder() | ||
.setEndpoint("http://localhost:4317") | ||
.build()) | ||
.build(); | ||
} | ||
|
||
} |
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
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
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.