Search code examples
spring-bootnetwork-programmingserverdnsip

How to set up raspberry pi DNS with static IP from internet provider



I want to be independent from hosts and their fees with raspberry pi for small projects.

What I'm trying to do

  1. Create a spring boot app which would be accessible from domain
  2. Make it work with https via Certbot and Let's Encript
  3. have a subdomain on it like console.mydomain.com or admin.mydomain.com

What I can do:

  1. Buy static IP address from Internet provider
  2. Buy domain and set it to point to the static IP
  3. Buy Raspberry pi's
  4. Program Spring boot + Thymleaf + Vue ( Not that I can't program in anything else, I have chosen this stack for small projects )
  5. Have access to the router

What I don't know:

  1. After I bought the static IP, what do I have to do in the router, if any
  2. If only I install certbot on Raspberry pi will it work and make my spring boot work with https? ( Along with spring configs... )
  3. After I configured the router, in order to create subdomains for my projects or DNS server, what should I do ( By subdomain for DNS I mean e.g. dns.amazon.org but with my domain )


Thank you in advance for your patience


NOTE: Please do not send links which doesn't have full answer and if you do Please provide the rest in your answer

What I know:

I think I should setup a dedicated Raspberry pi for DNS server but for most of these kinds of projects I'm responsible for, there is only one Raspberry pi. So let me know if I can do all in one as well.


Solution

    1. You will need to setup "port forwarding" on the router to the raspberry pi. There are lots of guides to doing this on the internet and will likely be specific to your router.

    2. I'm not sure of Spring boot can be configured with HTTPS as I've never used it. However if you use NGINX as suggested below, you can add SSL to the config quite easily.

    3. If you want multiple projects running, look at setting up NGINX and configuring a reverse proxy.

    A reverse proxy means that all your sites can have different URLs, but come to the same service / IP address. NGINX will then filter them out and point them on to the correct destinations.

    Documentation for reverse proxy: https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/