devops33 0.5.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: devops33
3
- Version: 0.5.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.5.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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "devops33"
7
- version = "0.5.0"
7
+ version = "0.7.0"
8
8
  authors = [
9
9
  { name="DevOps Assistant", email="assistant@example.com" },
10
10
  ]
@@ -1,188 +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
- # --- Command Data ---
17
- COMMANDS = {
18
- "Docker": [
19
- {"cmd": "wsl -d Ubuntu", "desc": "Opens the Ubuntu WSL distribution from PowerShell."},
20
- {"cmd": "sudo docker --version", "desc": "Verifies if Docker is installed and shows the version."},
21
- {"cmd": "sudo docker run hello-world", "desc": "Tests if Docker is working correctly by running a test container."},
22
- {"cmd": "sudo docker images", "desc": "Lists all Docker images currently downloaded on your system."},
23
- {"cmd": "sudo docker ps -a", "desc": "Shows all containers, including those that are currently stopped."},
24
- {"cmd": "sudo docker pull nginx", "desc": "Downloads the official Nginx image from Docker Hub."},
25
- {"cmd": "sudo docker run -d --name mynginx -p 8080:80 nginx", "desc": "Runs Nginx in detached mode with port mapping."},
26
- {"cmd": "sudo docker ps", "desc": "Lists currently running containers."},
27
- {"cmd": "sudo docker stop mynginx", "desc": "Stops a running container named 'mynginx'."},
28
- {"cmd": "sudo docker rm mynginx", "desc": "Permanently removes a stopped container named 'mynginx'."},
29
- {"cmd": "mkdir ~/custom_image", "desc": "Creates a new project directory for a custom Docker image."},
30
- {"cmd": "cd ~/custom_image", "desc": "Changes directory into the project folder."},
31
- {"cmd": "echo \"print('...')\" > app.py", "desc": "Creates a simple Python application file."},
32
- {"cmd": "cat app.py", "desc": "Displays the contents of the Python application file."},
33
- {"cmd": "nano Dockerfile", "desc": "Opens the nano editor to create or edit a Dockerfile."},
34
- {"cmd": "cat Dockerfile", "desc": "Displays the contents of the Dockerfile."},
35
- {"cmd": "sudo docker build -t mypythonapp .", "desc": "Builds a custom Docker image from the local Dockerfile."},
36
- {"cmd": "sudo docker run --name mycontainer mypythonapp", "desc": "Runs a container from your custom built image."},
37
- {"cmd": "sudo docker logs mycontainer", "desc": "Displays the output logs from a specific container."},
38
- {"cmd": "sudo docker login", "desc": "Authenticates your local client with your Docker Hub account."},
39
- {"cmd": "sudo docker tag mypythonapp user/app:v1", "desc": "Tags an image for uploading to Docker Hub."},
40
- {"cmd": "sudo docker push user/app:v1", "desc": "Uploads the tagged image to Docker Hub."},
41
- {"cmd": "sudo docker rmi mypythonapp", "desc": "Removes a local Docker image from your system."}
42
- ],
43
- "Git": [
44
- {"cmd": "sudo apt update", "desc": "Updates the local package list for the latest software info."},
45
- {"cmd": "sudo apt upgrade -y", "desc": "Upgrades all installed packages to their latest versions."},
46
- {"cmd": "git --version", "desc": "Checks the currently installed Git version."},
47
- {"cmd": "sudo apt install git -y", "desc": "Installs the Git version control system."},
48
- {"cmd": "cd ~", "desc": "Navigates to the Linux user's home directory."},
49
- {"cmd": "mkdir devops_lab", "desc": "Creates a new folder for the DevOps lab project."},
50
- {"cmd": "cd devops_lab", "desc": "Enters the project folder."},
51
- {"cmd": "pwd", "desc": "Prints the absolute path of the current working directory."},
52
- {"cmd": "git init", "desc": "Initializes a new Git repository in the current folder."},
53
- {"cmd": "echo \"print('...')\" > app.py", "desc": "Creates a Python file for the Git lab."},
54
- {"cmd": "ls", "desc": "Lists the files in the current directory."},
55
- {"cmd": "cat app.py", "desc": "Views the contents of the application file."},
56
- {"cmd": "git status", "desc": "Shows the state of tracked and untracked files."},
57
- {"cmd": "git config --global user.name 'Name'", "desc": "Sets your Git username globally."},
58
- {"cmd": "git config --global user.email 'Email'", "desc": "Sets your Git email address globally."},
59
- {"cmd": "git add app.py", "desc": "Stages a specific file for the next commit."},
60
- {"cmd": "git add .", "desc": "Stages all changes in the current directory."},
61
- {"cmd": "git commit -m 'message'", "desc": "Commits staged changes to the repository history."},
62
- {"cmd": "git log --oneline", "desc": "Shows a compact version of the commit history."},
63
- {"cmd": "git remote add origin <url>", "desc": "Links your local repo to a remote GitHub repository."},
64
- {"cmd": "git remote -v", "desc": "Verifies the link to the remote repository."},
65
- {"cmd": "git branch -M main", "desc": "Renames the current branch to 'main'."},
66
- {"cmd": "git push -u origin main", "desc": "Uploads local commits and sets the upstream branch."},
67
- {"cmd": "git push", "desc": "Uploads local commits to the remote repository."}
68
- ],
69
- "Prometheus & Utils": [
70
- {"cmd": "mkdir ~/prom_lab", "desc": "Creates a directory for Prometheus and Grafana files."},
71
- {"cmd": "cd ~/prom_lab", "desc": "Enters the Prometheus project directory."},
72
- {"cmd": "nano prometheus.yml", "desc": "Creates or edits the Prometheus configuration file."},
73
- {"cmd": "cat prometheus.yml", "desc": "Displays the Prometheus configuration content."},
74
- {"cmd": "nano docker-compose.yml", "desc": "Creates or edits the Docker Compose configuration file."},
75
- {"cmd": "cat docker-compose.yml", "desc": "Displays the Docker Compose file content."},
76
- {"cmd": "sudo docker compose up -d", "desc": "Starts Prometheus and Grafana in detached mode."},
77
- {"cmd": "sudo docker ps", "desc": "Checks if Prometheus and Grafana containers are running."},
78
- {"cmd": "sudo docker compose down", "desc": "Stops and removes the multi-container application."}
79
- ],
80
- "Kubernetes": [
81
- {"cmd": "minikube start", "desc": "Starts the local Kubernetes cluster using Minikube."},
82
- {"cmd": "minikube status", "desc": "Checks the status of the local Minikube cluster."},
83
- {"cmd": "kubectl version --client", "desc": "Verifies that the kubectl client is working."},
84
- {"cmd": "kubectl run my-pod --image=nginx", "desc": "Creates and runs a simple Nginx pod in the cluster."},
85
- {"cmd": "kubectl get pods", "desc": "Lists all pods currently running in the cluster."},
86
- {"cmd": "kubectl get pod my-pod -o wide", "desc": "Shows detailed pod info, including its IP and Node."},
87
- {"cmd": "minikube service my-service --url", "desc": "Generates a URL to access a service in Minikube."},
88
- {"cmd": "kubectl port-forward pod/my-pod 8080:80", "desc": "Forwards local port 8080 to the pod's port 80."},
89
- {"cmd": "kubectl expose pod my-pod --type=NodePort", "desc": "Exposes a pod via a NodePort service."},
90
- {"cmd": "kubectl get services", "desc": "Lists all services active in the cluster."},
91
- {"cmd": "kubectl delete service my-service", "desc": "Removes a specific service from the cluster."},
92
- {"cmd": "kubectl delete pod my-pod", "desc": "Deletes a specific pod from the cluster."},
93
- {"cmd": "kubectl create deployment my-deploy", "desc": "Creates a deployment to manage replicated pods."},
94
- {"cmd": "kubectl get deployment", "desc": "Lists all deployments and their status."},
95
- {"cmd": "kubectl scale deployment --replicas=5", "desc": "Scales a deployment to the specified number of replicas."},
96
- {"cmd": "minikube stop", "desc": "Stops the running local Kubernetes cluster."}
97
- ]
98
- }
99
-
100
- def clear_screen():
101
- os.system('cls' if os.name == 'nt' else 'clear')
102
-
103
- def print_banner():
104
- banner = f"""
105
- {Colors.GREY}{Colors.BOLD}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
106
- DEVOPS WORKFLOW SEQUENCER
107
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━{Colors.RESET}
108
- """
109
- print(banner)
110
-
111
- def print_all_commands():
112
- clear_screen()
113
- print_banner()
114
- print(f"{Colors.SOFT_CYAN}Initializing full workflow sequence...{Colors.RESET}\n")
115
- time.sleep(0.5)
116
-
117
- index = 1
118
- for category, cmds in COMMANDS.items():
119
- print(f"\n{Colors.BOLD}{Colors.SOFT_BLUE}[ {category.upper()} ]{Colors.RESET}")
120
- print(f"{Colors.GREY}─────────────────────────────────────────{Colors.RESET}")
121
- for item in cmds:
122
- print(f"{Colors.SOFT_GREEN}[{index:02d}]{Colors.RESET} {Colors.BOLD}{item['cmd']}{Colors.RESET}")
123
- print(f" {Colors.GREY}↳ {item['desc']}{Colors.RESET}")
124
- index += 1
125
- time.sleep(0.05) # Subtle "processing" delay
126
- print()
127
-
128
- print(f"\n{Colors.SOFT_GREEN}✓ Sequence complete.{Colors.RESET}")
129
- input(f"\n{Colors.GREY}Return to control center...{Colors.RESET}")
130
-
131
- def show_category(category):
132
- clear_screen()
133
- print_banner()
134
- print(f"{Colors.SOFT_CYAN}Loading {category} process sequence...{Colors.RESET}\n")
135
- time.sleep(0.3)
136
-
137
- print(f"{Colors.BOLD}{Colors.SOFT_BLUE}[ {category.upper()} ]{Colors.RESET}")
138
- print(f"{Colors.GREY}─────────────────────────────────────────{Colors.RESET}")
139
-
140
- for i, item in enumerate(COMMANDS[category], 1):
141
- print(f"{Colors.SOFT_GREEN}[{i:02d}]{Colors.RESET} {Colors.BOLD}{item['cmd']}{Colors.RESET}")
142
- print(f" {Colors.GREY}↳ {item['desc']}{Colors.RESET}")
143
- time.sleep(0.05)
144
-
145
- print(f"\n{Colors.SOFT_GREEN}✓ Sequence ready.{Colors.RESET}")
146
- input(f"\n{Colors.GREY}Return to control center...{Colors.RESET}")
147
-
148
- def main():
149
- while True:
150
- clear_screen()
151
- print_banner()
152
- print(f"{Colors.DIM}Select operational module:{Colors.RESET}")
153
- print(f"{Colors.SOFT_CYAN}01.{Colors.RESET} Docker Services")
154
- print(f"{Colors.SOFT_CYAN}02.{Colors.RESET} Git Workflow")
155
- print(f"{Colors.SOFT_CYAN}03.{Colors.RESET} Prometheus & Utilities")
156
- print(f"{Colors.SOFT_CYAN}04.{Colors.RESET} Kubernetes Cluster")
157
- print(f"{Colors.SOFT_CYAN}05.{Colors.RESET} {Colors.BOLD}Sequential Workflow Listing{Colors.RESET}")
158
- print(f"{Colors.GREY}06.{Colors.RESET} Exit System")
159
-
160
- choice = input(f"\n{Colors.SOFT_YELLOW}cmd_select >> {Colors.RESET}")
161
-
162
- if choice in ['1', '01']:
163
- show_category("Docker")
164
- elif choice in ['2', '02']:
165
- show_category("Git")
166
- elif choice in ['3', '03']:
167
- show_category("Prometheus & Utils")
168
- elif choice == '4' or choice == '04':
169
- show_category("Kubernetes")
170
- elif choice == '5' or choice == '05':
171
- print_all_commands()
172
- elif choice == '6' or choice == '06':
173
- print(f"\n{Colors.SOFT_GREEN}System shutdown initiated...{Colors.RESET}")
174
- time.sleep(0.8)
175
- break
176
- else:
177
- print(f"\n{Colors.SOFT_YELLOW}Command unrecognized.{Colors.RESET}")
178
- time.sleep(1)
179
-
180
- def run():
181
- try:
182
- main()
183
- except KeyboardInterrupt:
184
- print(f"\n\n{Colors.GREY}Process terminated by user.{Colors.RESET}")
185
- sys.exit(0)
186
-
187
- if __name__ == "__main__":
188
- run()
File without changes
File without changes
File without changes
File without changes
File without changes