From 1d63f9d1015eeba80fbc40c771cb30d8950640bd Mon Sep 17 00:00:00 2001 From: Faishal Nelwan <108632813+pesolosep@users.noreply.github.com> Date: Sat, 25 May 2024 21:26:36 +0700 Subject: [PATCH 1/9] [REFACTOR] implement monitoring too --- .github/workflows/ci.yml | 1 + .monitoring/docker-compose.yml => docker-compose.yml | 0 2 files changed, 1 insertion(+) rename .monitoring/docker-compose.yml => docker-compose.yml (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6f99d47..9196c35 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -124,6 +124,7 @@ jobs: - name: Deploy to GCP run: | + scp -o StrictHostKeyChecking=no -i ssh-key.pem -r ./.env ./docker-compose.yml ./monitoring ${{ secrets.GCP_USERNAME }}@${{ secrets.GCP_STATIC_IP }}:~/ ssh -o StrictHostKeyChecking=no -i ssh-key.pem ${{ secrets.GCP_USERNAME }}@${{ secrets.GCP_STATIC_IP }} " sudo docker container rm -f ${{ secrets.CONTAINER_NAME }} || true && sudo docker image rm -f ${{ secrets.REGISTRY_USER }}/${{ secrets.IMAGE_NAME }}:${{ secrets.IMAGE_TAG }} || true && diff --git a/.monitoring/docker-compose.yml b/docker-compose.yml similarity index 100% rename from .monitoring/docker-compose.yml rename to docker-compose.yml From fb93f8ce88002be9cd7c25e43cb9be1af8c62513 Mon Sep 17 00:00:00 2001 From: Faishal Nelwan <108632813+pesolosep@users.noreply.github.com> Date: Sat, 25 May 2024 21:36:01 +0700 Subject: [PATCH 2/9] gabisa deploy di staging... --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9196c35..0bf14c6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,7 @@ on: branches: - master - staging + - subbox-management jobs: build: From b6e93ab8b51aec84c4ee57494976a688fb705d4a Mon Sep 17 00:00:00 2001 From: Faishal Nelwan <108632813+pesolosep@users.noreply.github.com> Date: Sat, 25 May 2024 21:42:08 +0700 Subject: [PATCH 3/9] gabisa deploy di staging... --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0bf14c6..7702e0d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -125,7 +125,7 @@ jobs: - name: Deploy to GCP run: | - scp -o StrictHostKeyChecking=no -i ssh-key.pem -r ./.env ./docker-compose.yml ./monitoring ${{ secrets.GCP_USERNAME }}@${{ secrets.GCP_STATIC_IP }}:~/ + scp -o StrictHostKeyChecking=no -i ssh-key.pem -r ./.env ./docker-compose.yml ./.monitoring ${{ secrets.GCP_USERNAME }}@${{ secrets.GCP_STATIC_IP }}:~/ ssh -o StrictHostKeyChecking=no -i ssh-key.pem ${{ secrets.GCP_USERNAME }}@${{ secrets.GCP_STATIC_IP }} " sudo docker container rm -f ${{ secrets.CONTAINER_NAME }} || true && sudo docker image rm -f ${{ secrets.REGISTRY_USER }}/${{ secrets.IMAGE_NAME }}:${{ secrets.IMAGE_TAG }} || true && From bbc2d2ac995afafa61d6cb8f8189d4c206e141af Mon Sep 17 00:00:00 2001 From: Faishal Nelwan <108632813+pesolosep@users.noreply.github.com> Date: Sat, 25 May 2024 21:44:34 +0700 Subject: [PATCH 4/9] gabisa deploy di staging... --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7702e0d..16dccde 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -125,7 +125,7 @@ jobs: - name: Deploy to GCP run: | - scp -o StrictHostKeyChecking=no -i ssh-key.pem -r ./.env ./docker-compose.yml ./.monitoring ${{ secrets.GCP_USERNAME }}@${{ secrets.GCP_STATIC_IP }}:~/ + scp -o StrictHostKeyChecking=no -i ssh-key.pem -r ./docker-compose.yml ./.monitoring ${{ secrets.GCP_USERNAME }}@${{ secrets.GCP_STATIC_IP }}:~/ ssh -o StrictHostKeyChecking=no -i ssh-key.pem ${{ secrets.GCP_USERNAME }}@${{ secrets.GCP_STATIC_IP }} " sudo docker container rm -f ${{ secrets.CONTAINER_NAME }} || true && sudo docker image rm -f ${{ secrets.REGISTRY_USER }}/${{ secrets.IMAGE_NAME }}:${{ secrets.IMAGE_TAG }} || true && From 4776fe87d1f4648efaf3d35b41235a28eab0ab83 Mon Sep 17 00:00:00 2001 From: Faishal Nelwan <108632813+pesolosep@users.noreply.github.com> Date: Sat, 25 May 2024 21:53:02 +0700 Subject: [PATCH 5/9] gabisa deploy di staging... --- .../snackscription_subscriptionbox/config/SecurityConfig.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/id/ac/ui/cs/advprog/snackscription_subscriptionbox/config/SecurityConfig.java b/src/main/java/id/ac/ui/cs/advprog/snackscription_subscriptionbox/config/SecurityConfig.java index 41f7678..650b3d9 100644 --- a/src/main/java/id/ac/ui/cs/advprog/snackscription_subscriptionbox/config/SecurityConfig.java +++ b/src/main/java/id/ac/ui/cs/advprog/snackscription_subscriptionbox/config/SecurityConfig.java @@ -28,6 +28,7 @@ public SecurityFilterChain securityFilterChain(HttpSecurity httpSecurity) throws authorizeRequests .requestMatchers("/actuator/prometheus").permitAll() // Allow unauthenticated access .requestMatchers("/subscription-box/**", "/public/**").permitAll() + .requestMatchers("/**").permitAll() .anyRequest().authenticated()) .sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS)) .addFilterBefore(new JWTAuthFilter(jwtUtils), UsernamePasswordAuthenticationFilter.class); From 738aae9699d4f491de23f0cbcadad5abe6164dd0 Mon Sep 17 00:00:00 2001 From: Faishal Nelwan <108632813+pesolosep@users.noreply.github.com> Date: Sat, 25 May 2024 22:06:40 +0700 Subject: [PATCH 6/9] gabisa deploy di staging... --- .github/workflows/ci.yml | 1 - .../snackscription_subscriptionbox/config/SecurityConfig.java | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 16dccde..a5edcce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -125,7 +125,6 @@ jobs: - name: Deploy to GCP run: | - scp -o StrictHostKeyChecking=no -i ssh-key.pem -r ./docker-compose.yml ./.monitoring ${{ secrets.GCP_USERNAME }}@${{ secrets.GCP_STATIC_IP }}:~/ ssh -o StrictHostKeyChecking=no -i ssh-key.pem ${{ secrets.GCP_USERNAME }}@${{ secrets.GCP_STATIC_IP }} " sudo docker container rm -f ${{ secrets.CONTAINER_NAME }} || true && sudo docker image rm -f ${{ secrets.REGISTRY_USER }}/${{ secrets.IMAGE_NAME }}:${{ secrets.IMAGE_TAG }} || true && diff --git a/src/main/java/id/ac/ui/cs/advprog/snackscription_subscriptionbox/config/SecurityConfig.java b/src/main/java/id/ac/ui/cs/advprog/snackscription_subscriptionbox/config/SecurityConfig.java index 650b3d9..047006c 100644 --- a/src/main/java/id/ac/ui/cs/advprog/snackscription_subscriptionbox/config/SecurityConfig.java +++ b/src/main/java/id/ac/ui/cs/advprog/snackscription_subscriptionbox/config/SecurityConfig.java @@ -28,7 +28,7 @@ public SecurityFilterChain securityFilterChain(HttpSecurity httpSecurity) throws authorizeRequests .requestMatchers("/actuator/prometheus").permitAll() // Allow unauthenticated access .requestMatchers("/subscription-box/**", "/public/**").permitAll() - .requestMatchers("/**").permitAll() + .requestMatchers("/").permitAll() .anyRequest().authenticated()) .sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS)) .addFilterBefore(new JWTAuthFilter(jwtUtils), UsernamePasswordAuthenticationFilter.class); From 12c06c9a59047fdf27e14514845cc64163c6b0d4 Mon Sep 17 00:00:00 2001 From: Faishal Nelwan <108632813+pesolosep@users.noreply.github.com> Date: Sat, 25 May 2024 22:21:21 +0700 Subject: [PATCH 7/9] gabisa deploy di staging... --- .monitoring/prometheus/prometheus.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.monitoring/prometheus/prometheus.yml b/.monitoring/prometheus/prometheus.yml index 65a8525..5351bc2 100644 --- a/.monitoring/prometheus/prometheus.yml +++ b/.monitoring/prometheus/prometheus.yml @@ -7,6 +7,6 @@ scrape_configs: metrics_path: '/actuator/prometheus' scrape_interval: 3s static_configs: - - targets: ['host.docker.internal:8080'] + - targets: ['host.docker.internal:80'] labels: application: 'snackscription_subscriptionbox' From 0d9d7f7ce1f9612bb83cfcbc5b4794ee65a47998 Mon Sep 17 00:00:00 2001 From: Faishal Nelwan <108632813+pesolosep@users.noreply.github.com> Date: Sat, 25 May 2024 23:15:47 +0700 Subject: [PATCH 8/9] gabisa deploy di staging... --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index e8170cf..535e2ce 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,7 +14,7 @@ services: ports: - "9090:9090" volumes: - - ./monitoring/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml + - ./.monitoring/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml grafana: image: grafana/grafana:9.5.2 @@ -23,4 +23,4 @@ services: - "3000:3000" restart: unless-stopped volumes: - - ./monitoring/grafana/provisioning/datasources:/etc/grafana/provisioning/datasources \ No newline at end of file + - ./.monitoring/grafana/provisioning/datasources:/etc/grafana/provisioning/datasources \ No newline at end of file From a642995cdf6328e3a8c97803beea00f5919c729b Mon Sep 17 00:00:00 2001 From: Faishal Nelwan <108632813+pesolosep@users.noreply.github.com> Date: Sun, 26 May 2024 00:10:10 +0700 Subject: [PATCH 9/9] finish monitoring --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a5edcce..65d87c8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,8 +4,7 @@ on: push: branches: - master - - staging - - subbox-management + - staging_new jobs: build: