diff --git a/ansible/files/.gitmodules b/ansible/files/.gitmodules new file mode 100644 index 0000000..b4297fe --- /dev/null +++ b/ansible/files/.gitmodules @@ -0,0 +1,3 @@ +[submodule "doodlestudent"] + path = doodlestudent + url = https://github.com/barais/doodlestudent.git diff --git a/ansible/files/dockercompose/docker-compose.yml b/ansible/files/dockercompose/docker-compose.yml index c8e2e92..c507ea5 100644 --- a/ansible/files/dockercompose/docker-compose.yml +++ b/ansible/files/dockercompose/docker-compose.yml @@ -2,38 +2,49 @@ services: #https://dev.to/rafi021/how-to-set-up-a-monitoring-stack-with-prometheus-grafana-and-node-exporter-using-docker-compose-17cc #https://belginux.com/monitoring-docker-grafana-prometheus-cadvisor/ #https://github.com/Einsteinish/Docker-Compose-Prometheus-and-Grafana/tree/master - prometheus: - image: prom/prometheus:latest - container_name: prometheus - restart: unless-stopped - ports: - - "9090:9090" - volumes: - - ../prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro - command: - - "--config.file=/etc/prometheus/prometheus.yml" - depends_on: - - back - - db - networks: - - app-network +# prometheus: +# image: prom/prometheus:latest +# container_name: prometheus +# restart: unless-stopped +# ports: +# - "9090:9090" +# volumes: +# - ../prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro +# command: +# - "--config.file=/etc/prometheus/prometheus.yml" +# depends_on: +# - back +# - db +# networks: +# - app-network + +# grafana: +# build: +# context: .. +# dockerfile: dockerfiles/grafana/Dockerfile +# container_name: grafana +# restart: unless-stopped +# volumes: +# - grafana-data:/var/lib/grafana +# - ../grafana/provisioning:/etc/grafana/provisioning +# depends_on: +# - prometheus +# environment: +# - GF_SECURITY_ADMIN_USER=tlc +# - GF_SECURITY_ADMIN_PASSWORD=tlc +# networks: +# - app-network + + # https://stackoverflow.com/questions/57591868/how-correctly-install-ssl-certificate-using-certbot-in-docker + # certbot: + # image: certbot/certbot:latest + # container_name: certbot + # depends_on: + # - front + # volumes: + # - ../certbot/www/:/var/www/certbot/:rw + # - ../certbot/conf/:/etc/letsencrypt/:rw - grafana: - build: - context: .. - dockerfile: dockerfiles/grafana/Dockerfile - container_name: grafana - restart: unless-stopped - volumes: - - grafana-data:/var/lib/grafana - - ../grafana/provisioning:/etc/grafana/provisioning - depends_on: - - prometheus - environment: - - GF_SECURITY_ADMIN_USER=tlc - - GF_SECURITY_ADMIN_PASSWORD=tlc - networks: - - app-network front: build: @@ -56,26 +67,13 @@ services: networks: - app-network -# https://stackoverflow.com/questions/57591868/how-correctly-install-ssl-certificate-using-certbot-in-docker -# certbot: -# image: certbot/certbot:latest -# container_name: certbot -# depends_on: -# - front -# volumes: -# - ../certbot/www/:/var/www/certbot/:rw -# - ../certbot/conf/:/etc/letsencrypt/:rw back: - build: - context: .. - dockerfile: dockerfiles/back/Dockerfile + image : benarbause/doodleback-with-quarkus:latest ports: - "8080:8080" volumes: - ../doodlestudent/api:/app - environment: - - FLASK_ENV=development depends_on: db: condition: service_healthy diff --git a/ansible/files/dockerfiles/grafana/Dockerfile b/ansible/files/dockerfiles/grafana/Dockerfile new file mode 100644 index 0000000..c0fae39 --- /dev/null +++ b/ansible/files/dockerfiles/grafana/Dockerfile @@ -0,0 +1,2 @@ +FROM grafana/grafana:latest +RUN grafana-cli plugins install grafana-munin-datasource \ No newline at end of file diff --git a/ansible/files/grafana/provisioning/datasources/datasource.yml b/ansible/files/grafana/provisioning/datasources/datasource.yml new file mode 100644 index 0000000..bb37f13 --- /dev/null +++ b/ansible/files/grafana/provisioning/datasources/datasource.yml @@ -0,0 +1,11 @@ +apiVersion: 1 + +datasources: + - name: Prometheus + type: prometheus + access: proxy + orgId: 1 + url: http://prometheus:9090 + basicAuth: false + isDefault: true + editable: true \ No newline at end of file diff --git a/ansible/files/prometheus/prometheus.yml b/ansible/files/prometheus/prometheus.yml new file mode 100644 index 0000000..a8e5997 --- /dev/null +++ b/ansible/files/prometheus/prometheus.yml @@ -0,0 +1,8 @@ +global: + scrape_interval: 15s + +scrape_configs: + - job_name: "backend_quarkus" + metrics_path: /q/metrics + static_configs: + - targets: ["back:8080"] \ No newline at end of file diff --git a/ansible/playbook.yml b/ansible/playbook.yml index 15b5b56..96a28bd 100755 --- a/ansible/playbook.yml +++ b/ansible/playbook.yml @@ -55,17 +55,17 @@ # Munin Configuration #https://stackoverflow.com/questions/77941169/ansible-add-line-update-etc-hosts-when-outdated - - name: Install Munin Node - ansible.builtin.lineinfile: - path: /etc/munin/munin-node.conf - regexp: '^allow' - line: "allow ^127\\.0\\.0\\.1$" - - - name: Restart munin-node - systemd: - name: munin-node - state: restarted - enabled: yes +# - name: Install Munin Node +# ansible.builtin.lineinfile: +# path: /etc/munin/munin-node.conf +# regexp: '^allow' +# line: "allow ^127\\.0\\.0\\.1$" +# +# - name: Restart munin-node +# systemd: +# name: munin-node +# state: restarted +# enabled: yes - name: Install Docker plugins apt: