diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a15c313..04a197e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,8 +4,9 @@ on: branches: - master - develop + - newDevelop - LaraFMz - - Pablo-Arreglos + - Pablo-AjustesFinales - jota pull_request: types: [opened, synchronize, reopened] diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 628c986..6e45adb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -134,6 +134,44 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} registry: ghcr.io workdir: questionservice + docker-push-grafana: + name: Push grafana service Docker Image to GitHub Packages + runs-on: ubuntu-latest + permissions: + contents: read + packages: write +# needs: [ e2e-tests ] + steps: + - uses: actions/checkout@v4 + - name: Publish to Registry + uses: elgohr/Publish-Docker-Github-Action@v5 + with: + name: arquisoft/wiq_es05a/grafana + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + registry: ghcr.io + workdir: monitoring/grafana + env: + GF_SECURITY_ADMIN_USER: ${{ secrets.GF_SECURITY_ADMIN_USER }} + GF_SECURITY_ADMIN_PASSWORD: ${{ secrets.GF_SECURITY_ADMIN_PASSWORD }} + GF_SERVER_SERVE_FROM_SUB_PATH: false + docker-push-prometheus: + name: Push prometheus service Docker Image to GitHub Packages + runs-on: ubuntu-latest + permissions: + contents: read + packages: write +# needs: [ e2e-tests ] + steps: + - uses: actions/checkout@v4 + - name: Publish to Registry + uses: elgohr/Publish-Docker-Github-Action@v5 + with: + name: arquisoft/wiq_es05a/prometheus + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + registry: ghcr.io + workdir: monitoring/prometheus deploy: name: Deploy over SSH runs-on: ubuntu-latest @@ -143,6 +181,8 @@ jobs: - docker-push-gatewayservice - docker-push-questionservice - docker-push-webapp + - docker-push-grafana + - docker-push-prometheus steps: - name: Deploy over SSH uses: fifsky/ssh-action@master diff --git a/docker-compose.yml b/docker-compose.yml index 6c53765..13cedc1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ version: '3' services: mongodb: - container_name: mongodb-${teamname:-wiq5a} + container_name: mongodb-${teamname:-wiq_es05a} image: mongo profiles: ["dev", "prod"] volumes: @@ -12,8 +12,8 @@ services: - mynetwork questionservice: - container_name: questionservice-${teamname:-wiq5a} - image: ghcr.io/arquisoft/wiq_5a/questionservice:latest + container_name: questionservice-${teamname:-wiq_es05a} + image: ghcr.io/arquisoft/wiq_es05a/questionservice:latest profiles: ["dev", "prod"] build: ./questionservice ports: @@ -25,8 +25,8 @@ services: - mynetwork authservice: - container_name: authservice-${teamname:-wiq5a} - image: ghcr.io/arquisoft/wiq_5a/authservice:latest + container_name: authservice-${teamname:-wiq_es05a} + image: ghcr.io/arquisoft/wiq_es05a/authservice:latest profiles: ["dev", "prod"] build: ./userservice/authservice depends_on: @@ -39,8 +39,8 @@ services: MONGODB_URI: mongodb://mongodb:27017/userdb userservice: - container_name: userservice-${teamname:-wiq5a} - image: ghcr.io/arquisoft/wiq_5a/userservice:latest + container_name: userservice-${teamname:-wiq_es05a} + image: ghcr.io/arquisoft/wiq_es05a/userservice:latest profiles: ["dev", "prod"] build: ./userservice/userservice depends_on: @@ -53,8 +53,8 @@ services: MONGODB_URI: mongodb://mongodb:27017/userdb gatewayservice: - container_name: gatewayservice-${teamname:-wiq5a} - image: ghcr.io/arquisoft/wiq_5a/gatewayservice:latest + container_name: gatewayservice-${teamname:-wiq_es05a} + image: ghcr.io/arquisoft/wiq_es05a/gatewayservice:latest profiles: ["dev", "prod"] build: ./gatewayservice depends_on: @@ -72,8 +72,8 @@ services: QUESTION_SERVICE_URL: http://questionservice:8003 webapp: - container_name: webapp-${teamname:-wiq5a} - image: ghcr.io/arquisoft/wiq_5a/webapp:latest + container_name: webapp-${teamname:-wiq_es05a} + image: ghcr.io/arquisoft/wiq_es05a/webapp:latest profiles: ["dev", "prod"] build: ./webapp depends_on: @@ -82,30 +82,34 @@ services: - "3000:3000" prometheus: - image: prom/prometheus - container_name: prometheus-${teamname:-wiq5a} - profiles: ["dev"] + image: ghcr.io/arquisoft/wiq_es05a/prometheus:latest + container_name: prometheus-${teamname:-wiq_es05a} + build: ./monitoring/prometheus + profiles: ["dev", "prod"] networks: - mynetwork volumes: - prometheus_data:/prometheus ports: - "9090:9090" + depends_on: + - gatewayservice + grafana: - image: grafana/grafana - container_name: grafana-${teamname:-wiq5a} - profiles: ["dev"] + image: ghcr.io/arquisoft/wiq_es05a/grafana:latest + container_name: grafana-${teamname:-wiq_es05a} + build: ./monitoring/grafana + profiles: ["dev", "prod"] networks: - mynetwork volumes: - grafana_data:/var/lib/grafana - - ./gatewayservice/monitoring/grafana/provisioning:/etc/grafana/provisioning environment: - GF_SERVER_HTTP_PORT=9091 - - GF_AUTH_DISABLE_LOGIN_FORM=true - - GF_AUTH_ANONYMOUS_ENABLED=true - - GF_AUTH_ANONYMOUS_ORG_ROLE=Admin + - GF_SECURITY_ADMIN_USER=${GF_SECURITY_ADMIN_USER:-admin} + - GF_SECURITY_ADMIN_PASSWORD=${GF_SECURITY_ADMIN_PASSWORD:-changeme} + - GF_SERVER_SERVE_FROM_SUB_PATH=${GF_SERVER_SERVE_FROM_SUB_PATH:-true} ports: - "9091:9091" depends_on: diff --git a/gatewayservice/monitoring/prometheus/prometheus.yml b/gatewayservice/monitoring/prometheus/prometheus.yml deleted file mode 100644 index e20232c..0000000 --- a/gatewayservice/monitoring/prometheus/prometheus.yml +++ /dev/null @@ -1,6 +0,0 @@ -global: - scrape_interval: 5s -scrape_configs: - - job_name: "example-nodejs-app" - static_configs: - - targets: ["gatewayservice-wiq5a:8000","userservice-wiq5a:8001","authservice-wiq5a:8002","questionservice-wiq5a:8003"] \ No newline at end of file diff --git a/monitoring/grafana/Dockerfile b/monitoring/grafana/Dockerfile new file mode 100644 index 0000000..c98c055 --- /dev/null +++ b/monitoring/grafana/Dockerfile @@ -0,0 +1,5 @@ +FROM grafana/grafana + +COPY provisioning/ /etc/grafana/provisioning/ + +CMD ["./bin/grafana"] \ No newline at end of file diff --git a/gatewayservice/monitoring/grafana/provisioning/dashboards/dashboard.yml b/monitoring/grafana/provisioning/dashboards/dashboard.yml similarity index 100% rename from gatewayservice/monitoring/grafana/provisioning/dashboards/dashboard.yml rename to monitoring/grafana/provisioning/dashboards/dashboard.yml diff --git a/gatewayservice/monitoring/grafana/provisioning/dashboards/example-service-dashboard.json b/monitoring/grafana/provisioning/dashboards/example-service-dashboard.json similarity index 99% rename from gatewayservice/monitoring/grafana/provisioning/dashboards/example-service-dashboard.json rename to monitoring/grafana/provisioning/dashboards/example-service-dashboard.json index 61da159..279d4df 100644 --- a/gatewayservice/monitoring/grafana/provisioning/dashboards/example-service-dashboard.json +++ b/monitoring/grafana/provisioning/dashboards/example-service-dashboard.json @@ -372,4 +372,4 @@ "title": "Example Service Dashboard", "uid": "1DYaynomMk", "version": 2 -} +} \ No newline at end of file diff --git a/gatewayservice/monitoring/grafana/provisioning/datasources/datasource.yml b/monitoring/grafana/provisioning/datasources/datasource.yml similarity index 100% rename from gatewayservice/monitoring/grafana/provisioning/datasources/datasource.yml rename to monitoring/grafana/provisioning/datasources/datasource.yml diff --git a/monitoring/prometheus/Dockerfile b/monitoring/prometheus/Dockerfile new file mode 100644 index 0000000..e59b484 --- /dev/null +++ b/monitoring/prometheus/Dockerfile @@ -0,0 +1,5 @@ +FROM prom/prometheus + +COPY prometheus.yml . + +ENTRYPOINT ["/bin/prometheus"] \ No newline at end of file diff --git a/monitoring/prometheus/prometheus.yml b/monitoring/prometheus/prometheus.yml new file mode 100644 index 0000000..f305c9b --- /dev/null +++ b/monitoring/prometheus/prometheus.yml @@ -0,0 +1,6 @@ +global: + scrape_interval: 15s +scrape_configs: + - job_name: "example-nodejs-app" + static_configs: + - targets: ["gatewayservice-wiq_es05a:8000","userservice-wiq_es05a:8001","authservice-wiq_es05a:8002","questionservice-wiq_es05a:8003"] \ No newline at end of file