-
Notifications
You must be signed in to change notification settings - Fork 2
/
cloud-init.yaml
69 lines (58 loc) · 1.72 KB
/
cloud-init.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#cloud-config
groups:
- docker
apt:
sources:
docker.list:
source: deb [arch=amd64] https://download.docker.com/linux/ubuntu jammy stable
keyid: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
package_update: true
packages:
- apt-transport-https
- ca-certificates
- curl
- software-properties-common
- gnupg
- docker-ce
- docker-ce-cli
- containerd.io
- docker-compose-plugin
bootcmd:
- mkfs.ext4 -F /dev/disk/by-id/google-DISK_NAME
- mount /dev/disk/by-id/google-DISK_NAME /opt/ads-monitor
- echo "/dev/disk/by-id/google-DISK_NAME /opt/ads-monitor ext4 discard,defaults 0 0" >> /etc/fstab
- mkdir -p /opt/ads-monitor/prometheus /opt/ads-monitor/grafana /opt/ads-monitor/alertmanager
- chown -R 472:472 /opt/ads-monitor/grafana
- mkdir -p /config
write_files:
- path: /opt/ads-monitor/prometheus/prometheus.yml
permissions: '0644'
content: |
# PROMETHEUS CONFIG
- path: /opt/ads-monitor/prometheus/alerts.yml
permissions: '0644'
content: |
# PROMETHEUS ALERTS
- path: /opt/ads-monitor/alertmanager/alertmanager.yml
permissions: '0644'
content: |
# ALERTMANAGER CONFIG
- path: /opt/ads-monitor/docker-compose.yaml
permissions: '0644'
content: |
# DOCKER COMPOSE CONTENT
- path: /opt/ads-monitor/google-ads.yaml
permissions: '0644'
content: |
# GOOGLE ADS YAML CONTENT
- path: /opt/ads-monitor/.env
permissions: '0644'
content: |
GAARF_EXPORTER_ACCOUNT_ID=GAARF_EXPORTER_ACCOUNT_ID_VAR
GOOGLE_ADS_YAML=/opt/ads-monitor/google-ads.yaml
REPO_LOCATION=REPO_LOCATION_VAR
REPO_NAME=REPO_NAME_VAR
PROJECT_ID=PROJECT_ID_VAR
runcmd:
- usermod -aG docker ubuntu
- cd /opt/ads-monitor && docker compose -f docker-compose.yaml --env-file .env up -d