Skip to content

Commit 9053b5a

Browse files
Removing dev and staging Kubernetes environments | Installing Dragonfly, Elasticsearch, Apache Kafka, Debezium and Postgres in Kubernetes | Shifting from DigitalOcean to UpCloud | Some other minor changes
1 parent da44995 commit 9053b5a

File tree

123 files changed

+1977
-541
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+1977
-541
lines changed

.gitignore

+6-1
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,9 @@ target/
8181
*.out
8282

8383
# Dependency directories (remove the comment below to include it)
84-
vendor/
84+
vendor/
85+
86+
# --- KUBERNETES ---
87+
88+
secret.yaml
89+
*.secret.yaml

backend/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ pub mod utils {
202202
use anyhow::{anyhow, Result};
203203
use kafka::consumer::{Consumer, FetchOffset, GroupOffsetStorage};
204204
use serde::Deserialize;
205-
use tracing::info;
205+
use tracing::debug;
206206

207207
pub fn createKafkaConsumer(hosts: Vec<String>, topic: String, group: String) -> Consumer {
208208
let consumer = Consumer::from_hosts(hosts)
@@ -216,7 +216,7 @@ pub mod utils {
216216
topic
217217
));
218218

219-
info!("Created Kafka consumer for {} topic", topic);
219+
debug!("Created Kafka consumer for {} topic", topic);
220220

221221
consumer
222222
}

kubernetes/base/kustomization.yaml

-5
This file was deleted.

kubernetes/base/application-controller.yaml kubernetes/manifests/application-controller.application.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ spec:
1515
source:
1616
repoURL: https://github.com/Archisman-Mridha/instagram-clone
1717
targetRevision: HEAD
18-
path: kubernetes/base/application-controller
18+
path: kubernetes/manifests/application-controller
1919

2020
syncPolicy:
2121
automated:
2222
prune: true
23-
selfHeal: true
23+
selfHeal: true

kubernetes/base/application-controller/deployment.yaml kubernetes/manifests/application-controller/deployment.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ metadata:
55
namespace: default
66

77
spec:
8+
replicas: 1
89
selector:
910
matchLabels:
1011
app: application-controller
@@ -23,4 +24,4 @@ spec:
2324
cpu: 100m
2425
limits:
2526
memory: 256Mi
26-
cpu: 200m
27+
cpu: 200m
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
resources:
22
- instagramclone.io_applications.yaml
3-
43
- cluster-role.yaml
54
- cluster-role-binding.yaml
65
- service-account.yaml
7-
- deployment.yaml
6+
- deployment.yaml

kubernetes/workspaces/production/cert-manager.yaml kubernetes/manifests/cert-manager.application.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ spec:
1414
source:
1515
repoURL: https://github.com/Archisman-Mridha/instagram-clone
1616
targetRevision: HEAD
17-
path: kubernetes/workspaces/production/cert-manager
17+
path: kubernetes/manifests/cert-manager
1818
plugin:
1919
name: kustomize-enable-helm
2020

2121
syncPolicy:
2222
automated:
2323
prune: true
24-
selfHeal: true
24+
selfHeal: true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
apiVersion: argoproj.io/v1alpha1
2+
kind: Application
3+
4+
metadata:
5+
name: cloudnative-pg
6+
namespace: argocd
7+
8+
spec:
9+
project: default
10+
11+
destination:
12+
server: https://kubernetes.default.svc
13+
namespace: cloudnative-pg
14+
15+
source:
16+
repoURL: https://github.com/Archisman-Mridha/instagram-clone
17+
targetRevision: HEAD
18+
path: kubernetes/manifests/cloudnative-pg
19+
plugin:
20+
name: kustomize-enable-helm
21+
22+
syncPolicy:
23+
automated:
24+
prune: true
25+
selfHeal: true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
apiVersion: bitnami.com/v1alpha1
3+
kind: SealedSecret
4+
metadata:
5+
annotations:
6+
sealedsecrets.bitnami.com/cluster-wide: "true"
7+
creationTimestamp: null
8+
name: admin-credentials
9+
namespace: cloudnative-pg
10+
spec:
11+
encryptedData:
12+
password: AgB5Jh9QBok6cVlIGaHg0JoYKT2z/9qAzT48Y7sBoAD0NYnmga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2BUXUj0C/5Euv8JSSktEA3GGrJ6yHNM+xcYDIyHj9DXGqoHfbJDlxfA6hrd0Zs3p8BAS0WqHotAwynawVGblVNfjpg+OBmcE6ORJS7FMV3c7aWTBtHYYb/k5XBXUtpG9FxLjmvhsFVwLcY0xkkFXBxjRMCKJdEjDr5XOtRZcwGj1Tzj3h9//GvX789zR4wx20WWt7VEcCYJdPeiWEnGPeQpUtJqQYg9zP/wAgBZX5f9ytWk1xwi4whd4NQFcTv7ANbHCHMSsng+yKOQ/KMxvVxDpnTvj7/nBreyKG65ooxVgxIV1oxLA==
14+
template:
15+
metadata:
16+
annotations:
17+
sealedsecrets.bitnami.com/cluster-wide: "true"
18+
creationTimestamp: null
19+
name: admin-credentials
20+
namespace: cloudnative-pg
21+
type: kubernetes.io/basic-auth
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
apiVersion: bitnami.com/v1alpha1
3+
kind: SealedSecret
4+
metadata:
5+
annotations:
6+
sealedsecrets.bitnami.com/cluster-wide: "true"
7+
creationTimestamp: null
8+
name: atlasgo-credentials
9+
namespace: cloudnative-pg
10+
spec:
11+
encryptedData:
12+
url: AgCgxs5fqw/k99uChn6XgabDowZoVS+QL0NmUcNDVupUMoVe2pIanpe1vailmbjffi+DddreBCEq4mGsgZ7OBhPGPVaIz5+k2YLMB9AeLBD4pFygdd0xPLlYBISxmdV8JTSuTu6bTrOKS9WPc/JtjrIwvo5NQDkUmUqvjXQU6TeZHO8sIVNn7b4h2kdo9b8wkOkGxCVge5k4UhB2rTJjj+sqMLio8Db0TdXXQcQ7yvcrWNc8OdxA4YxdE5eojhZw45H+hKi7EdjbofZWsE2BB/FmUel55UXnjis3m1c4w16WUzyM8YOVN99Wpke1X4C0xqtrWAuqLS6Wa2pIjUmPztbZqsnSDaW1ZAT1uoAxFSVyWSDpFaZubQcm0GqDoWIce0dp7OQ7Fdn6AHCuBj4JF5g4NXl8n0QO3HvntC7etMIZISHkFeBJLVJzWyWNBktJcbIW37Olbl+gNVGWptg1aA7rDMC35kHtA29Tw0NDuppHZcpIKmGo1iDVM51q3RDdfNJU0AokGMUu+vGc/tA7hwUl4gkFoQ84iDk18jXDjwKHSH85Qhq5xAwbeSbNJ/kijbP2DvrKBJOW/d1OvMdSYRmKyj0cuJvn6ucJ4w74eNTLaNPGiDrNjPOj2ExB4ux3BLtBRnu2BEQn2OSc8LbZviXQKgBYI+YJWCGfkovq/CqAKWoD487RGWeAStG6qXsb1V4P+1NMP55lErdc0o2O1EtPvGgA9WnzYHk+TJy86lKqQbR6n3ORnKWkQoxD1H7goU2vPndMeoG05Sbt0wg5y60fFsS9vBwgzrgpVYmgKw==
13+
template:
14+
metadata:
15+
annotations:
16+
sealedsecrets.bitnami.com/cluster-wide: "true"
17+
creationTimestamp: null
18+
name: atlasgo-credentials
19+
namespace: cloudnative-pg
20+
type: Opaque
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
apiVersion: postgresql.cnpg.io/v1
2+
3+
# Represents a PostgreSQL cluster made up of a single primary and an optional number of replicas
4+
# that co-exist in the same Kubernetes namespace for High Availability and offloading of read-only
5+
# queries.
6+
kind: Cluster
7+
8+
metadata:
9+
name: main
10+
namespace: cloudnative-pg
11+
12+
spec:
13+
instances: 1
14+
15+
storage:
16+
pvcTemplate:
17+
accessModes:
18+
- ReadWriteOnce
19+
resources:
20+
requests:
21+
storage: 1Gi
22+
storageClassName: upcloud-block-storage-hdd
23+
volumeMode: Filesystem
24+
25+
resources:
26+
requests:
27+
memory: 256Mi
28+
cpu: 200m
29+
limits:
30+
memory: 256Mi
31+
cpu: 200m
32+
33+
primaryUpdateStrategy: unsupervised
34+
35+
postgresql:
36+
parameters:
37+
# Feature to manage the retention of WAL files on the primary server. When a standby server
38+
# connects to a primary server for replication, the primary server keeps track of the WAL
39+
# files that the standby server has successfully replicated. Replication slots (named
40+
# positions in the WAL stream) ensure that the primary server retains the necessary WAL files
41+
# until all standby servers have consumed them. This prevents the primary server from
42+
# removing WAL files that are still needed by the standby servers for replication, thus
43+
# avoiding potential data loss scenarios.
44+
max_replication_slots: "4"
45+
46+
# WAL senders are PostgreSQL server processes responsible for streaming WAL data from the
47+
# primary server to standby servers for replication. When a standby server establishes a
48+
# streaming replication connection to the primary server, the primary server creates a WAL
49+
# sender process dedicated to streaming WAL data to that specific standby server.
50+
#
51+
# Determines how many maximum standby servers can simultaneously replicate from the primary
52+
# server.
53+
max_wal_senders: "4"
54+
55+
# How much memory is dedicated to the PostgreSQL server for caching data.
56+
shared_buffers: 64MB
57+
58+
bootstrap:
59+
initdb:
60+
database: instagram_clone
61+
62+
owner: admin
63+
secret:
64+
name: admin-credentials
65+
66+
postInitApplicationSQLRefs:
67+
secretRefs:
68+
- name: main-cluster-init-sql
69+
key: create-debezium-user.sql
70+
71+
# Enabling integration with Prometheus and Grafana.
72+
monitoring:
73+
enablePodMonitor: true

kubernetes/manifests/cloudnative-pg/grafana-dashboard.configmap.yaml

+11
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
resources:
2+
- namespace.yaml
3+
- main-cluster-init-sql.sealed-secret.yaml
4+
- cluster.yaml
5+
- admin-credentials.sealed-secret.yaml
6+
- grafana-dashboard.configmap.yaml
7+
- atlasgo-credentials.sealed-secret.yaml
8+
- schema.yaml
9+
10+
helmCharts:
11+
- repo: https://cloudnative-pg.io/charts
12+
name: cloudnative-pg
13+
releaseName: cloudnative-pg
14+
namespace: cloudnative-pg
15+
version: 0.20.0
16+
17+
- repo: oci://ghcr.io/ariga/charts
18+
name: atlas-operator
19+
releaseName: atlas
20+
namespace: cloudnative-pg
21+
version: 0.4.0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
apiVersion: bitnami.com/v1alpha1
3+
kind: SealedSecret
4+
metadata:
5+
annotations:
6+
sealedsecrets.bitnami.com/cluster-wide: "true"
7+
creationTimestamp: null
8+
name: main-cluster-init-sql
9+
namespace: cloudnative-pg
10+
spec:
11+
encryptedData:
12+
create-debezium-user.sql: AgCimJt9zOO3i8eRCYET8UYIGCQdS28PXv0y+8brA4oEi4wu+WTvkRbi4AmqPqMPXMWyvxEGtMig0GJwu3VTRj+Lc9nCyt9Kb5L5KdGy60eurAx8e7SCgvmiMeG+RX5D5uaQpeRCBof5LvDy1Eq/m8ztJjT6BJq2BCjNTaWP3A/1dEq4soUCMqNbaN0lt4iXxvrCTNeGgeHOFt7TQwnhwIFkCaYBBg6iR6SE28VfHE7v1S+oB7+bSIxQkRUmVklaq9M1q8XQ2L///50CJhFRVhqc/+u4chl73PHeSQ3cykLEZrNyH5Wft3NsQYdR3zmuBSvRqsLQV/V5u/YnczN2bYf599sbn1K/pX6MVhoMc4gju2n0qtVMg+qg0G0sE08eOwJ302v/J+312iUjKib1ZVdtwJKNA5EcBPCVxdUbrXhGo3kRd/xocGw9S5M+CaiOpPCRLrpRF7wWcC3mj4SM6X4dPGZXpQNFE6bDI/Oxg2vhYVSAJ1cM2VN5mJYZDLelg8kyyqjeCAVyg3IshfE1Zc3tN/oIvOSujT/7m4tv79keaK8ojube3CDGgYFA29NVWkL3aWnMyTYkrZ6yQMKpV80n6IcJU4vFee7Wbkiu6BkZTsVV6FblfrW+EBNugswMlWkEYk8G9l8UUvoLNuFZ9kPmK6APQa+Dokt/PKGHGShH9IXQr73vtzBxfGEe5q5fzpDtpFNYXy+i3MqkbzR5tI2HGbk4PZMBM+ogYpr1tbPIq6uqQheGKLJLj9P6ClmGV3iJWrbl4XxMwKb1RvW2Z8MZCLDGDIYcIyYqzW4fTRDlam85tUDaptyfeDm2
13+
template:
14+
metadata:
15+
annotations:
16+
sealedsecrets.bitnami.com/cluster-wide: "true"
17+
creationTimestamp: null
18+
name: main-cluster-init-sql
19+
namespace: cloudnative-pg
20+
type: Opaque
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
name: cloudnative-pg
5+
labels:
6+
pod-monitor-scanning: enable
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
apiVersion: db.atlasgo.io/v1alpha1
2+
kind: AtlasSchema
3+
metadata:
4+
name: instagram-clone
5+
namespace: cloudnative-pg
6+
7+
spec:
8+
9+
urlFrom:
10+
secretKeyRef:
11+
key: url
12+
name: atlasgo-credentials
13+
14+
schema:
15+
sql: |
16+
17+
-- Users Microservice
18+
CREATE TABLE users (
19+
id SERIAL PRIMARY KEY,
20+
21+
name VARCHAR(25) NOT NULL,
22+
email VARCHAR(320) NOT NULL UNIQUE,
23+
username VARCHAR(25) NOT NULL UNIQUE,
24+
25+
password VARCHAR(100) NOT NULL
26+
);
27+
CREATE INDEX email_idx_users ON users (email);
28+
CREATE INDEX username_idx_users ON users (username);
29+
30+
-- Profiles Microservice
31+
CREATE TABLE profiles (
32+
id INT PRIMARY KEY,
33+
34+
name VARCHAR(25) NOT NULL,
35+
username VARCHAR(25) NOT NULL UNIQUE,
36+
37+
profile_picture_uri VARCHAR(250)
38+
);
39+
CREATE INDEX username_idx_profiles ON profiles (username);
40+
41+
-- Followships Microservice
42+
CREATE TABLE followships (
43+
follower_id INT,
44+
followee_id INT
45+
);
46+
CREATE INDEX follower_id_idx_followships ON followships (follower_id, followee_id);
47+
CREATE INDEX followee_id_idx_followships ON followships (followee_id, follower_id);
48+
49+
-- Posts Microservice
50+
CREATE TABLE posts (
51+
id SERIAL PRIMARY KEY,
52+
owner_id INT NOT NULL,
53+
54+
description VARCHAR(255) NOT NULL,
55+
created_at TIMESTAMP NOT NULL DEFAULT now( )
56+
);
57+
CREATE INDEX owner_id_idx_posts ON posts (owner_id, created_at DESC);

