devops33 0.6.0__tar.gz → 0.7.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {devops33-0.6.0 → devops33-0.7.0}/PKG-INFO +1 -1
- devops33-0.7.0/devops/main.py +932 -0
- {devops33-0.6.0 → devops33-0.7.0}/devops33.egg-info/PKG-INFO +1 -1
- {devops33-0.6.0 → devops33-0.7.0}/pyproject.toml +1 -1
- devops33-0.6.0/devops/main.py +0 -263
- {devops33-0.6.0 → devops33-0.7.0}/LICENSE +0 -0
- {devops33-0.6.0 → devops33-0.7.0}/README.md +0 -0
- {devops33-0.6.0 → devops33-0.7.0}/devops/__init__.py +0 -0
- {devops33-0.6.0 → devops33-0.7.0}/devops/__main__.py +0 -0
- {devops33-0.6.0 → devops33-0.7.0}/devops33.egg-info/SOURCES.txt +0 -0
- {devops33-0.6.0 → devops33-0.7.0}/devops33.egg-info/dependency_links.txt +0 -0
- {devops33-0.6.0 → devops33-0.7.0}/devops33.egg-info/entry_points.txt +0 -0
- {devops33-0.6.0 → devops33-0.7.0}/devops33.egg-info/top_level.txt +0 -0
- {devops33-0.6.0 → devops33-0.7.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: devops33
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.0
|
|
4
4
|
Summary: An interactive CLI tool for learning Docker, Git, Prometheus, and Kubernetes commands.
|
|
5
5
|
Author-email: DevOps Assistant <assistant@example.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/example/devops-lab-assistant
|
|
@@ -0,0 +1,932 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
import time
|
|
4
|
+
|
|
5
|
+
# --- Monochromatic Grayscale Palette ---
|
|
6
|
+
class Colors:
|
|
7
|
+
BOLD = '\033[1m'
|
|
8
|
+
DIM = '\033[2m'
|
|
9
|
+
GREY = '\033[90m'
|
|
10
|
+
RESET = '\033[0m'
|
|
11
|
+
|
|
12
|
+
# --- Full Lab Guide Content ---
|
|
13
|
+
LAB_GUIDES = {
|
|
14
|
+
"Docker": """# =========================================================
|
|
15
|
+
# DOCKER LAB
|
|
16
|
+
# BASIC COMMANDS + CUSTOM IMAGE + DOCKER HUB
|
|
17
|
+
# (EXCLUDING DOCKER NETWORKING)
|
|
18
|
+
# =========================================================
|
|
19
|
+
|
|
20
|
+
# =========================================================
|
|
21
|
+
# STEP 1 — OPEN UBUNTU WSL
|
|
22
|
+
# =========================================================
|
|
23
|
+
|
|
24
|
+
# From PowerShell run:
|
|
25
|
+
wsl -d Ubuntu
|
|
26
|
+
|
|
27
|
+
# =========================================================
|
|
28
|
+
# STEP 2 — VERIFY DOCKER INSTALLED
|
|
29
|
+
# =========================================================
|
|
30
|
+
|
|
31
|
+
sudo docker --version
|
|
32
|
+
|
|
33
|
+
# =========================================================
|
|
34
|
+
# STEP 3 — TEST DOCKER WORKING
|
|
35
|
+
# =========================================================
|
|
36
|
+
|
|
37
|
+
sudo docker run hello-world
|
|
38
|
+
|
|
39
|
+
# Expected:
|
|
40
|
+
# Hello from Docker!
|
|
41
|
+
|
|
42
|
+
# =========================================================
|
|
43
|
+
# STEP 4 — CHECK DOWNLOADED IMAGES
|
|
44
|
+
# =========================================================
|
|
45
|
+
|
|
46
|
+
sudo docker images
|
|
47
|
+
|
|
48
|
+
# =========================================================
|
|
49
|
+
# STEP 5 — CHECK ALL CONTAINERS
|
|
50
|
+
# =========================================================
|
|
51
|
+
|
|
52
|
+
sudo docker ps -a
|
|
53
|
+
|
|
54
|
+
# =========================================================
|
|
55
|
+
# STEP 6 — PULL IMAGE FROM DOCKER HUB
|
|
56
|
+
# =========================================================
|
|
57
|
+
|
|
58
|
+
sudo docker pull nginx
|
|
59
|
+
|
|
60
|
+
# =========================================================
|
|
61
|
+
# STEP 7 — VERIFY IMAGE DOWNLOADED
|
|
62
|
+
# =========================================================
|
|
63
|
+
|
|
64
|
+
sudo docker images
|
|
65
|
+
|
|
66
|
+
# =========================================================
|
|
67
|
+
# STEP 8 — RUN NGINX CONTAINER
|
|
68
|
+
# =========================================================
|
|
69
|
+
|
|
70
|
+
sudo docker run -d --name mynginx -p 8080:80 nginx
|
|
71
|
+
|
|
72
|
+
# =========================================================
|
|
73
|
+
# STEP 9 — CHECK RUNNING CONTAINER
|
|
74
|
+
# =========================================================
|
|
75
|
+
|
|
76
|
+
sudo docker ps
|
|
77
|
+
|
|
78
|
+
# =========================================================
|
|
79
|
+
# STEP 10 — OPEN NGINX IN BROWSER
|
|
80
|
+
# =========================================================
|
|
81
|
+
|
|
82
|
+
# Open browser:
|
|
83
|
+
# http://localhost:8080
|
|
84
|
+
|
|
85
|
+
# Expected:
|
|
86
|
+
# Welcome to nginx!
|
|
87
|
+
|
|
88
|
+
# =========================================================
|
|
89
|
+
# STEP 11 — STOP CONTAINER
|
|
90
|
+
# =========================================================
|
|
91
|
+
|
|
92
|
+
sudo docker stop mynginx
|
|
93
|
+
|
|
94
|
+
# =========================================================
|
|
95
|
+
# STEP 12 — REMOVE CONTAINER
|
|
96
|
+
# =========================================================
|
|
97
|
+
|
|
98
|
+
sudo docker rm mynginx
|
|
99
|
+
|
|
100
|
+
# =========================================================
|
|
101
|
+
# CUSTOM DOCKER IMAGE
|
|
102
|
+
# =========================================================
|
|
103
|
+
|
|
104
|
+
# =========================================================
|
|
105
|
+
# STEP 13 — CREATE PROJECT DIRECTORY
|
|
106
|
+
# =========================================================
|
|
107
|
+
|
|
108
|
+
mkdir ~/custom_image
|
|
109
|
+
|
|
110
|
+
# =========================================================
|
|
111
|
+
# STEP 14 — ENTER PROJECT DIRECTORY
|
|
112
|
+
# =========================================================
|
|
113
|
+
|
|
114
|
+
cd ~/custom_image
|
|
115
|
+
|
|
116
|
+
# =========================================================
|
|
117
|
+
# STEP 15 — CREATE PYTHON APPLICATION
|
|
118
|
+
# =========================================================
|
|
119
|
+
|
|
120
|
+
echo "print('This is a Custom Image')" > app.py
|
|
121
|
+
|
|
122
|
+
# =========================================================
|
|
123
|
+
# STEP 16 — VERIFY FILE CONTENT
|
|
124
|
+
# =========================================================
|
|
125
|
+
|
|
126
|
+
cat app.py
|
|
127
|
+
|
|
128
|
+
# =========================================================
|
|
129
|
+
# STEP 17 — CREATE DOCKERFILE
|
|
130
|
+
# =========================================================
|
|
131
|
+
|
|
132
|
+
nano Dockerfile
|
|
133
|
+
|
|
134
|
+
# =========================================================
|
|
135
|
+
# STEP 18 — PASTE THIS INSIDE DOCKERFILE
|
|
136
|
+
# =========================================================
|
|
137
|
+
|
|
138
|
+
FROM python:3.11
|
|
139
|
+
|
|
140
|
+
WORKDIR /app
|
|
141
|
+
|
|
142
|
+
COPY . .
|
|
143
|
+
|
|
144
|
+
CMD ["python3","app.py"]
|
|
145
|
+
|
|
146
|
+
# =========================================================
|
|
147
|
+
# STEP 19 — SAVE DOCKERFILE
|
|
148
|
+
# =========================================================
|
|
149
|
+
|
|
150
|
+
# CTRL + O
|
|
151
|
+
# ENTER
|
|
152
|
+
# CTRL + X
|
|
153
|
+
|
|
154
|
+
# =========================================================
|
|
155
|
+
# STEP 20 — VERIFY DOCKERFILE CONTENT
|
|
156
|
+
# =========================================================
|
|
157
|
+
|
|
158
|
+
cat Dockerfile
|
|
159
|
+
|
|
160
|
+
# =========================================================
|
|
161
|
+
# STEP 21 — BUILD CUSTOM IMAGE
|
|
162
|
+
# =========================================================
|
|
163
|
+
|
|
164
|
+
sudo docker build -t mypythonapp .
|
|
165
|
+
|
|
166
|
+
# =========================================================
|
|
167
|
+
# STEP 22 — VERIFY IMAGE CREATED
|
|
168
|
+
# =========================================================
|
|
169
|
+
|
|
170
|
+
sudo docker images
|
|
171
|
+
|
|
172
|
+
# =========================================================
|
|
173
|
+
# STEP 23 — RUN CONTAINER FROM IMAGE
|
|
174
|
+
# =========================================================
|
|
175
|
+
|
|
176
|
+
sudo docker run --name mycontainer mypythonapp
|
|
177
|
+
|
|
178
|
+
# Expected Output:
|
|
179
|
+
# This is a Custom Image
|
|
180
|
+
|
|
181
|
+
# =========================================================
|
|
182
|
+
# STEP 24 — VERIFY CONTAINER CREATED
|
|
183
|
+
# =========================================================
|
|
184
|
+
|
|
185
|
+
sudo docker ps -a
|
|
186
|
+
|
|
187
|
+
# =========================================================
|
|
188
|
+
# STEP 25 — VIEW CONTAINER LOGS
|
|
189
|
+
# =========================================================
|
|
190
|
+
|
|
191
|
+
sudo docker logs mycontainer
|
|
192
|
+
|
|
193
|
+
# =========================================================
|
|
194
|
+
# DOCKER HUB
|
|
195
|
+
# =========================================================
|
|
196
|
+
|
|
197
|
+
# =========================================================
|
|
198
|
+
# STEP 26 — CREATE DOCKER HUB ACCOUNT
|
|
199
|
+
# =========================================================
|
|
200
|
+
|
|
201
|
+
# Open:
|
|
202
|
+
# https://hub.docker.com
|
|
203
|
+
|
|
204
|
+
# Create free account
|
|
205
|
+
|
|
206
|
+
# =========================================================
|
|
207
|
+
# STEP 27 — LOGIN TO DOCKER HUB
|
|
208
|
+
# =========================================================
|
|
209
|
+
|
|
210
|
+
sudo docker login
|
|
211
|
+
|
|
212
|
+
# Enter:
|
|
213
|
+
# Docker Hub username
|
|
214
|
+
# Docker Hub password
|
|
215
|
+
|
|
216
|
+
# Expected:
|
|
217
|
+
# Login Succeeded
|
|
218
|
+
|
|
219
|
+
# =========================================================
|
|
220
|
+
# STEP 28 — TAG IMAGE FOR DOCKER HUB
|
|
221
|
+
# =========================================================
|
|
222
|
+
|
|
223
|
+
sudo docker tag mypythonapp YOUR_DOCKERHUB_USERNAME/mypythonapp:v1
|
|
224
|
+
|
|
225
|
+
# Example:
|
|
226
|
+
# sudo docker tag mypythonapp sri11/mypythonapp:v1
|
|
227
|
+
|
|
228
|
+
# =========================================================
|
|
229
|
+
# STEP 29 — VERIFY TAGGED IMAGE
|
|
230
|
+
# =========================================================
|
|
231
|
+
|
|
232
|
+
sudo docker images
|
|
233
|
+
|
|
234
|
+
# =========================================================
|
|
235
|
+
# STEP 30 — PUSH IMAGE TO DOCKER HUB
|
|
236
|
+
# =========================================================
|
|
237
|
+
|
|
238
|
+
sudo docker push YOUR_DOCKERHUB_USERNAME/mypythonapp:v1
|
|
239
|
+
|
|
240
|
+
# Example:
|
|
241
|
+
# sudo docker push sri11/mypythonapp:v1
|
|
242
|
+
|
|
243
|
+
# =========================================================
|
|
244
|
+
# STEP 31 — VERIFY IMAGE ON DOCKER HUB
|
|
245
|
+
# =========================================================
|
|
246
|
+
|
|
247
|
+
# Open:
|
|
248
|
+
# https://hub.docker.com
|
|
249
|
+
|
|
250
|
+
# Check repositories section
|
|
251
|
+
|
|
252
|
+
# =========================================================
|
|
253
|
+
# STEP 32 — PULL IMAGE FROM DOCKER HUB
|
|
254
|
+
# =========================================================
|
|
255
|
+
|
|
256
|
+
sudo docker pull YOUR_DOCKERHUB_USERNAME/mypythonapp:v1
|
|
257
|
+
|
|
258
|
+
# =========================================================
|
|
259
|
+
# STEP 33 — RUN IMAGE FROM DOCKER HUB
|
|
260
|
+
# =========================================================
|
|
261
|
+
|
|
262
|
+
sudo docker run YOUR_DOCKERHUB_USERNAME/mypythonapp:v1
|
|
263
|
+
|
|
264
|
+
# Expected Output:
|
|
265
|
+
# This is a Custom Image
|
|
266
|
+
|
|
267
|
+
# =========================================================
|
|
268
|
+
# CLEANUP
|
|
269
|
+
# =========================================================
|
|
270
|
+
|
|
271
|
+
# =========================================================
|
|
272
|
+
# STEP 34 — CHECK ALL CONTAINERS
|
|
273
|
+
# =========================================================
|
|
274
|
+
|
|
275
|
+
sudo docker ps -a
|
|
276
|
+
|
|
277
|
+
# =========================================================
|
|
278
|
+
# STEP 35 — STOP CONTAINER
|
|
279
|
+
# =========================================================
|
|
280
|
+
|
|
281
|
+
sudo docker stop mycontainer
|
|
282
|
+
|
|
283
|
+
# =========================================================
|
|
284
|
+
# STEP 36 — REMOVE CONTAINER
|
|
285
|
+
# =========================================================
|
|
286
|
+
|
|
287
|
+
sudo docker rm mycontainer
|
|
288
|
+
|
|
289
|
+
# =========================================================
|
|
290
|
+
# STEP 37 — REMOVE CUSTOM IMAGE
|
|
291
|
+
# =========================================================
|
|
292
|
+
|
|
293
|
+
sudo docker rmi mypythonapp
|
|
294
|
+
|
|
295
|
+
# =========================================================
|
|
296
|
+
# STEP 38 — REMOVE DOCKER HUB IMAGE
|
|
297
|
+
# =========================================================
|
|
298
|
+
|
|
299
|
+
sudo docker rmi YOUR_DOCKERHUB_USERNAME/mypythonapp:v1
|
|
300
|
+
|
|
301
|
+
# =========================================================
|
|
302
|
+
# TASK COMPLETED
|
|
303
|
+
# =========================================================
|
|
304
|
+
|
|
305
|
+
""",
|
|
306
|
+
"Git": """# =========================================================
|
|
307
|
+
# DEVOPS LAB — COMPLETE GIT + GITHUB WORKFLOW (WSL UBUNTU)
|
|
308
|
+
# =========================================================
|
|
309
|
+
|
|
310
|
+
# ---------------------------------------------------------
|
|
311
|
+
# 1. UPDATE UBUNTU PACKAGE LIST
|
|
312
|
+
# Downloads latest package information from Ubuntu servers
|
|
313
|
+
# ---------------------------------------------------------
|
|
314
|
+
sudo apt update
|
|
315
|
+
|
|
316
|
+
# ---------------------------------------------------------
|
|
317
|
+
# 2. UPGRADE INSTALLED PACKAGES
|
|
318
|
+
# Updates installed software to latest versions
|
|
319
|
+
# ---------------------------------------------------------
|
|
320
|
+
sudo apt upgrade -y
|
|
321
|
+
|
|
322
|
+
# ---------------------------------------------------------
|
|
323
|
+
# 3. CHECK IF GIT IS INSTALLED
|
|
324
|
+
# Shows installed git version
|
|
325
|
+
# ---------------------------------------------------------
|
|
326
|
+
git --version
|
|
327
|
+
|
|
328
|
+
# ---------------------------------------------------------
|
|
329
|
+
# 4. INSTALL GIT (ONLY IF NOT INSTALLED)
|
|
330
|
+
# Installs git version control system
|
|
331
|
+
# ---------------------------------------------------------
|
|
332
|
+
sudo apt install git -y
|
|
333
|
+
|
|
334
|
+
# ---------------------------------------------------------
|
|
335
|
+
# 5. GO TO HOME DIRECTORY
|
|
336
|
+
# ~ means Linux home folder
|
|
337
|
+
# ---------------------------------------------------------
|
|
338
|
+
cd ~
|
|
339
|
+
|
|
340
|
+
# ---------------------------------------------------------
|
|
341
|
+
# 6. CREATE PROJECT DIRECTORY
|
|
342
|
+
# Creates folder named devops_lab
|
|
343
|
+
# ---------------------------------------------------------
|
|
344
|
+
mkdir devops_lab
|
|
345
|
+
|
|
346
|
+
# ---------------------------------------------------------
|
|
347
|
+
# 7. ENTER PROJECT DIRECTORY
|
|
348
|
+
# ---------------------------------------------------------
|
|
349
|
+
cd devops_lab
|
|
350
|
+
|
|
351
|
+
# ---------------------------------------------------------
|
|
352
|
+
# 8. VERIFY CURRENT DIRECTORY
|
|
353
|
+
# pwd = print working directory
|
|
354
|
+
# ---------------------------------------------------------
|
|
355
|
+
pwd
|
|
356
|
+
|
|
357
|
+
# Expected:
|
|
358
|
+
# /home/sriv/devops_lab
|
|
359
|
+
|
|
360
|
+
# ---------------------------------------------------------
|
|
361
|
+
# 9. INITIALIZE GIT REPOSITORY
|
|
362
|
+
# Creates hidden .git folder for tracking changes
|
|
363
|
+
# ---------------------------------------------------------
|
|
364
|
+
git init
|
|
365
|
+
|
|
366
|
+
# ---------------------------------------------------------
|
|
367
|
+
# 10. CREATE PYTHON FILE
|
|
368
|
+
# > writes content into file
|
|
369
|
+
# ---------------------------------------------------------
|
|
370
|
+
echo "print('Hello DevOps')" > app.py
|
|
371
|
+
|
|
372
|
+
# ---------------------------------------------------------
|
|
373
|
+
# 11. VERIFY FILE EXISTS
|
|
374
|
+
# ls = list files
|
|
375
|
+
# ---------------------------------------------------------
|
|
376
|
+
ls
|
|
377
|
+
|
|
378
|
+
# Expected:
|
|
379
|
+
# app.py
|
|
380
|
+
|
|
381
|
+
# ---------------------------------------------------------
|
|
382
|
+
# 12. VIEW FILE CONTENT
|
|
383
|
+
# cat prints file content
|
|
384
|
+
# ---------------------------------------------------------
|
|
385
|
+
cat app.py
|
|
386
|
+
|
|
387
|
+
# Expected:
|
|
388
|
+
# print('Hello DevOps')
|
|
389
|
+
|
|
390
|
+
# ---------------------------------------------------------
|
|
391
|
+
# 13. CHECK GIT STATUS
|
|
392
|
+
# Shows tracked/untracked files
|
|
393
|
+
# ---------------------------------------------------------
|
|
394
|
+
git status
|
|
395
|
+
|
|
396
|
+
# Expected:
|
|
397
|
+
# Untracked files:
|
|
398
|
+
# app.py
|
|
399
|
+
|
|
400
|
+
# ---------------------------------------------------------
|
|
401
|
+
# 14. CONFIGURE GIT USERNAME
|
|
402
|
+
# Sets global git username
|
|
403
|
+
# ---------------------------------------------------------
|
|
404
|
+
git config --global user.name "Srijan"
|
|
405
|
+
|
|
406
|
+
# ---------------------------------------------------------
|
|
407
|
+
# 15. CONFIGURE GIT EMAIL
|
|
408
|
+
# Replace with your actual GitHub email
|
|
409
|
+
# ---------------------------------------------------------
|
|
410
|
+
git config --global user.email "your_email@gmail.com"
|
|
411
|
+
|
|
412
|
+
# ---------------------------------------------------------
|
|
413
|
+
# 16. STAGE FILE
|
|
414
|
+
# Adds file to staging area before commit
|
|
415
|
+
# ---------------------------------------------------------
|
|
416
|
+
git add app.py
|
|
417
|
+
|
|
418
|
+
# ---------------------------------------------------------
|
|
419
|
+
# 17. CREATE COMMIT
|
|
420
|
+
# Saves permanent snapshot into git history
|
|
421
|
+
# ---------------------------------------------------------
|
|
422
|
+
git commit -m "Initial Commit of the web app code"
|
|
423
|
+
|
|
424
|
+
# ---------------------------------------------------------
|
|
425
|
+
# 18. VERIFY COMMIT HISTORY
|
|
426
|
+
# Shows compact commit log
|
|
427
|
+
# ---------------------------------------------------------
|
|
428
|
+
git log --oneline
|
|
429
|
+
|
|
430
|
+
# Expected:
|
|
431
|
+
# e219520 Initial Commit of the web app code
|
|
432
|
+
|
|
433
|
+
# =========================================================
|
|
434
|
+
# NOW CREATE GITHUB REPOSITORY MANUALLY
|
|
435
|
+
# =========================================================
|
|
436
|
+
|
|
437
|
+
# Go to:
|
|
438
|
+
# https://github.com
|
|
439
|
+
|
|
440
|
+
# Steps:
|
|
441
|
+
# 1. Click +
|
|
442
|
+
# 2. New repository
|
|
443
|
+
# 3. Repository name:
|
|
444
|
+
# devops_lab
|
|
445
|
+
# 4. DO NOT add:
|
|
446
|
+
# README
|
|
447
|
+
# .gitignore
|
|
448
|
+
# License
|
|
449
|
+
# 5. Click Create repository
|
|
450
|
+
|
|
451
|
+
# =========================================================
|
|
452
|
+
# GENERATE GITHUB TOKEN (PAT)
|
|
453
|
+
# =========================================================
|
|
454
|
+
|
|
455
|
+
# Open:
|
|
456
|
+
# https://github.com/settings/tokens
|
|
457
|
+
|
|
458
|
+
# Steps:
|
|
459
|
+
# 1. Tokens (classic)
|
|
460
|
+
# 2. Generate new token (classic)
|
|
461
|
+
# 3. Note:
|
|
462
|
+
# WSL DevOps Token
|
|
463
|
+
# 4. Expiration:
|
|
464
|
+
# No expiration
|
|
465
|
+
# 5. Check:
|
|
466
|
+
# repo
|
|
467
|
+
# 6. Generate token
|
|
468
|
+
# 7. Copy token immediately
|
|
469
|
+
|
|
470
|
+
# Token looks like:
|
|
471
|
+
# ghp_xxxxxxxxxxxxx
|
|
472
|
+
|
|
473
|
+
# =========================================================
|
|
474
|
+
# CONNECT LOCAL REPOSITORY TO GITHUB REMOTE
|
|
475
|
+
# =========================================================
|
|
476
|
+
|
|
477
|
+
# ---------------------------------------------------------
|
|
478
|
+
# 19. ADD REMOTE REPOSITORY
|
|
479
|
+
# Links local repo with GitHub repo
|
|
480
|
+
# ---------------------------------------------------------
|
|
481
|
+
git remote add origin https://github.com/Sri-V-11/devops_lab.git
|
|
482
|
+
|
|
483
|
+
# ---------------------------------------------------------
|
|
484
|
+
# 20. VERIFY REMOTE
|
|
485
|
+
# ---------------------------------------------------------
|
|
486
|
+
git remote -v
|
|
487
|
+
|
|
488
|
+
# Expected:
|
|
489
|
+
# origin https://github.com/Sri-V-11/devops_lab.git
|
|
490
|
+
|
|
491
|
+
# ---------------------------------------------------------
|
|
492
|
+
# 21. RENAME BRANCH TO MAIN
|
|
493
|
+
# GitHub standard branch name
|
|
494
|
+
# ---------------------------------------------------------
|
|
495
|
+
git branch -M main
|
|
496
|
+
|
|
497
|
+
# ---------------------------------------------------------
|
|
498
|
+
# 22. PUSH CODE TO GITHUB
|
|
499
|
+
# Uploads local commits to GitHub
|
|
500
|
+
# ---------------------------------------------------------
|
|
501
|
+
git push -u origin main
|
|
502
|
+
|
|
503
|
+
# =========================================================
|
|
504
|
+
# AUTHENTICATION STEP
|
|
505
|
+
# =========================================================
|
|
506
|
+
|
|
507
|
+
# Username:
|
|
508
|
+
# Sri-V-11
|
|
509
|
+
|
|
510
|
+
# Password:
|
|
511
|
+
# Paste GitHub Personal Access Token (ghp_xxx)
|
|
512
|
+
|
|
513
|
+
# IMPORTANT:
|
|
514
|
+
# While pasting token:
|
|
515
|
+
# - nothing appears
|
|
516
|
+
# - no stars
|
|
517
|
+
# - no dots
|
|
518
|
+
# THIS IS NORMAL
|
|
519
|
+
|
|
520
|
+
# =========================================================
|
|
521
|
+
# SUCCESS OUTPUT
|
|
522
|
+
# =========================================================
|
|
523
|
+
|
|
524
|
+
# Branch 'main' set up to track remote branch 'main'
|
|
525
|
+
|
|
526
|
+
# =========================================================
|
|
527
|
+
# VERIFY GITHUB REPOSITORY
|
|
528
|
+
# =========================================================
|
|
529
|
+
|
|
530
|
+
# Open:
|
|
531
|
+
# https://github.com/Sri-V-11/devops_lab
|
|
532
|
+
|
|
533
|
+
# You should see:
|
|
534
|
+
# ✅ app.py
|
|
535
|
+
# ✅ commit history
|
|
536
|
+
# ✅ uploaded code
|
|
537
|
+
|
|
538
|
+
# =========================================================
|
|
539
|
+
# DAILY GIT WORKFLOW
|
|
540
|
+
# =========================================================
|
|
541
|
+
|
|
542
|
+
# Check status
|
|
543
|
+
git status
|
|
544
|
+
|
|
545
|
+
# Add changes
|
|
546
|
+
git add .
|
|
547
|
+
|
|
548
|
+
# Commit changes
|
|
549
|
+
git commit -m "describe changes"
|
|
550
|
+
|
|
551
|
+
# Push changes
|
|
552
|
+
git push
|
|
553
|
+
""",
|
|
554
|
+
"Prometheus & Utils": """# =========================================================
|
|
555
|
+
# PROMETHEUS + GRAFANA LAB
|
|
556
|
+
# SCRAPING PROMETHEUS METRICS
|
|
557
|
+
# AND VISUALIZING THROUGH GRAFANA
|
|
558
|
+
# =========================================================
|
|
559
|
+
|
|
560
|
+
# =========================================================
|
|
561
|
+
# STEP 1 — OPEN UBUNTU WSL
|
|
562
|
+
# =========================================================
|
|
563
|
+
|
|
564
|
+
# From PowerShell run:
|
|
565
|
+
wsl -d Ubuntu
|
|
566
|
+
|
|
567
|
+
# =========================================================
|
|
568
|
+
# STEP 2 — CREATE PROJECT DIRECTORY
|
|
569
|
+
# =========================================================
|
|
570
|
+
|
|
571
|
+
mkdir ~/prometheus_grafana_lab
|
|
572
|
+
|
|
573
|
+
# =========================================================
|
|
574
|
+
# STEP 3 — ENTER PROJECT DIRECTORY
|
|
575
|
+
# =========================================================
|
|
576
|
+
|
|
577
|
+
cd ~/prometheus_grafana_lab
|
|
578
|
+
|
|
579
|
+
# =========================================================
|
|
580
|
+
# STEP 4 — CREATE PROMETHEUS CONFIG FILE
|
|
581
|
+
# =========================================================
|
|
582
|
+
|
|
583
|
+
nano prometheus.yml
|
|
584
|
+
|
|
585
|
+
# =========================================================
|
|
586
|
+
# STEP 5 — PASTE THIS INSIDE prometheus.yml
|
|
587
|
+
# =========================================================
|
|
588
|
+
|
|
589
|
+
global:
|
|
590
|
+
scrape_interval: 15s
|
|
591
|
+
|
|
592
|
+
scrape_configs:
|
|
593
|
+
- job_name: 'prometheus'
|
|
594
|
+
|
|
595
|
+
static_configs:
|
|
596
|
+
- targets: ['prometheus:9090']
|
|
597
|
+
|
|
598
|
+
# =========================================================
|
|
599
|
+
# STEP 6 — SAVE FILE
|
|
600
|
+
# =========================================================
|
|
601
|
+
|
|
602
|
+
# CTRL + O
|
|
603
|
+
# ENTER
|
|
604
|
+
# CTRL + X
|
|
605
|
+
|
|
606
|
+
# =========================================================
|
|
607
|
+
# STEP 7 — VERIFY FILE CONTENT
|
|
608
|
+
# =========================================================
|
|
609
|
+
|
|
610
|
+
cat prometheus.yml
|
|
611
|
+
|
|
612
|
+
# =========================================================
|
|
613
|
+
# STEP 8 — CREATE DOCKER COMPOSE FILE
|
|
614
|
+
# =========================================================
|
|
615
|
+
|
|
616
|
+
nano docker-compose.yml
|
|
617
|
+
|
|
618
|
+
# =========================================================
|
|
619
|
+
# STEP 9 — PASTE THIS INSIDE docker-compose.yml
|
|
620
|
+
# =========================================================
|
|
621
|
+
|
|
622
|
+
version: '3'
|
|
623
|
+
|
|
624
|
+
services:
|
|
625
|
+
|
|
626
|
+
prometheus:
|
|
627
|
+
image: prom/prometheus:latest
|
|
628
|
+
container_name: prometheus
|
|
629
|
+
|
|
630
|
+
ports:
|
|
631
|
+
- "9090:9090"
|
|
632
|
+
|
|
633
|
+
volumes:
|
|
634
|
+
- ./prometheus.yml:/etc/prometheus/prometheus.yml
|
|
635
|
+
|
|
636
|
+
grafana:
|
|
637
|
+
image: grafana/grafana:latest
|
|
638
|
+
container_name: grafana
|
|
639
|
+
|
|
640
|
+
ports:
|
|
641
|
+
- "3000:3000"
|
|
642
|
+
|
|
643
|
+
# =========================================================
|
|
644
|
+
# STEP 10 — SAVE FILE
|
|
645
|
+
# =========================================================
|
|
646
|
+
|
|
647
|
+
# CTRL + O
|
|
648
|
+
# ENTER
|
|
649
|
+
# CTRL + X
|
|
650
|
+
|
|
651
|
+
# =========================================================
|
|
652
|
+
# STEP 11 — VERIFY docker-compose.yml
|
|
653
|
+
# =========================================================
|
|
654
|
+
|
|
655
|
+
cat docker-compose.yml
|
|
656
|
+
|
|
657
|
+
# =========================================================
|
|
658
|
+
# STEP 12 — START PROMETHEUS AND GRAFANA
|
|
659
|
+
# =========================================================
|
|
660
|
+
|
|
661
|
+
sudo docker compose up -d
|
|
662
|
+
|
|
663
|
+
# =========================================================
|
|
664
|
+
# STEP 13 — VERIFY RUNNING CONTAINERS
|
|
665
|
+
# =========================================================
|
|
666
|
+
|
|
667
|
+
sudo docker ps
|
|
668
|
+
|
|
669
|
+
# Expected:
|
|
670
|
+
# prometheus container running
|
|
671
|
+
# grafana container running
|
|
672
|
+
|
|
673
|
+
# =========================================================
|
|
674
|
+
# STEP 14 — OPEN PROMETHEUS
|
|
675
|
+
# =========================================================
|
|
676
|
+
|
|
677
|
+
# Open browser:
|
|
678
|
+
# http://localhost:9090
|
|
679
|
+
|
|
680
|
+
# =========================================================
|
|
681
|
+
# STEP 15 — VERIFY METRICS SCRAPING
|
|
682
|
+
# =========================================================
|
|
683
|
+
|
|
684
|
+
# In Prometheus UI:
|
|
685
|
+
#
|
|
686
|
+
# Search:
|
|
687
|
+
# up
|
|
688
|
+
#
|
|
689
|
+
# Click:
|
|
690
|
+
# Execute
|
|
691
|
+
|
|
692
|
+
# Expected:
|
|
693
|
+
# up = 1
|
|
694
|
+
|
|
695
|
+
# This confirms Prometheus is scraping metrics
|
|
696
|
+
|
|
697
|
+
# =========================================================
|
|
698
|
+
# STEP 16 — OPEN GRAFANA
|
|
699
|
+
# =========================================================
|
|
700
|
+
|
|
701
|
+
# Open browser:
|
|
702
|
+
# http://localhost:3000
|
|
703
|
+
|
|
704
|
+
# =========================================================
|
|
705
|
+
# STEP 17 — LOGIN TO GRAFANA
|
|
706
|
+
# =========================================================
|
|
707
|
+
|
|
708
|
+
# Username:
|
|
709
|
+
# admin
|
|
710
|
+
|
|
711
|
+
# Password:
|
|
712
|
+
# admin
|
|
713
|
+
|
|
714
|
+
# =========================================================
|
|
715
|
+
# STEP 18 — ADD PROMETHEUS DATA SOURCE
|
|
716
|
+
# =========================================================
|
|
717
|
+
|
|
718
|
+
# In Grafana:
|
|
719
|
+
#
|
|
720
|
+
# Connections
|
|
721
|
+
# → Data Sources
|
|
722
|
+
# → Add data source
|
|
723
|
+
# → Select Prometheus
|
|
724
|
+
|
|
725
|
+
# =========================================================
|
|
726
|
+
# STEP 19 — CONFIGURE PROMETHEUS DATASOURCE
|
|
727
|
+
# =========================================================
|
|
728
|
+
|
|
729
|
+
# URL:
|
|
730
|
+
# http://prometheus:9090
|
|
731
|
+
|
|
732
|
+
# Click:
|
|
733
|
+
# Save & Test
|
|
734
|
+
|
|
735
|
+
# Expected:
|
|
736
|
+
# Data source is working
|
|
737
|
+
|
|
738
|
+
# =========================================================
|
|
739
|
+
# STEP 20 — CREATE DASHBOARD
|
|
740
|
+
# =========================================================
|
|
741
|
+
|
|
742
|
+
# In Grafana:
|
|
743
|
+
#
|
|
744
|
+
# Dashboards
|
|
745
|
+
# → New Dashboard
|
|
746
|
+
# → Add Visualization
|
|
747
|
+
|
|
748
|
+
# =========================================================
|
|
749
|
+
# STEP 21 — SELECT PROMETHEUS DATASOURCE
|
|
750
|
+
# =========================================================
|
|
751
|
+
|
|
752
|
+
# Choose:
|
|
753
|
+
# Prometheus
|
|
754
|
+
|
|
755
|
+
# =========================================================
|
|
756
|
+
# STEP 22 — ADD METRIC QUERY
|
|
757
|
+
# =========================================================
|
|
758
|
+
|
|
759
|
+
# Query:
|
|
760
|
+
# up
|
|
761
|
+
|
|
762
|
+
# =========================================================
|
|
763
|
+
# STEP 23 — RUN QUERY
|
|
764
|
+
# =========================================================
|
|
765
|
+
|
|
766
|
+
# Click:
|
|
767
|
+
# Run Query
|
|
768
|
+
|
|
769
|
+
# Expected:
|
|
770
|
+
# Graph/metrics visualization visible
|
|
771
|
+
|
|
772
|
+
# =========================================================
|
|
773
|
+
# STEP 24 — SAVE DASHBOARD
|
|
774
|
+
# =========================================================
|
|
775
|
+
|
|
776
|
+
# Click:
|
|
777
|
+
# Save Dashboard
|
|
778
|
+
|
|
779
|
+
# Enter:
|
|
780
|
+
# Prometheus Monitoring Dashboard
|
|
781
|
+
|
|
782
|
+
# =========================================================
|
|
783
|
+
# VERIFY COMPLETE FLOW
|
|
784
|
+
# =========================================================
|
|
785
|
+
|
|
786
|
+
# Prometheus:
|
|
787
|
+
# Scrapes metrics
|
|
788
|
+
|
|
789
|
+
# Grafana:
|
|
790
|
+
# Visualizes metrics
|
|
791
|
+
|
|
792
|
+
# Metric Used:
|
|
793
|
+
# up
|
|
794
|
+
|
|
795
|
+
# =========================================================
|
|
796
|
+
# CLEANUP (OPTIONAL)
|
|
797
|
+
# =========================================================
|
|
798
|
+
|
|
799
|
+
# Stop containers
|
|
800
|
+
sudo docker compose down
|
|
801
|
+
|
|
802
|
+
# =========================================================
|
|
803
|
+
# LAB TASK COMPLETED
|
|
804
|
+
# =========================================================
|
|
805
|
+
|
|
806
|
+
""",
|
|
807
|
+
"Kubernetes": """# =========================================================
|
|
808
|
+
# KUBERNETES (K8S) MINI-LAB
|
|
809
|
+
# =========================================================
|
|
810
|
+
|
|
811
|
+
STEP 1 — START CLUSTER
|
|
812
|
+
----------------------
|
|
813
|
+
minikube start
|
|
814
|
+
minikube status
|
|
815
|
+
|
|
816
|
+
STEP 2 — POD OPERATIONS
|
|
817
|
+
-----------------------
|
|
818
|
+
kubectl run my-pod --image=nginx
|
|
819
|
+
kubectl get pods
|
|
820
|
+
kubectl get pod my-pod -o wide
|
|
821
|
+
|
|
822
|
+
STEP 3 — SERVICES & ACCESS
|
|
823
|
+
--------------------------
|
|
824
|
+
kubectl expose pod my-pod --type=NodePort --port=80
|
|
825
|
+
minikube service my-pod --url
|
|
826
|
+
|
|
827
|
+
STEP 4 — DEPLOYMENTS & SCALING
|
|
828
|
+
------------------------------
|
|
829
|
+
kubectl create deployment my-deploy --image=nginx --replicas=2
|
|
830
|
+
kubectl get deployment
|
|
831
|
+
kubectl scale deployment my-deploy --replicas=5
|
|
832
|
+
|
|
833
|
+
STEP 5 — CLEANUP
|
|
834
|
+
---------------
|
|
835
|
+
kubectl delete service my-service
|
|
836
|
+
kubectl delete deployment my-deploy
|
|
837
|
+
minikube stop
|
|
838
|
+
"""
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
def clear_screen():
|
|
842
|
+
os.system('cls' if os.name == 'nt' else 'clear')
|
|
843
|
+
|
|
844
|
+
def print_banner():
|
|
845
|
+
banner = f"""
|
|
846
|
+
{Colors.GREY}{Colors.BOLD}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
847
|
+
DEVOPS WORKFLOW SEQUENCER
|
|
848
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━{Colors.RESET}
|
|
849
|
+
"""
|
|
850
|
+
print(banner)
|
|
851
|
+
|
|
852
|
+
def print_all_commands():
|
|
853
|
+
clear_screen()
|
|
854
|
+
print_banner()
|
|
855
|
+
print(f"{Colors.BOLD}Initializing master workflow sequence...{Colors.RESET}\n")
|
|
856
|
+
time.sleep(0.5)
|
|
857
|
+
|
|
858
|
+
for category, guide in LAB_GUIDES.items():
|
|
859
|
+
print(f"\n{Colors.BOLD}[ {category.upper()} MODULE ]{Colors.RESET}")
|
|
860
|
+
print(f"{Colors.GREY}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━{Colors.RESET}")
|
|
861
|
+
format_and_print_guide(guide)
|
|
862
|
+
time.sleep(0.3)
|
|
863
|
+
|
|
864
|
+
print(f"\n{Colors.BOLD}✓ All sequences loaded.{Colors.RESET}")
|
|
865
|
+
input(f"\n{Colors.GREY}Return to control center...{Colors.RESET}")
|
|
866
|
+
|
|
867
|
+
def format_and_print_guide(guide):
|
|
868
|
+
"""Helper to format guides using only white and grey."""
|
|
869
|
+
for line in guide.split('\n'):
|
|
870
|
+
if line.startswith('#'):
|
|
871
|
+
print(f"{Colors.BOLD}{line}{Colors.RESET}")
|
|
872
|
+
elif 'STEP' in line:
|
|
873
|
+
print(f"{Colors.BOLD}{line}{Colors.RESET}")
|
|
874
|
+
elif line.startswith('---') or line.startswith('==='):
|
|
875
|
+
print(f"{Colors.GREY}{line}{Colors.RESET}")
|
|
876
|
+
elif any(cmd in line for cmd in ['sudo', 'docker', 'git', 'kubectl', 'minikube']):
|
|
877
|
+
print(f" {Colors.BOLD}{line}{Colors.RESET}")
|
|
878
|
+
else:
|
|
879
|
+
print(f" {Colors.DIM}{line}{Colors.RESET}")
|
|
880
|
+
|
|
881
|
+
def show_category(category):
|
|
882
|
+
clear_screen()
|
|
883
|
+
print_banner()
|
|
884
|
+
print(f"{Colors.BOLD}Loading {category} lab sequence...{Colors.RESET}\n")
|
|
885
|
+
time.sleep(0.3)
|
|
886
|
+
|
|
887
|
+
format_and_print_guide(LAB_GUIDES[category])
|
|
888
|
+
|
|
889
|
+
print(f"\n{Colors.BOLD}✓ Sequence ready.{Colors.RESET}")
|
|
890
|
+
input(f"\n{Colors.GREY}Return to control center...{Colors.RESET}")
|
|
891
|
+
|
|
892
|
+
def main():
|
|
893
|
+
while True:
|
|
894
|
+
clear_screen()
|
|
895
|
+
print_banner()
|
|
896
|
+
print(f"{Colors.DIM}Select operational module:{Colors.RESET}")
|
|
897
|
+
print(f"{Colors.BOLD}01.{Colors.RESET} Docker Services")
|
|
898
|
+
print(f"{Colors.BOLD}02.{Colors.RESET} Git Workflow")
|
|
899
|
+
print(f"{Colors.BOLD}03.{Colors.RESET} Prometheus & Utilities")
|
|
900
|
+
print(f"{Colors.BOLD}04.{Colors.RESET} Kubernetes Cluster")
|
|
901
|
+
print(f"{Colors.BOLD}05.{Colors.RESET} Sequential Workflow Listing")
|
|
902
|
+
print(f"{Colors.GREY}06.{Colors.RESET} Exit System")
|
|
903
|
+
|
|
904
|
+
choice = input(f"\n{Colors.BOLD}cmd_select >> {Colors.RESET}")
|
|
905
|
+
|
|
906
|
+
if choice in ['1', '01']:
|
|
907
|
+
show_category("Docker")
|
|
908
|
+
elif choice in ['2', '02']:
|
|
909
|
+
show_category("Git")
|
|
910
|
+
elif choice in ['3', '03']:
|
|
911
|
+
show_category("Prometheus & Utils")
|
|
912
|
+
elif choice == '4' or choice == '04':
|
|
913
|
+
show_category("Kubernetes")
|
|
914
|
+
elif choice == '5' or choice == '05':
|
|
915
|
+
print_all_commands()
|
|
916
|
+
elif choice == '6' or choice == '06':
|
|
917
|
+
print(f"\n{Colors.GREY}System shutdown initiated...{Colors.RESET}")
|
|
918
|
+
time.sleep(0.8)
|
|
919
|
+
break
|
|
920
|
+
else:
|
|
921
|
+
print(f"\n{Colors.GREY}Command unrecognized.{Colors.RESET}")
|
|
922
|
+
time.sleep(1)
|
|
923
|
+
|
|
924
|
+
def run():
|
|
925
|
+
try:
|
|
926
|
+
main()
|
|
927
|
+
except KeyboardInterrupt:
|
|
928
|
+
print(f"\n\n{Colors.GREY}Process terminated by user.{Colors.RESET}")
|
|
929
|
+
sys.exit(0)
|
|
930
|
+
|
|
931
|
+
if __name__ == "__main__":
|
|
932
|
+
run()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: devops33
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.0
|
|
4
4
|
Summary: An interactive CLI tool for learning Docker, Git, Prometheus, and Kubernetes commands.
|
|
5
5
|
Author-email: DevOps Assistant <assistant@example.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/example/devops-lab-assistant
|
devops33-0.6.0/devops/main.py
DELETED
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import sys
|
|
3
|
-
import time
|
|
4
|
-
|
|
5
|
-
# --- Subtle ANSI Color Palette ---
|
|
6
|
-
class Colors:
|
|
7
|
-
DIM = '\033[2m'
|
|
8
|
-
GREY = '\033[90m'
|
|
9
|
-
SOFT_BLUE = '\033[34m'
|
|
10
|
-
SOFT_CYAN = '\033[36m'
|
|
11
|
-
SOFT_GREEN = '\033[32m'
|
|
12
|
-
SOFT_YELLOW = '\033[33m'
|
|
13
|
-
BOLD = '\033[1m'
|
|
14
|
-
RESET = '\033[0m'
|
|
15
|
-
|
|
16
|
-
# --- Full Lab Guide Content ---
|
|
17
|
-
LAB_GUIDES = {
|
|
18
|
-
"Docker": """# =========================================================
|
|
19
|
-
# DOCKER LAB GUIDE
|
|
20
|
-
# =========================================================
|
|
21
|
-
|
|
22
|
-
STEP 1 — OPEN UBUNTU WSL
|
|
23
|
-
------------------------
|
|
24
|
-
wsl -d Ubuntu
|
|
25
|
-
|
|
26
|
-
STEP 2 — VERIFY DOCKER INSTALLED
|
|
27
|
-
-------------------------------
|
|
28
|
-
sudo docker --version
|
|
29
|
-
|
|
30
|
-
STEP 3 — TEST DOCKER WORKING
|
|
31
|
-
---------------------------
|
|
32
|
-
sudo docker run hello-world
|
|
33
|
-
|
|
34
|
-
Expected Output: 'Hello from Docker!'
|
|
35
|
-
|
|
36
|
-
STEP 4 — CHECK DOWNLOADED IMAGES
|
|
37
|
-
-------------------------------
|
|
38
|
-
sudo docker images
|
|
39
|
-
|
|
40
|
-
STEP 5 — CHECK ALL CONTAINERS
|
|
41
|
-
----------------------------
|
|
42
|
-
sudo docker ps -a
|
|
43
|
-
|
|
44
|
-
STEP 6 — PULL IMAGE FROM HUB
|
|
45
|
-
---------------------------
|
|
46
|
-
sudo docker pull nginx
|
|
47
|
-
|
|
48
|
-
STEP 7 — RUN NGINX CONTAINER
|
|
49
|
-
---------------------------
|
|
50
|
-
sudo docker run -d --name mynginx -p 8080:80 nginx
|
|
51
|
-
|
|
52
|
-
STEP 8 — STOP & REMOVE
|
|
53
|
-
---------------------
|
|
54
|
-
sudo docker stop mynginx
|
|
55
|
-
sudo docker rm mynginx
|
|
56
|
-
|
|
57
|
-
STEP 9 — CUSTOM IMAGE BUILD
|
|
58
|
-
--------------------------
|
|
59
|
-
mkdir ~/custom_image && cd ~/custom_image
|
|
60
|
-
echo "print('Custom Image')" > app.py
|
|
61
|
-
nano Dockerfile
|
|
62
|
-
sudo docker build -t mypythonapp .
|
|
63
|
-
sudo docker run --name mycontainer mypythonapp
|
|
64
|
-
|
|
65
|
-
STEP 10 — DOCKER HUB SYNC
|
|
66
|
-
------------------------
|
|
67
|
-
sudo docker login
|
|
68
|
-
sudo docker tag mypythonapp user/repo:v1
|
|
69
|
-
sudo docker push user/repo:v1
|
|
70
|
-
""",
|
|
71
|
-
"Git": """# =========================================================
|
|
72
|
-
# GIT & GITHUB WORKFLOW
|
|
73
|
-
# =========================================================
|
|
74
|
-
|
|
75
|
-
STEP 1 — INSTALLATION & SETUP
|
|
76
|
-
-----------------------------
|
|
77
|
-
sudo apt update && sudo apt upgrade -y
|
|
78
|
-
sudo apt install git -y
|
|
79
|
-
git --version
|
|
80
|
-
|
|
81
|
-
STEP 2 — CONFIGURATION
|
|
82
|
-
----------------------
|
|
83
|
-
git config --global user.name "Your Name"
|
|
84
|
-
git config --global user.email "your@email.com"
|
|
85
|
-
|
|
86
|
-
STEP 3 — REPO INITIALIZATION
|
|
87
|
-
----------------------------
|
|
88
|
-
mkdir devops_lab && cd devops_lab
|
|
89
|
-
git init
|
|
90
|
-
|
|
91
|
-
STEP 4 — TRACKING CHANGES
|
|
92
|
-
-------------------------
|
|
93
|
-
echo "print('Hello')" > app.py
|
|
94
|
-
git status
|
|
95
|
-
git add .
|
|
96
|
-
git commit -m "Initial commit"
|
|
97
|
-
|
|
98
|
-
STEP 5 — REMOTE CONNECTION
|
|
99
|
-
--------------------------
|
|
100
|
-
git remote add origin https://github.com/user/repo.git
|
|
101
|
-
git branch -M main
|
|
102
|
-
git push -u origin main
|
|
103
|
-
|
|
104
|
-
STEP 6 — DAILY WORKFLOW
|
|
105
|
-
-----------------------
|
|
106
|
-
git status
|
|
107
|
-
git add .
|
|
108
|
-
git commit -m "update"
|
|
109
|
-
git push
|
|
110
|
-
""",
|
|
111
|
-
"Prometheus & Utils": """# =========================================================
|
|
112
|
-
# PROMETHEUS & GRAFANA STACK
|
|
113
|
-
# =========================================================
|
|
114
|
-
|
|
115
|
-
STEP 1 — PROJECT SETUP
|
|
116
|
-
----------------------
|
|
117
|
-
mkdir ~/prom_lab && cd ~/prom_lab
|
|
118
|
-
|
|
119
|
-
STEP 2 — CONFIGURATION FILES
|
|
120
|
-
---------------------------
|
|
121
|
-
nano prometheus.yml
|
|
122
|
-
nano docker-compose.yml
|
|
123
|
-
|
|
124
|
-
STEP 3 — DEPLOY STACK
|
|
125
|
-
---------------------
|
|
126
|
-
sudo docker compose up -d
|
|
127
|
-
sudo docker ps
|
|
128
|
-
|
|
129
|
-
STEP 4 — VERIFY METRICS
|
|
130
|
-
----------------------
|
|
131
|
-
Check http://localhost:9090 (Prometheus)
|
|
132
|
-
Check http://localhost:3000 (Grafana)
|
|
133
|
-
|
|
134
|
-
STEP 5 — CLEANUP
|
|
135
|
-
---------------
|
|
136
|
-
sudo docker compose down
|
|
137
|
-
""",
|
|
138
|
-
"Kubernetes": """# =========================================================
|
|
139
|
-
# KUBERNETES (K8S) MINI-LAB
|
|
140
|
-
# =========================================================
|
|
141
|
-
|
|
142
|
-
STEP 1 — START CLUSTER
|
|
143
|
-
----------------------
|
|
144
|
-
minikube start
|
|
145
|
-
minikube status
|
|
146
|
-
|
|
147
|
-
STEP 2 — POD OPERATIONS
|
|
148
|
-
-----------------------
|
|
149
|
-
kubectl run my-pod --image=nginx
|
|
150
|
-
kubectl get pods
|
|
151
|
-
kubectl get pod my-pod -o wide
|
|
152
|
-
|
|
153
|
-
STEP 3 — SERVICES & ACCESS
|
|
154
|
-
--------------------------
|
|
155
|
-
kubectl expose pod my-pod --type=NodePort --port=80
|
|
156
|
-
minikube service my-pod --url
|
|
157
|
-
|
|
158
|
-
STEP 4 — DEPLOYMENTS & SCALING
|
|
159
|
-
------------------------------
|
|
160
|
-
kubectl create deployment my-deploy --image=nginx --replicas=2
|
|
161
|
-
kubectl get deployment
|
|
162
|
-
kubectl scale deployment my-deploy --replicas=5
|
|
163
|
-
|
|
164
|
-
STEP 5 — CLEANUP
|
|
165
|
-
---------------
|
|
166
|
-
kubectl delete service my-service
|
|
167
|
-
kubectl delete deployment my-deploy
|
|
168
|
-
minikube stop
|
|
169
|
-
"""
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
def clear_screen():
|
|
173
|
-
os.system('cls' if os.name == 'nt' else 'clear')
|
|
174
|
-
|
|
175
|
-
def print_banner():
|
|
176
|
-
banner = f"""
|
|
177
|
-
{Colors.GREY}{Colors.BOLD}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
178
|
-
DEVOPS WORKFLOW SEQUENCER
|
|
179
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━{Colors.RESET}
|
|
180
|
-
"""
|
|
181
|
-
print(banner)
|
|
182
|
-
|
|
183
|
-
def print_all_commands():
|
|
184
|
-
clear_screen()
|
|
185
|
-
print_banner()
|
|
186
|
-
print(f"{Colors.SOFT_CYAN}Initializing full master workflow sequence...{Colors.RESET}\n")
|
|
187
|
-
time.sleep(0.5)
|
|
188
|
-
|
|
189
|
-
for category, guide in LAB_GUIDES.items():
|
|
190
|
-
print(f"\n{Colors.BOLD}{Colors.SOFT_BLUE}[ {category.upper()} MODULE ]{Colors.RESET}")
|
|
191
|
-
print(f"{Colors.GREY}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━{Colors.RESET}")
|
|
192
|
-
format_and_print_guide(guide)
|
|
193
|
-
time.sleep(0.3)
|
|
194
|
-
|
|
195
|
-
print(f"\n{Colors.SOFT_GREEN}✓ All sequences loaded.{Colors.RESET}")
|
|
196
|
-
input(f"\n{Colors.GREY}Return to control center...{Colors.RESET}")
|
|
197
|
-
|
|
198
|
-
def format_and_print_guide(guide):
|
|
199
|
-
"""Helper to add some color to the embedded markdown guides."""
|
|
200
|
-
for line in guide.split('\n'):
|
|
201
|
-
if line.startswith('#'):
|
|
202
|
-
print(f"{Colors.BOLD}{Colors.SOFT_CYAN}{line}{Colors.RESET}")
|
|
203
|
-
elif 'STEP' in line:
|
|
204
|
-
print(f"{Colors.SOFT_YELLOW}{line}{Colors.RESET}")
|
|
205
|
-
elif line.startswith('---') or line.startswith('==='):
|
|
206
|
-
print(f"{Colors.GREY}{line}{Colors.RESET}")
|
|
207
|
-
elif any(cmd in line for cmd in ['sudo', 'docker', 'git', 'kubectl', 'minikube']):
|
|
208
|
-
print(f" {Colors.SOFT_GREEN}{line}{Colors.RESET}")
|
|
209
|
-
else:
|
|
210
|
-
print(f" {Colors.DIM}{line}{Colors.RESET}")
|
|
211
|
-
|
|
212
|
-
def show_category(category):
|
|
213
|
-
clear_screen()
|
|
214
|
-
print_banner()
|
|
215
|
-
print(f"{Colors.SOFT_CYAN}Loading full {category} lab sequence...{Colors.RESET}\n")
|
|
216
|
-
time.sleep(0.3)
|
|
217
|
-
|
|
218
|
-
format_and_print_guide(LAB_GUIDES[category])
|
|
219
|
-
|
|
220
|
-
print(f"\n{Colors.SOFT_GREEN}✓ Sequence ready.{Colors.RESET}")
|
|
221
|
-
input(f"\n{Colors.GREY}Return to control center...{Colors.RESET}")
|
|
222
|
-
|
|
223
|
-
def main():
|
|
224
|
-
while True:
|
|
225
|
-
clear_screen()
|
|
226
|
-
print_banner()
|
|
227
|
-
print(f"{Colors.DIM}Select operational module:{Colors.RESET}")
|
|
228
|
-
print(f"{Colors.SOFT_CYAN}01.{Colors.RESET} Docker Services")
|
|
229
|
-
print(f"{Colors.SOFT_CYAN}02.{Colors.RESET} Git Workflow")
|
|
230
|
-
print(f"{Colors.SOFT_CYAN}03.{Colors.RESET} Prometheus & Utilities")
|
|
231
|
-
print(f"{Colors.SOFT_CYAN}04.{Colors.RESET} Kubernetes Cluster")
|
|
232
|
-
print(f"{Colors.SOFT_CYAN}05.{Colors.RESET} {Colors.BOLD}Sequential Workflow Listing{Colors.RESET}")
|
|
233
|
-
print(f"{Colors.GREY}06.{Colors.RESET} Exit System")
|
|
234
|
-
|
|
235
|
-
choice = input(f"\n{Colors.SOFT_YELLOW}cmd_select >> {Colors.RESET}")
|
|
236
|
-
|
|
237
|
-
if choice in ['1', '01']:
|
|
238
|
-
show_category("Docker")
|
|
239
|
-
elif choice in ['2', '02']:
|
|
240
|
-
show_category("Git")
|
|
241
|
-
elif choice in ['3', '03']:
|
|
242
|
-
show_category("Prometheus & Utils")
|
|
243
|
-
elif choice == '4' or choice == '04':
|
|
244
|
-
show_category("Kubernetes")
|
|
245
|
-
elif choice == '5' or choice == '05':
|
|
246
|
-
print_all_commands()
|
|
247
|
-
elif choice == '6' or choice == '06':
|
|
248
|
-
print(f"\n{Colors.SOFT_GREEN}System shutdown initiated...{Colors.RESET}")
|
|
249
|
-
time.sleep(0.8)
|
|
250
|
-
break
|
|
251
|
-
else:
|
|
252
|
-
print(f"\n{Colors.SOFT_YELLOW}Command unrecognized.{Colors.RESET}")
|
|
253
|
-
time.sleep(1)
|
|
254
|
-
|
|
255
|
-
def run():
|
|
256
|
-
try:
|
|
257
|
-
main()
|
|
258
|
-
except KeyboardInterrupt:
|
|
259
|
-
print(f"\n\n{Colors.GREY}Process terminated by user.{Colors.RESET}")
|
|
260
|
-
sys.exit(0)
|
|
261
|
-
|
|
262
|
-
if __name__ == "__main__":
|
|
263
|
-
run()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|