-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackend-deployment.yaml
51 lines (44 loc) · 2.05 KB
/
backend-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
# Here is the deployment file for the backend. I've set up 2 replicas, meaning 2 pods/containers will be created for the backend.
# In the environment variables, I provided the database connection URL to connect to the MongoDB database.
apiVersion: apps/v1
kind: Deployment
metadata:
name: backend-deployment
labels:
app: backend
spec:
replicas: 2 # Number of Frontend replicas
selector:
matchLabels:
app: node-backend # Label selector used by the deployment and service to manage Pods
template:
metadata:
labels:
app: node-backend # Labels applied to the Pods created by the Deployments
spec:
containers:
- name: node-backend
image: divyapatel42/ecommerce-webapp:backendGithubActions
env:
- name: DATABASE
value: "mongodb://root:[email protected]:27017/Ecommerce?authSource=admin"
#mongodb://root:[email protected]:27017/Ecommerce?authSource=admin
# 1. **Protocol:** `mongodb://`
# - This specifies the protocol to be used, which is MongoDB.
# 2. **Username and Password:** `root:example@`
# - `root` is the username.
# - `example` is the password.
# - These credentials are used to authenticate with the MongoDB server.
# 3. **Host:** `mongodb-0.mongodb.default.svc.cluster.local`
# - This is the fully qualified domain name (FQDN) of the MongoDB server.
# - `mongodb-0` is the name of the MongoDB pod.
# - `mongodb` is the name of the service.
# - `default` is the namespace in which the MongoDB service is running.
# - `svc.cluster.local` is the cluster domain.
# 4. **Port:** `27017`
# - This is the default port number for MongoDB.
# 5. **Database:** `Ecommerce`
# - This specifies the database to connect to within the MongoDB server.
# 6. **Options:** `?authSource=admin`
# - `authSource=admin` specifies that the authentication should be done against the `admin` database rather than the `Ecommerce` database.
# This is useful if the user's credentials are stored in the `admin` database.