├── README.md
├── awsdgtv.md
├── git.md
├── nginx
├── README.md
└── screenshots
│ ├── dns_propagation_check.png
│ ├── graph_database.png
│ ├── nginx_config_directory.png
│ ├── nginx_virtual_host_config_file.png
│ └── spedfit_ssl_certificate_installation_report.png
├── practice.txt
└── sheetcoins.md
/README.md:
--------------------------------------------------------------------------------
1 | # DevOps Boot Camp 2021
2 | > devops practice repo
3 |
4 | ## Code Quality and Code Security
5 | > sonar-scanner.bat -D"sonar.projectKey=python_test" -D"sonar.sources=c:\software\code." -D"sonar.host.url=http://localhost:9099" -D"sonar.login=YourKey" -D"sonar.projectBaseDir=C:\software\code"
6 |
7 | ## DevOps Tools
8 | * [Git](https://github.com/mateors/devops/blob/master/git.md)
9 | * [Linux](https://github.com/mateors/linuxcmd)
10 | * [Docker](https://github.com/mateors/docker)
11 | * [Jenkins](https://github.com/mateors/jenkins)
12 | * [Jenkins Pipeline](https://github.com/mateors/jenkinspipeline)
13 | * [Maven/Selenium Project](https://github.com/mateors/mavenjenkins)
14 | * [NGINX](https://github.com/mateors/devops/tree/master/nginx)
15 | * [SSH](https://github.com/mateors/sshcmd)
16 | * [FFMPEG](https://github.com/mateors/ffmpeg)
17 | * [Networking Tutorial](https://www.youtube.com/playlist?list=PLowKtXNTBypH19whXTVoG3oKSuOcw_XeW)
18 | * [sonarqube](https://www.sonarqube.org)
19 |
--------------------------------------------------------------------------------
/awsdgtv.md:
--------------------------------------------------------------------------------
1 | # dg2tv.com
2 |
3 | > sudo mkdir -p /var/www/dg2tv.com/public_html
4 |
5 | > sudo chown -R $USER:$USER /var/www/dg2tv.com/public_html
6 |
7 | > sudo chmod -R 755 /var/www/dg2tv.com
8 |
9 | > nano /var/www/dg2tv.com/public_html/index.html
10 |
11 | ``` html
12 |
13 |
14 | Welcome to dgtv!
15 |
16 |
17 | Welcome to dg2tv.com
18 |
19 |
20 | ```
21 |
22 | > sudo nano /etc/nginx/sites-available/dg2tv.com.conf
23 | ```
24 | server {
25 | listen 80;
26 | listen [::]:80;
27 |
28 | root /var/www/dg2tv.com/public_html;
29 | index index.html;
30 |
31 | server_name dg2tv.com;
32 |
33 | location / {
34 | try_files $uri $uri/ =404;
35 | }
36 | }
37 | ```
38 |
39 |
40 | > sudo ln -s /etc/nginx/sites-available/dg2tv.com.conf /etc/nginx/sites-enabled/
41 |
42 | > sudo systemctl restart nginx
43 |
44 | > nano /lib/systemd/system/dg2tv.service
45 |
46 | ```
47 | [Unit]
48 | Description=dg2tv.com website
49 | After=network.target
50 |
51 | [Service]
52 | Type=simple
53 | Restart=always
54 | RestartSec=5s
55 | WorkingDirectory=/var/www/dg2tv.com/public_html
56 | ExecStart=/var/www/dg2tv.com/public_html/dg2tv
57 |
58 | [Install]
59 | WantedBy=multi-user.target
60 | ```
61 |
62 | > systemctl status dg2tv
63 |
64 | > sudo ufw allow 8082/tcp
65 |
66 | > sudo nano /etc/nginx/sites-available/dg2tv.com.conf
67 |
68 | ```
69 | server {
70 |
71 | root /var/www/dg2tv.com/public_html;
72 | index index.html;
73 |
74 | server_name dg2tv.com;
75 | client_max_body_size 100G;
76 |
77 | location / {
78 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
79 | proxy_set_header X-Forwarded-Proto $scheme;
80 | proxy_set_header X-Real-IP $remote_addr;
81 | proxy_set_header Host $host;
82 | proxy_read_timeout 600;
83 | proxy_send_timeout 2m;
84 | proxy_pass http://127.0.0.1:8082;
85 | }
86 |
87 | add_header X-Powered-By MATEORS;
88 | }
89 | ```
90 |
91 | > journalctl -u dg2tv --no-pager -f
92 |
--------------------------------------------------------------------------------
/git.md:
--------------------------------------------------------------------------------
1 | # Git practice
2 |
3 | ## Branch Create, Merge and Resolve Conflicts
4 | > `mkdir webapp`\
5 | > `git init`
6 |
7 | > `cd webapp`\
8 | > `touch main.go`\
9 | > `touch test.go`\
10 |
11 | > `touch config.ini`
12 |
13 |
14 | > `git add .`\
15 | > `git commit -m "initial commit"`
16 |
17 | > `git branch branch1`\
18 | > `git branch`\
19 | > `git checkout branch1`\
20 | > `ls -ltr`\
21 | > `git branch`\
22 | > `touch about.txt`\
23 | > `tohch contact.txt`
24 |
25 | > `git add .`\
26 | > `git commit -m "initial commit in branch1"`\
27 |
28 | > `ls -ltr`\
29 | > `pwd`
30 |
31 | > `git checkout master`\
32 | > `ls -ltr`
33 |
34 | > `git checkout -b branch2`\
35 | > `git branch`
36 |
37 | > `git checkout master`\
38 | > `ls -ltr`
39 |
40 | > `git branch`\
41 | > `git merge branch1`
42 |
43 | > `git branch -d branch1`\
44 | > `git branch`
45 |
46 | ## Unmerged branch deletion
47 | > `git branch -D branch2`
48 |
49 | ## Merge Conflicts
50 | > `nano main.go`\
51 | > add some content and save
52 |
53 | > `git add .`\
54 | > `git commit -m "code added"`
55 |
56 | > `git branch branch1`\
57 | > `git checkout branch1`
58 |
59 | > `ls -ltr`
60 |
61 | > `nano main.go`\
62 | > add one line
63 |
64 | > `git add .`\
65 | > `git commit -m "change done in branch1"`
66 |
67 | > `git checkout master`
68 |
69 | > `nano main.go`\
70 | > modify last edited text
71 |
72 | > `git add .`\
73 | > `git commit -m "code modified"`
74 |
75 | > `git merge branch1`
76 |
77 | > `git config --global merge.tool kdiff3`
78 |
79 | > `git mergetool`
80 |
81 | ## Show the merged branches
82 | > `git branch --merged`
--------------------------------------------------------------------------------
/nginx/README.md:
--------------------------------------------------------------------------------
1 | # Step-1: DNS Record check
2 | > NS Record set & DNS Propagation check, A record Check
3 | > `https://dnsmap.io/#A/spedfit.com` or `https://dnschecker.org/#A/www.spedfit.com`
4 |
5 | 
6 |
7 | ### Note
8 | > If you find the IP of the server from the search above, then you are ready to go to the next step.
9 |
10 | # Step-2: NGINX
11 | ### Virtual Hosting using nginx
12 | > `nano /etc/nginx/conf.d/spedfit.com.conf`
13 |
14 | ```
15 | server {
16 | listen 80;
17 | server_name spedfit.com;
18 | #expires 1d;
19 |
20 | location / {
21 |
22 | #proxy_cache my_cache;
23 | #proxy_buffering on;
24 | #proxy_cache_valid 200 1d;
25 | #proxy_cache_use_stale error timeout invalid_header updating
26 | #http_500 http_502 http_503 http_504;
27 |
28 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
29 | proxy_set_header X-Forwarded-Proto $scheme;
30 | proxy_set_header X-Real-IP $remote_addr;
31 | proxy_set_header Host $host;
32 | proxy_pass http://127.0.0.1:8822;
33 | }
34 | }
35 | ```
36 |
37 | 
38 |
39 | ## NGINX STATUS & RESTART
40 | > sudo systemctl status nginx\
41 | > sudo systemctl reload nginx\
42 | > sudo systemctl restart nginx
43 |
44 | ## NGINX Configuration check
45 | > sudo nginx -t
46 |
47 | ## Upload website/webapp files to the remote server
48 | > **Windows**: using winscp [WinScp Download](https://winscp.net/eng/download.php)\
49 | > **Linux**: using ssh scp command ([Jenkins pipeline job](http://91.205.173.170:8080/job/JenkinsPipeline/pipeline-syntax/)/groovy script generator)
50 |
51 | # Creating a Systemd service file
52 | > sudo nano /lib/systemd/system/spedfit.service
53 |
54 | ```
55 | [Unit]
56 | Description=Spedfit website
57 | After=network.target
58 |
59 | [Service]
60 | Type=simple
61 | Restart=always
62 | RestartSec=5s
63 | WorkingDirectory=/home/mastererp/spedfit.com/
64 | ExecStart=/home/mastererp/spedfit.com/spedfit
65 |
66 | [Install]
67 | WantedBy=multi-user.target
68 | ```
69 |
70 | ## Set permission
71 | > sudo chmod 664 /lib/systemd/system/spedfit.service
72 |
73 | ## Reload systemd daemon
74 | > sudo systemctl daemon-reload
75 |
76 | ## Check service status & Restart (just created)
77 | > sudo service spedfit status\
78 | > sudo service spedfit start
79 |
80 | ## Enable to start services automatically at boot
81 | > sudo systemctl enable spedfit
82 |
83 | # Obtaining a certificate from letsencrypt.org
84 | ### Single domain registration
85 | > sudo certbot --nginx -d spedfit.com -d www.spedfit.com
86 |
87 | ### Multiple domain registration
88 | > sudo certbot --nginx -d spedfit.com -d www.spedfit.com
89 |
90 | ## To Test the certificate and SSL Configuration
91 | > `https://www.ssllabs.com/ssltest/analyze.html?d=spedfit.com`
92 |
93 | 
94 |
95 | ## Check out nginx spedfit.com.conf again (too verify what changes made after obtained ssl certificate)
96 | 
97 |
98 | # Renew SSL Certificate
99 | > sudo certbot renew --dry-run
100 |
101 | # Firewall open port & Reload
102 | > sudo firewall-cmd --list-ports\
103 | > sudo firewall-cmd --permanent --add-port=8822/tcp\
104 | > sudo firewall-cmd --reload\
105 | > sudo firewall-cmd --list-ports
106 |
107 | ## Set Execute permission to binary file
108 | > sudo chmod +x /home/mastererp/spedfit.com/spedfit
109 |
110 | ## Change owner permission
111 | > sudo chown -R root:root /home/mastererp/spedfit.com/
112 |
113 |
114 | # Resource
115 | * [NGINX digitalocean setup guide](https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-centos-8)
116 | * [APACHE digitalocean setup guide](https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-centos-8)
--------------------------------------------------------------------------------
/nginx/screenshots/dns_propagation_check.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mateors/devops/03f55f8fdfd25a801df939d9c12ef55d490502a3/nginx/screenshots/dns_propagation_check.png
--------------------------------------------------------------------------------
/nginx/screenshots/graph_database.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mateors/devops/03f55f8fdfd25a801df939d9c12ef55d490502a3/nginx/screenshots/graph_database.png
--------------------------------------------------------------------------------
/nginx/screenshots/nginx_config_directory.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mateors/devops/03f55f8fdfd25a801df939d9c12ef55d490502a3/nginx/screenshots/nginx_config_directory.png
--------------------------------------------------------------------------------
/nginx/screenshots/nginx_virtual_host_config_file.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mateors/devops/03f55f8fdfd25a801df939d9c12ef55d490502a3/nginx/screenshots/nginx_virtual_host_config_file.png
--------------------------------------------------------------------------------
/nginx/screenshots/spedfit_ssl_certificate_installation_report.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mateors/devops/03f55f8fdfd25a801df939d9c12ef55d490502a3/nginx/screenshots/spedfit_ssl_certificate_installation_report.png
--------------------------------------------------------------------------------
/practice.txt:
--------------------------------------------------------------------------------
1 | git practice
2 | another line
3 |
--------------------------------------------------------------------------------
/sheetcoins.md:
--------------------------------------------------------------------------------
1 | http://mostain.sheetcoins.com/
2 |
3 | http://mostain.sheetcoins.com/
4 |
5 | service --status-all
6 |
7 | systemctl list-units --type=service
8 |
9 | systemctl list-unit-files --state=enabled
10 |
11 | apt install net-tools
12 |
13 |
14 | sudo apt list --installed | grep nginx
15 |
16 |
17 | sudo apt install nginx
18 |
19 | sudo ufw app list
20 |
21 | sudo ufw allow 'Nginx Full'
22 |
23 |
24 | sudo systemctl enable nginx
25 |
26 | systemctl start nginx
27 |
28 | rm -rf /etc/nginx/conf.d/default.conf
29 |
30 |
31 | nano /etc/nginx/sites-available/mostain.sheetcoins.com
32 |
33 |
34 | server {
35 |
36 | listen 80;
37 | listen [::]:80;
38 |
39 | root /var/www/vhosts/mostain.sheetcoins.com/public_html;
40 | index index.html;
41 |
42 | server_name mostain.sheetcoins.com;
43 |
44 | location / {
45 | try_files $uri $uri/ =404;
46 | }
47 |
48 | }
49 |
50 |
51 | chmod -R 755 /var/www/vhosts/*
52 |
53 | sudo ln -sf /etc/nginx/sites-available/mostain.sheetcoins.com /etc/nginx/sites-enabled/
54 |
55 | nginx -t
56 |
57 | systemctl restart nginx
58 |
59 |
60 | sudo apt install certbot python3-certbot-nginx
61 |
62 |
63 |
64 |
65 | nano /etc/nginx/sites-available/ariel.sheetcoins.com
66 |
67 | server {
68 |
69 | listen 80;
70 | listen [::]:80;
71 |
72 | root /var/www/vhosts/ariel.sheetcoins.com/public_html;
73 | index index.html;
74 |
75 | server_name ariel.sheetcoins.com;
76 |
77 | location / {
78 | try_files $uri $uri/ =404;
79 | }
80 |
81 | }
82 |
83 | mkdir -p /var/www/vhosts/ariel.sheetcoins.com/public_html
84 |
85 | nano /var/www/vhosts/ariel.sheetcoins.com/public_html/index.html
86 |
87 | sudo ln -sf /etc/nginx/sites-available/ariel.sheetcoins.com /etc/nginx/sites-enabled/
88 |
89 | systemctl restart nginx
90 |
91 | sudo apt install certbot python3-certbot-nginx
92 |
93 | sudo certbot --nginx -d ariel.sheetcoins.com
94 |
95 | netstat -tulnp
96 |
97 |
98 | ssh -i id_ed25519 root@194.163.148.244
99 |
100 | scp -i id_ed25519 ariel root@194.163.148.244:/var/www/vhosts/ariel.sheetcoins.com/public_html
101 |
102 | ssh -i id_ed25519 root@194.163.148.244
103 |
104 | chmod +x ariel
105 |
106 |
107 | sudo nano /lib/systemd/system/ariel.service
108 |
109 |
110 | [Unit]
111 | Description=Ariel website
112 | After=network.target
113 |
114 | [Service]
115 | Type=simple
116 | Restart=always
117 | RestartSec=5s
118 | WorkingDirectory=/var/www/vhosts/ariel.sheetcoins.com/public_html
119 | ExecStart=/var/www/vhosts/ariel.sheetcoins.com/public_html/ariel
120 |
121 | [Install]
122 | WantedBy=multi-user.target
123 |
124 |
125 | sudo chmod 664 /lib/systemd/system/ariel.service
126 |
127 | sudo service ariel status
128 |
129 | sudo systemctl enable ariel
130 |
131 |
132 | nano /etc/nginx/sites-available/ariel.sheetcoins.com
133 |
134 | server {
135 | listen 80;
136 | server_name ariel.sheetcoins.com;
137 |
138 | location / {
139 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
140 | proxy_set_header X-Forwarded-Proto $scheme;
141 | proxy_set_header X-Real-IP $remote_addr;
142 | proxy_set_header Host $host;
143 | proxy_pass http://127.0.0.1:8081;
144 | }
145 | }
146 |
147 | ln -sf /etc/nginx/sites-available/ariel.sheetcoins.com /etc/nginx/sites-enabled/
148 |
149 |
150 | #listen [::]:443 ssl ipv6only=on; # managed by Certbot
151 | #listen 443 ssl; # managed by Certbot
152 | #ssl_certificate /etc/letsencrypt/live/ariel.sheetcoins.com/fullchain.pem; # managed by Certbot
153 | #ssl_certificate_key /etc/letsencrypt/live/ariel.sheetcoins.com/privkey.pem; # managed by Certbot
154 | #include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
155 | #ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
156 |
157 |
158 | certbot delete --cert-name ariel.sheetcoins.com
159 |
160 |
161 | certbot --nginx -d ariel.sheetcoins.com
162 |
163 |
164 | curl -v ariel.sheetcoins.com
165 |
--------------------------------------------------------------------------------