From f55157a5cdf4e6c77a9c25200e9cbe4dbbe6547f Mon Sep 17 00:00:00 2001 From: Dario Date: Tue, 23 Apr 2024 19:30:54 +0200 Subject: [PATCH 1/7] feat: fixed prometheus --- api/monitoring/prometheus/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/monitoring/prometheus/Dockerfile b/api/monitoring/prometheus/Dockerfile index 0e465edc..9f9e3f6f 100644 --- a/api/monitoring/prometheus/Dockerfile +++ b/api/monitoring/prometheus/Dockerfile @@ -7,4 +7,4 @@ COPY ./configuration /etc/prometheus EXPOSE 9090 # Run Prometheus in the foreground -CMD ["prometheus"] +CMD ["--config.file=/etc/prometheus/prometheus.yml"] From df786c77b1fbe293f4359f78c6f3957f5c16ce87 Mon Sep 17 00:00:00 2001 From: Dario Date: Wed, 24 Apr 2024 17:19:06 +0200 Subject: [PATCH 2/7] fix: added ip to prometheus --- api/monitoring/prometheus/configuration/prometheus.yml | 3 ++- docker-compose.yml | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/api/monitoring/prometheus/configuration/prometheus.yml b/api/monitoring/prometheus/configuration/prometheus.yml index 8a5f0486..22f18bed 100644 --- a/api/monitoring/prometheus/configuration/prometheus.yml +++ b/api/monitoring/prometheus/configuration/prometheus.yml @@ -2,7 +2,8 @@ scrape_configs: - job_name: 'WiqMetrics' metrics_path: '/actuator/prometheus' scrape_interval: 10s + scheme: https static_configs: - - targets: ['host.docker.internal:8443'] + - targets: ['<%= ENV["API_URI"] %>'] labels: application: 'WIQ API' \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index e587ec0a..6e409619 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -95,6 +95,9 @@ - "9090:9090" networks: mynetwork: + environment: + - API_URI=${API_URI} + volumes: - prometheus_data:/prometheus - /certs:/etc/letsencrypt/kiwiq.run.place:ro From fc169896530dc80bb6cbc41e944b6011299e140e Mon Sep 17 00:00:00 2001 From: Dario Date: Wed, 24 Apr 2024 17:21:22 +0200 Subject: [PATCH 3/7] fix: not blocking actuator anymore --- .../main/java/lab/en2b/quizapi/auth/config/SecurityConfig.java | 1 + 1 file changed, 1 insertion(+) diff --git a/api/src/main/java/lab/en2b/quizapi/auth/config/SecurityConfig.java b/api/src/main/java/lab/en2b/quizapi/auth/config/SecurityConfig.java index aa965a08..5e7ed38a 100644 --- a/api/src/main/java/lab/en2b/quizapi/auth/config/SecurityConfig.java +++ b/api/src/main/java/lab/en2b/quizapi/auth/config/SecurityConfig.java @@ -64,6 +64,7 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http, Authentication .requestMatchers(HttpMethod.GET,"/users","/users/**").permitAll() .requestMatchers(HttpMethod.GET,"/auth/logout").authenticated() .requestMatchers(HttpMethod.POST,"/auth/**").permitAll() + .requestMatchers(HttpMethod.GET, "/actuator/**").permitAll() .requestMatchers(HttpMethod.GET, "/swagger/**").permitAll() .anyRequest().authenticated()) .csrf(AbstractHttpConfigurer::disable) From 068b0c59ead1134d0924c3a5ad84e058efe41648 Mon Sep 17 00:00:00 2001 From: Dario Date: Wed, 24 Apr 2024 17:42:52 +0200 Subject: [PATCH 4/7] fix: actuator post --- .../main/java/lab/en2b/quizapi/auth/config/SecurityConfig.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/src/main/java/lab/en2b/quizapi/auth/config/SecurityConfig.java b/api/src/main/java/lab/en2b/quizapi/auth/config/SecurityConfig.java index 5e7ed38a..46be4f1b 100644 --- a/api/src/main/java/lab/en2b/quizapi/auth/config/SecurityConfig.java +++ b/api/src/main/java/lab/en2b/quizapi/auth/config/SecurityConfig.java @@ -58,13 +58,14 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http, Authentication .cors(Customizer.withDefaults()) .sessionManagement(configuration -> configuration.sessionCreationPolicy(SessionCreationPolicy.STATELESS)) .authorizeHttpRequests(authorize -> authorize + .requestMatchers(HttpMethod.GET, "/actuator/**").permitAll() + .requestMatchers(HttpMethod.POST, "/actuator/**").permitAll() .requestMatchers(HttpMethod.POST,"/questions/**").permitAll() .requestMatchers(HttpMethod.GET,"/questions/**").permitAll() .requestMatchers(HttpMethod.GET,"/users/details").authenticated() .requestMatchers(HttpMethod.GET,"/users","/users/**").permitAll() .requestMatchers(HttpMethod.GET,"/auth/logout").authenticated() .requestMatchers(HttpMethod.POST,"/auth/**").permitAll() - .requestMatchers(HttpMethod.GET, "/actuator/**").permitAll() .requestMatchers(HttpMethod.GET, "/swagger/**").permitAll() .anyRequest().authenticated()) .csrf(AbstractHttpConfigurer::disable) From aad694e8bd7cb0e438317fe5dee72ff38430a029 Mon Sep 17 00:00:00 2001 From: Dario Date: Wed, 24 Apr 2024 17:43:16 +0200 Subject: [PATCH 5/7] fix: update url --- api/monitoring/prometheus/configuration/prometheus.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/monitoring/prometheus/configuration/prometheus.yml b/api/monitoring/prometheus/configuration/prometheus.yml index 22f18bed..6d3883d4 100644 --- a/api/monitoring/prometheus/configuration/prometheus.yml +++ b/api/monitoring/prometheus/configuration/prometheus.yml @@ -4,6 +4,6 @@ scrape_configs: scrape_interval: 10s scheme: https static_configs: - - targets: ['<%= ENV["API_URI"] %>'] + - targets: ['kiwiq.run.place:8443'] labels: application: 'WIQ API' \ No newline at end of file From 8ff30f912e9ddf85bde6831ba3128297efe48e82 Mon Sep 17 00:00:00 2001 From: Dario Date: Wed, 24 Apr 2024 18:04:35 +0200 Subject: [PATCH 6/7] fix: hardcoded ip for prometheus --- api/monitoring/grafana/provisioning/datasources/datasources.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/monitoring/grafana/provisioning/datasources/datasources.yml b/api/monitoring/grafana/provisioning/datasources/datasources.yml index 8347c19b..ceb83d7c 100644 --- a/api/monitoring/grafana/provisioning/datasources/datasources.yml +++ b/api/monitoring/grafana/provisioning/datasources/datasources.yml @@ -4,7 +4,7 @@ datasources: type: prometheus access: proxy orgId: 1 - url: http://prometheus:9090 + url: http://20.199.84.5:9090 basicAuth: false isDefault: true editable: true \ No newline at end of file From 3b20f6789d6dd97b3d0605057947cc717ce04a7c Mon Sep 17 00:00:00 2001 From: Dario Date: Wed, 24 Apr 2024 18:04:48 +0200 Subject: [PATCH 7/7] fix: disabled auth login form for grafana --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 6e409619..86adc28d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -117,7 +117,7 @@ - "9091:9091" environment: - GF_SERVER_HTTP_PORT=9091 - - GF_AUTH_DISABLE_LOGIN_FORM=true + #- GF_AUTH_DISABLE_LOGIN_FORM=true depends_on: - prometheus volumes: