-1

I am trying to build a web application for a local community. I'd like to host a postgres database, a SSR frontend server, a REST backend server. The internet and electricity are pretty cheap here and I have a PC lying around. I have a few hard disks and I can raid them for redundancy. A similar spec AWS machine comes out to 170 USD and I think I can do much cheaper than that. I don't expect the application to scale to any level for the forseeable future (50 concurrent users max, same region). The only problem is that I don't have a static IP. IPv6 routing is not prevalent in my area. I can go for simpler BaaS but I want to learn as well.

I have a server on linode (single shared core, 1 GB RAM) with a static IPv4. How can I host everything on my local machine (maybe multiple KVM machines) and serve everything to people?

I have used this script to setup wireguard servers before. Can I use something like `nginx? Are there alternatives? How will my whole setup look like? If I were to use separate virtual machines for frontend, backend and database, how should I network them?

I understand there are many ways to approach this problem, I'm trying to get a feel of "if I can do it". I'd be happy if I can host my own server.

7
  • I do something similar using WireGuard to connect my local machine to a cloud VM. Then I use Apache to proxy requests to systems on the other side of the WireGuard network. However, I do not recommend this for a production quality setup. It does work for a low cost solution. You can easily replace Apache with Nginx. To ensure the connection from the cloud VM to the local machine stays up, use some kind of software on the local machine that pings/talks to the cloud VM on a periodic basis like once per minute. When your local IP address changes, WireGuard on the cloud VM will then see the change Mar 19, 2023 at 4:14
  • Do you recommend using separate VMs for frontend, backend and database? @JohnHanley Mar 19, 2023 at 4:41
  • The question is off topic, this site is for business environments. Just a hint, you don't need to rent any server, you only need a dyndns service. Mar 19, 2023 at 5:13
  • I knew dyndns exists, it has been unreliable for me always. And forwarding specific ports is annoying. I am trying to run a business indeed (maybe a very small one) and I need some help in setting up servers. Isn't that what serverfault is about? Maybe my question is not focused enough. Sorry about that. @GeraldSchneider Mar 19, 2023 at 5:33
  • The answer is "it depends". For small workloads, you can easily fit everything on one system. The best deployment/design depends on usage requirements and reliability goals (and other factors such as security, isolation, build-your-own versus managed services, etc). Note: I prefer WireGuard to a dynamic IP service because the traffic is encrypted and the ISP does not know what services you are self-hosting. Mar 19, 2023 at 5:50

3 Answers 3

0

Ignore the server you have. Useless. Use Cloudflare Tunnel and you are done. A small docker level agent initiates all necessary connections to cloudflare and acts as router.

Another more general setup would be to use the linode server as a router and then establish a vpn from your server to it - I ran a company behind residential internet for ages like that (not the website, but people dialling in), for there was no real way to get anything else at that time... stupid limitation in some areas and countries.

2
  • I'll try the cloudflare tunnel, seems they have a free plan. I'm looking more towards the second approach. Seems a bit more independent. Mar 19, 2023 at 9:21
  • It is also more work and requires maintenance of multiple systems. If you want tohave the VPN done easy and transparent, check out ZEROTIER.
    – TomTom
    Mar 19, 2023 at 9:51
0

It was possible with wireguard and nginx. Right now, the linode server has an ip address of say, 123.123.123.123 and the linode server has a wireguard ip address of 10.66.66.1. If my local server is connected to the same wiregaurd network, it has an ip of 10.66.66.10. Based on this answer, I created an nginx config

stream {
        upstream ssh1 {
                server 10.66.66.10:22;
        }
        server {
                listen 4575;
                proxy_pass ssh1;
        }
}

Now, if I ssh with ssh [email protected] -p 4575, the ssh connection is proxied by nginx to my local server. I think I can expose whatever service I want this way with nginx.

Ideally, I'd like to have a separate domain for my local server eg. (server1.example.com) and all connections go directly to the local machine. Let me know if that's possible.

-2

Connect to the cloud server: Using a remote access tool like SSH, connect to the cloud server and configure it to retrieve the content from the local server. You can use a tool like rsync to transfer the content from the local server to the cloud server.

Serve the content: Once the content is transferred to the cloud server, configure it to serve the content to clients. This can be done using a web server like Apache or Nginx, or any other server software that can serve the content.

server's network to serve local server's content, making it accessible to clients from anywhere in the world. However, it's important to ensure that you have proper security measures in place to protect the content and prevent unauthorized access.

1
  • Not answering the question - if the OP wanted to push the content, he would not ask how to serve it from local.
    – TomTom
    Mar 19, 2023 at 9:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .