Skip to content

Commit

Permalink
Merge pull request #1301 from mira-miracoli/fix-grafana-II
Browse files Browse the repository at this point in the history
fix grafana playbook for new VM
  • Loading branch information
mira-miracoli authored Sep 5, 2024
2 parents 513e9cc + 1e76e6d commit 6b6034d
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 22 deletions.
34 changes: 17 additions & 17 deletions grafana.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
- name: Install Dependencies
become: true
ansible.builtin.package:
name: ['python3-virtualenv', 'python3-docker']
name: ["python3-virtualenv", "python3-docker", "python3-pip"]
- name: Install docker compose python (no rpm available)
ansible.builtin.pip:
name: docker-compose
version: 1.29.2
- name: Ensure git is installed. (hxr.monitor-ssl)
become: true
ansible.builtin.package:
Expand Down Expand Up @@ -47,19 +51,21 @@
- grafana.grafana
roles:
## Starting configuration of the operating system
- role: usegalaxy_eu.fw_glxeu_generic
become: true
- role: geerlingguy.repo-epel # Install EPEL repository
become: true
- role: usegalaxy_eu.handy.os_setup
become: true
vars:
hostname: "{{ grafana_domain }}"
enable_hostname: true
enable_powertools: true # geerlingguy.repo-epel role doesn't enable PowerTools repository
- role: geerlingguy.repo-epel # Install EPEL repository
become: true
- role: usegalaxy-eu.autoupdates # keep all of our packages up to date
enable_powertools: true # geerlingguy.repo-epel role doesn't enable PowerTools repository
- role: usegalaxy-eu.autoupdates # keep all of our packages up to date
become: true
vars:
hostname: "{{ grafana_domain }}"
- influxdata.chrony # Keep our time in sync.
- influxdata.chrony # Keep our time in sync.

## Monitoring
- dj-wasabi.telegraf
Expand Down Expand Up @@ -114,23 +120,17 @@
group: "{{ ansible_ssh_user }}"
mode: "0600"
- name: Create env
copy:
ansible.builtin.copy:
content: |
DOMAIN=http://localhost:8080
DOMAIN=https://{{ grafana_on_call_domain }}
SECRET_KEY={{ grafana_on_call_secret }}
COMPOSE_PROFILES=''
dest: "{{ grafana_on_call_path }}/.env"
owner: "{{ ansible_ssh_user }}"
group: "{{ ansible_ssh_user }}"
mode: "0600"
no_log: true
- name: Spin up OnCall
community.general.docker_compose:
project_src: "{{ grafana_on_call_path }}"
- name: Remove OnCall
when: not grafana_on_call
block:
- name: Stop all services
community.general.docker_compose:
- name: Start OnCall
community.docker.docker_compose_v2:
project_src: "{{ grafana_on_call_path }}"
state: absent
project_name: oncall
11 changes: 7 additions & 4 deletions group_vars/grafana/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ certbot_auth_method: --webroot
certbot_well_known_root: /srv/nginx/_well-known_root
certbot_share_key_users:
- nginx
certbot_virtualenv_command: virtualenv-3.6
certbot_virtualenv_package_name: python3-virtualenv
certbot_post_renewal: |
systemctl restart nginx || true
certbot_domains:
- "{{ grafana_domain }}"
- "{{ grafana_on_call_domain }}"
#hostname: "{{ grafana_domain }}"
# NGINX
nginx_enable_default_server: false
Expand Down Expand Up @@ -35,7 +37,9 @@ nginx_conf_ssl_certificate: /etc/ssl/certs/fullchain.pem
nginx_conf_ssl_certificate_key: /etc/ssl/user/privkey-nginx.pem

#setting this to false will remove the on call compose services and it's compose directory
grafana_on_call: false
grafana_on_call: true
grafana_on_call_domain: oncall.galaxyproject.eu
grafana_on_call_path: /data/grafana-on-call
# Grafana
grafana_version: 11.0.0

Expand Down Expand Up @@ -76,6 +80,7 @@ grafana_auth:
token_url: "https://github.com/login/oauth/access_token"
api_url: "https://api.github.com/user"
allowed_organisations: "usegalaxy.eu galaxyproject"
role_attribute_path: contains(groups[*], '@usegalaxy-eu/admingrafana') && 'GrafanaAdmin' || 'Viewer'
grafana_auth_admin_password: "{{ vault_grafana_auth_admin_password }}"

grafana_image_storage:
Expand Down Expand Up @@ -257,5 +262,3 @@ ggb_create_group: true
bridge_token: "{{ vault_grafana_gitter_bridge_token }}"
gitter_auth_token: "{{ vault_grafana_gitter_bridge_auth_token }}"
gitter_room_id: "{{ vault_grafana_gitter_room_id }}"

grafana_on_call_path: /data/grafana-on-call
5 changes: 4 additions & 1 deletion requirements.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ collections:
source: https://galaxy.ansible.com
type: galaxy
- name: community.docker
version: 1.9.0
version: 3.12.1
source: https://galaxy.ansible.com
type: galaxy
- name: grafana.grafana
Expand Down Expand Up @@ -153,3 +153,6 @@ roles:
- src: https://github.com/usegalaxy-eu/ansible-traefik
name: usegalaxy_eu.traefik
version: 2.0.0
- src: "[email protected]:usegalaxy-eu/ansible-fw-glxeu-generic.git"
name: usegalaxy_eu.fw_glxeu_generic
version: 1.0.0
18 changes: 18 additions & 0 deletions templates/nginx/grafana-ssl.j2
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,21 @@ server {
}

}
server {

listen 443 ssl;
listen [::]:443 ssl;

server_name oncall.galaxyproject.eu;


location / {
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://127.0.0.1:8080;
proxy_pass_request_headers on;
}
}

0 comments on commit 6b6034d

Please sign in to comment.