kubernetes/workspaces/dev/istio.yaml kubernetes/manifests/debezium.application.yaml

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@ apiVersion: argoproj.io/v1alpha1
22
kind: Application
33

44
metadata:
5-
name: istio
6-
namespace: istio-system
5+
name: debezium
6+
namespace: argocd
77

88
spec:
99
project: default
1010

1111
destination:
1212
server: https://kubernetes.default.svc
13-
namespace: istio-system
13+
namespace: debezium
1414

1515
source:
1616
repoURL: https://github.com/Archisman-Mridha/instagram-clone
1717
targetRevision: HEAD
18-
path: kubernetes/workspaces/dev/istio
18+
path: kubernetes/manifests/debezium
1919

2020
syncPolicy:
2121
automated:
2222
prune: true
23-
selfHeal: true
23+
selfHeal: true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
resources:
2+
# CRDs
3+
- https://raw.githubusercontent.com/debezium/debezium-operator/2.4/k8/debeziumservers.debezium.io-v1.yml
4+
5+
# Operator
6+
- https://raw.githubusercontent.com/debezium/debezium-operator/2.4/k8/kubernetes.yml
7+
8+
- namespace.yaml
9+
10+
- postgres-credentials.sealed-secret.yaml
11+
12+
- users-table.debezium-server.yaml
13+
- posts-table.debezium-server.yaml
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
apiVersion: v1
22
kind: Namespace
33
metadata:
4-
name: prometheus
4+
name: debezium

0 commit comments

Comments
 (0)