sahilrajput03

Deployment

port forward with router

Thats how I have configured some port and port ranges on my system.

image

Vercel recommends pusher.com for deployment of realtime apps(i.e, requiring websockets (socket.io)

Source: A comment on this stackoverflow answer

https://vercel.com/guides/deploying-pusher-channels-with-vercel

Github Pages

Add below A records for your custom domain dns setting in your domain provider panel.

185.199.108.153
185.199.109.153
185.199.110.153
185.199.111.153

Heroku

Why heroku?

Heroku provides https enabled backend server in no time which is too good for no-budget apps testing. You can create as many applications as you want with the condition that you can have only 5 apps in one account and you can create infinite heroku accounts with emailId+1@email.com hack. Yo!

You can serve a nested folder project in heroku using a custom build-pack as well. Find it working @ video-chat-app-webrtc and also @ sahilrajput03/learn-websockets

Heroku has database as a service as well. Check here.

See my command list @ Gist.

TEKENA’s way of deploying a nested folder: image

image

Dns Settings

I have ports 80, 8080, 3000-to-3010 mapped to my linux machine currently. Also for pi I have mapped port 22.

FYI: Every ddns domain expires in 30 days.

http://master61.ddns.net points to my public ip using https://www.noip.com/ service.

I registered http://master61.ddns.net on 26 April, 2022 most probably or on next day.

DDNS is only available for A records not CNAME records.

For domains:

http://wwww.servicelife.ml, http://wwww.fixedlife.ml, http://wwww.lostlife.ml I DNS settings as:

Name Type TTL Target
www CNAME 3600 master61.ddns.net

And that maps all ports, i.e., if I have port mapped 80, 3001, 3002 and so on.., on via my router to some local machine then I would be able to access all these ports via each of these sites i.e., @ http://wwww.servicelife.ml:3001, http://wwww.fixedlife.ml:3001, http://wwww.lostlife.ml:3001. For port 80 we don’t need to specify the port at all. Source.

NOTE: You won’t be able to acces via root level domain though, coz thats not possbile. For more info read “You cannot set cname for root level domain i.e., …” from “Oher DNS records related information” section.

Getting ssl certificate setup with express

For working example of below generated certificated, you can check here.

# src: https://archlinux.org/packages/community/any/certbot/
pacman -S certbot

# Usage
# NOTE1: Make sure that you have mapped your desired domains to current machine via ddns domain (or <have'n tried this way though> direct A record to your public ip)
# NOTE2: Make sure no app is running at port 80 till the below certificate generation process is complete.
sudo certbot certonly --standalone
# src: Official certbot Docs: https://certbot.eff.org/instructions?ws=other&os=arch

##### Generating combined files for multipe domains: When asked for multiple domains you can enter below line(without hash obviously):
# www.servicelife.ml www.fixedlife.ml www.lostlife.ml
# Now all below should have valid certificates coz above generated files will have certificates for all these domains:
# https://www.servicelife.ml/
# https://www.lostlife.ml/
# https://www.fixedlife.ml/

image

Above certificate is valid for 90 days and you can renew the certificate manually or you can set it to auto update using their own solution for that. Check above src in the code to find how to setup autonew ssl certificates.

Fyi: Certbot is powered by LetsEncrypt.

Another fee ssl provider for lifetime is sslforfree.com

Q. How many ssl certificates can I produce using certbot:

Short Answer: No Limit (or atleast enough for personal use)

Q. Why doesn’t my domain doesn’t work without ‘www.’?

Short answer: You can’t use CNAME record but A record to resolve the issue. Reference from FREENOM Docs - Click here

What is DDNS ?

DDNS: Dynamic DNS for updating public ip via router’s firmware feature or using some software on system that updates the ip for the domain. Read from Google’s support article.

I can setup my noip’s domain account to be in sync with my current public ip via DDNS (Dynamic DNS) settion via router settings and its available via my router. Yo!

FYI: I tracked the http requests via browser to change the A record and pruned them (works 100%) and saved them in a repository - Freenom DDNS.

Amazing video, below screenshot is from by no-ip’s: https://youtu.be/EH8wJt81bqg

image

Amazing(This way of updating works really awesome i.e., the ip address is updated on the start of the router i.e., whenever the ip changes).

DDNS function works AWESOME!!

From my current router firmware vvv

image

image

Setup free dns service with http://www.cloudns.net

Source (Please check if the nameservers have changed? It took me complete day to find out that it has been changed recently): https://www.cloudns.net/wiki/article/355/

Amazing guy helped: Using cloudns and attaching domain with nameservers(time-stamped): @youtube-hatsoff

# Add below ns (nameserver) records to BOTH YOUR FREENOM nameservers and to cloudns's zone nameservers(they are there by default at the time of creation of MASTER DNS zone, you must have consistent nameservers in both the places else the domain records **won't work**):
ns41.cloudns.net
ns42.cloudns.net
ns43.cloudns.net
ns44.cloudns.net

### (^^ above should work for newer accounts though) FYI: For my older account (sr03@gmail.com on cloudns) having dns for domain `pintak22.ml`, ^^ above new nameservers are not available so I have to use old nameservers only that are available for that account which are shown as below. I came to know about this after talking to "Live Chat" service from cloudns.net agent only (the service and experience is really great for free accounts as well as I observerd).
ns101.cloudns.net
ns102.cloudns.net
ns103.cloudns.net
ns104.cloudns.net

Chat to cloudns service suppport?

Simply go to this url @ https://www.cloudns.net/livechat/. You can go to this page by clicking on “Online - Live Chat” box in the bottom right of the cloudns website easily.

In the below screenshot dns settings we can use see the wildcard subdomain of CNAME record type (i.e. *.fixedlife.ml) BUT you may use an A record (also shown how to do that in later screenshots and we’ll also setup DDNS url to get the IP address updated automatically using cron) instead if you want to map an ip to the domain instead of master61.ddns.net.

BELOW IMAGE DNS RECORDS WORKS 100% AS EXPECTED.

For freenom nameserver-

image

For dns records @ cloudns.net-

image

In above screenshot, 4 nameserver should only be created like shown below. They are only required for root domain only.

image

A redirect for root level domain so it always goes to www path along with path supplied -

image

A wildcard CNAME record to handle all the subdomains by ourself in the server -

image

ALSO: We can use A record for wildcard entry to handle all the subdomains by ourself in the server (DIRECT IP ADDRESS, we’ll update this using cloudns’s ddns url service) -

ALERT: Use only one of A record or CNAME record to handle the wildcard subdomain entry.

image

Q. But how would we ensure that public ip is always in sync with my real public ip ?

Ans. We can do setup ddns service by clicking that button to get the DDNS url which we can call each hour using crontab to update our public ip address to the A record-

image

For direct freenom domain to CNAME (master61.ddns.net)

You can use CNAME like below **(disadvantage is we can’t redirect top level domain and we can’t use wildcard subdomains for redirection as well as we used with cloudns).

image

This is great site for checking current dns setting of a domain: https://www.dns.computer/check/pintak22.ml .

Dynamic dns for cloudns: To be done so that i may update my A record to point to my public ip directly using their ddns service (INSTEAD of current setup i.e, using cloudns’s domain as cname for each of the domain I have) leveragin @ https://www.cloudns.net/wiki/article/36/

Fyi freenom domains work good with pwa install popups ?

Yes, absolutely. The key thing is that you must know how to debug pwa Installer Popup with lighthouse and fulfill those requirements. The thing I was haivng issue on this day(1 June, 2022) is that I was not adding a service worker to the app and that was necessary to get Installer Popup work as informed by the Lighthouse debugging in chrome devtools. image

Direct domain to vercel hosting

NS1.VERCEL-DNS.COM
NS2.VERCEL-DNS.COM

image