Created
February 10, 2025 10:22
-
-
Save suhailroushan13/59297dcaacc23a8ff52581ddbc2e3b16 to your computer and use it in GitHub Desktop.
Suhail DevOps
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Steps for Deployment WebApp / Websites | |
1.Make sure you have webapp or website is working good at local | |
2.make a GitHub repo and push the code to GitHub without node_modules | |
3.Changes in GitHub Repo | |
- Add Description | |
- Add URL | |
- Add Keywords | |
- Add README.md | |
4. Purchase a domain from (compare which is less) | |
- Namecheap | |
- Hostinger | |
- GoDaddy | |
- BigRock | |
5. Purchase a Cloud Service from a Cloud Platform | |
- AWS | |
- GCP | |
- Azure | |
- Digital Ocean | |
6.Create a Account and Make payment setup in your Cloud Platform | |
7.Open Digital Ocean | |
- Login in your Digital Ocean | |
- Things which are important us are | |
- Droplets, Networking, Billing | |
- Select Droplets ==> Create Droplets (Linux Based Virtual Cloud Server) | |
- Select Region as Bangalore | |
- Choose an Image as Ubuntu | |
- Latest Version | |
- Choose Size | |
- Shared CPU ==> Basic ==> Intel Premium | |
Select per/month | |
Example $16/mo | |
- Choose Authentication Method | |
select password and create root password | |
Example : meraj2006Fatima | |
Select Check Mark : Add improved metrics monitoring and alerting (free) | |
Quantity : 1 | |
Hostname : meraj or omer or ismail or muzzamil or Sneha | |
- Then click on Create Droplet | |
- It will create new droplet for us with a Public IP | |
- Note it down and remember it : 157.245.100.213 | |
8. Click on Droplets | |
- Select droplet and click on more | |
- Select Access Console | |
- Launch Droplet Console | |
9. It will open tab based terminal | |
10. Enter these command | |
sudo apt update && sudo apt upgrade | |
- change suhail to your username as: suhail,omer,sneha | |
sudo adduser suhail | |
sudo chown suhail:suhail /home/suhail | |
nano /etc/sudoers | |
Then add the user below admin user like below syntax. | |
suhail ALL=(ALL) ALL | |
usermod -a -G sudo suhail | |
su suhail | |
cd | |
11. SSH Key Setup | |
cd | |
ssh-keygen -t ed25519 -C "[email protected]" | |
Enter 4 Times | |
cd .ssh | |
cat id_ed25519.pub | |
copy the whole content of public and paste in | |
GitHub ==> Settings ==> SSH & GPG Keys ==> New SSH Keys | |
Paste the key in Key Section and Save it | |
//In Terminal | |
cd | |
git config --global user.name "merajfatima" | |
git config --global user.email "[email protected]" | |
//To Verify : git config --list | |
// Clone Any Repo from your Profilr | |
cd | |
git clone ssh-url | |
Enter : yes | |
12. Connect Cloud to Terminal Preview | |
- Open WSL | |
- cd .ssh | |
- cat id_ed25519.pub | |
- Copy the content of public key | |
// Windows | |
- C:\Users\suhai\.ssh | |
- If no .ssh | |
- open cmd | |
- ssh-keygen -t ed25519 -C "[email protected]" | |
- Enter 4 Times | |
- cd .ssh | |
- type id_ed25519.pub | |
- Copy Public key and paste in authorized_keys of cloud | |
// Cloud | |
- cd | |
- cd .ssh | |
- touch authorized_keys | |
- nano authorized_keys | |
- paste the public key of wsl and Ctrl + O , Enter and Ctrl + X | |
// Open Terminal Preview | |
- Click on Top DropDown | |
- Settings ==> Scroll Down ==> Add a new Profile | |
- Select Ubuntu and Click on Duplicate | |
- Give Name as Cloud Sever | |
- ssh [email protected] | |
- Change the setting and click on save | |
- Open Terminal dropdown and select Cloud Server | |
- Enter Yes | |
- You will cloud server | |
13. Default Packages | |
sudo apt install -y git | |
sudo apt install -y net-tools | |
sudo timedatectl set-timezone Asia/Kolkata | |
sudo apt-get install -y nginx | |
sudo apt install -y snapd | |
sudo snap install core | |
sudo apt-get install -y python3-certbot-nginx | |
sudo snap install --classic certbot | |
sudo ln -s /snap/bin/certbot /usr/bin/ | |
sudo apt install -y python3-pip | |
sudo apt-get autoremove -y | |
sudo apt full-upgrade -y | |
sudo apt install -y gcc | |
sudo apt install -y unzip | |
sudo apt install -y build-essential | |
sudo apt-get install -y manpages-dev | |
14. Node JS Install | |
1.Open Nodejs website | |
2. Click on Top Downloads (LTS ==> Linux ==> NVM ==> NPM ) | |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash | |
Close and Reopen The Terminal | |
nvm install 22 | |
node -v | |
npm -v | |
15.Project Clone & Nginx Setup | |
1. Make sure your project is pushed in GitHub | |
2. open cloud and type | |
3 cd | |
4. git clone ssh-url | |
5. install npm i for server | |
For Nodemon : npm i -g nodemon | |
16.Domain Add Using Script | |
1. Open Digital Ocean | |
2. Open Networking | |
3. Add Domains | |
4. Add Your Domain | |
5. Get your NS Records | |
----------------- | |
Add 2 A Records of your domains | |
www and @ ==> Cloud IP | |
----------------- | |
4) get your NS Records | |
5) Take your cloud NS and Add it in Domain DNS Settings | |
6) Check your NS Records get updated in dnschecker.org | |
18. Nginx Setup | |
0. sudo su | |
1. cd /etc/nginx/sites-enabled/ | |
2. sudo rm -rf * | |
3. cd /etc/nginx/sites-available | |
4. sudo touch domains | |
5. sudo ln -s /etc/nginx/sites-available/domains /etc/nginx/sites-enabled | |
--------- | |
5.1 Visit nginx.suhail.app | |
5.2 add your domain with www | |
example :- suhail.com www.suhail.com | |
and add your port and click on get config | |
5.3 copy the config and paste in | |
5.4 sudo nano /etc/nginx/sites-available/domains | |
5.5. paste it there and check it by | |
5.6. sudo nginx -t | |
5.7 sudo systemctl restart nginx | |
---------------------------------- | |
19. Project Server Starting | |
1. cd repoName | |
2. cd server | |
3. make sure you have nodemon and pm2 | |
if not | |
Command : npm i -g nodemon pm2 | |
4. first check from npm start | |
if everything is working fine | |
5. then type | |
Command : pm2 start app.js --name "App Name : PORT" | |
Commands List | |
pm2 restart all | |
pm2 delete id | |
pm2 restart id | |
pm2 logs id | |
pm2 logs | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment