-
Notifications
You must be signed in to change notification settings - Fork 24
/
deployment.yaml
116 lines (113 loc) · 3.81 KB
/
deployment.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# ***************** Universidad de los Andes ***********************
# ****** Departamento de Ingeniería de Sistemas y Computación ******
# ********** Arquitectura y diseño de Software - ISIS2503 **********
#
# Infraestructura para laboratorio de Autenticación
# Elementos a desplegar:
# 1. Firewalls:
# - authd-firewall-django
# - authd-firewall-db
# 2. Instancias MVs:
# - authd-django-instance (repositorio clonado y requerimientos instalados)
# - authd-db-instance (postgreSQL instalado y configurado)
resources:
# Firewall rules
- name: authd-firewall-django
type: compute.v1.firewall
properties:
network: https://www.googleapis.com/compute/v1/projects/<id-proyecto>/global/networks/default
priority: 1000
direction: INGRESS
sourceRanges:
- 0.0.0.0/0
targetTags:
- authd-django
allowed:
- IPProtocol: TCP
ports:
- 8080
- name: authd-firewall-db
type: compute.v1.firewall
properties:
network: https://www.googleapis.com/compute/v1/projects/<id-proyecto>/global/networks/default
priority: 1000
direction: INGRESS
sourceTags:
- authd-django
targetTags:
- authd-db
allowed:
- IPProtocol: TCP
ports:
- 5432
# Database instance
- type: compute.v1.instance
name: authd-db-instance
properties:
zone: us-central1-a
machineType: https://www.googleapis.com/compute/v1/projects/<id-proyecto>/zones/us-central1-a/machineTypes/e2-micro
disks:
- deviceName: boot
type: PERSISTENT
boot: true
autoDelete: true
initializeParams:
sourceImage: https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-2004-focal-v20240307b
networkInterfaces:
- network: https://www.googleapis.com/compute/v1/projects/<id-proyecto>/global/networks/default
networkIP: 10.128.0.60
accessConfigs:
- name: External NAT
type: ONE_TO_ONE_NAT
tags:
items:
- authd-db
metadata:
items:
- key: startup-script
value: |
#!/bin/bash
sudo apt-get update
sudo apt-get install -y postgresql postgresql-contrib
sudo -u postgres psql -c "CREATE USER monitoring_user WITH PASSWORD 'isis2503';"
sudo -u postgres createdb -O monitoring_user monitoring_db
echo "host all all 0.0.0.0/0 trust" | sudo tee -a /etc/postgresql/12/main/pg_hba.conf
echo "listen_addresses='*'" | sudo tee -a /etc/postgresql/12/main/postgresql.conf
echo "max_connections=2000" | sudo tee -a /etc/postgresql/12/main/postgresql.conf
sudo service postgresql restart
# Monitoring app django instance
- type: compute.v1.instance
name: authd-django-instance
properties:
zone: us-central1-a
machineType: https://www.googleapis.com/compute/v1/projects/<id-proyecto>/zones/us-central1-a/machineTypes/e2-micro
disks:
- deviceName: boot
type: PERSISTENT
boot: true
autoDelete: true
initializeParams:
sourceImage: https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-2004-focal-v20240307b
networkInterfaces:
- network: https://www.googleapis.com/compute/v1/projects/<id-proyecto>/global/networks/default
networkIP: 10.128.0.61
accessConfigs:
- name: External NAT
type: ONE_TO_ONE_NAT
tags:
items:
- authd-django
metadata:
items:
- key: startup-script
value: |
#!/bin/bash
sudo apt-get update
sudo apt install python3-pip -y
sudo mkdir /labs
cd /labs
sudo git clone https://github.com/ISIS2503/ISIS2503-MonitoringApp-Auth0.git
cd ISIS2503-MonitoringApp-Auth0
sudo pip3 install -r requirements.txt
sudo python3 manage.py makemigrations
sudo python3 manage.py migrate