-
Notifications
You must be signed in to change notification settings - Fork 138
/
places_deployment.yaml
99 lines (96 loc) · 3.33 KB
/
places_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
# ***************** Universidad de los Andes ***********************
# ****** Departamento de Ingeniería de Sistemas y Computación ******
# ********** Arquitectura y diseño de Software - ISIS2503 **********
#
# Infraestructura para laboratorio de microservicios con Django (microservicio Places)
# Elementos a desplegar:
# 1. Firewalls:
# - msd-service-mongodb
# 1. Instancias MVs:
# - msd-places-db (mongodb instalado y configurado)
# - msd-places-ms (Servicio de places instalado y configurado)
resources:
# Firewall rules
- name: msd-service-db
type: compute.v1.firewall
properties:
network: https://www.googleapis.com/compute/v1/projects/<id-proyecto>/global/networks/default
priority: 1000
direction: INGRESS
sourceTags:
- msd-services-firewall
targetTags:
- msd-service-mongodb
allowed:
- IPProtocol: TCP
ports:
- 27017
# Database instance
- name: msd-places-db
type: compute.v1.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/cos-cloud/global/images/cos-101-17162-463-8
networkInterfaces:
- network: https://www.googleapis.com/compute/v1/projects/<id-proyecto>/global/networks/default
networkIP: 10.128.0.86
accessConfigs:
- name: External NAT
type: ONE_TO_ONE_NAT
tags:
items:
- msd-service-db
metadata:
items:
- key: startup-script
value: |
#!/bin/bash
docker run --restart=always -d --name places-db -p 27017:27017 \
-e MONGO_INITDB_ROOT_USERNAME=monitoring_user \
-e MONGO_INITDB_ROOT_PASSWORD=isis2503 \
mongodb/mongodb-community-server
# Service instance
- name: msd-places-ms
type: compute.v1.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.87
accessConfigs:
- name: External NAT
type: ONE_TO_ONE_NAT
tags:
items:
- msd-services-firewall
metadata:
items:
- key: startup-script
value: |
#!/bin/bash
sudo apt-get update
sudo apt install software-properties-common -y
sudo add-apt-repository ppa:deadsnakes/ppa -y
sudo apt-get update
sudo apt install python3.12 -y
sudo curl -sS https://bootstrap.pypa.io/get-pip.py | python3.12
sudo mkdir /home/labs
cd /home/labs
sudo git clone https://github.com/ISIS2503/ISIS2503-Microservices-AppDjango.git
cd ISIS2503-Microservices-AppDjango/places
sudo python3.12 -m pip install -r requirements.txt