Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Can this easily be done

  • Yes 1 to 5 hours

    Votes: 0 0.0%
  • Yes 5 + hours

    Votes: 0 0.0%
  • No, there is a better way from the iMac

    Votes: 1 33.3%
  • No, use Azure or AWS.

    Votes: 2 66.7%

  • Total voters
    3

paintstone

macrumors newbie
Original poster
Jul 19, 2019
26
2
Seattle
So I have a 2013 27" iMac and it's connected via a firewire 800 cord and ethernet cord to my airport extreme. I want to know if it can be done (relatively easily) that I can access a PostgreSQL server on iMac imac or the airport extreme from my 13" MBP via an internet connection?

This involves a Machine Learning project in python that I have been coding up the last few years and this idea didnt come up in searches on the site, so I am asking.

There was this old tutorial that I found but not sure if it is relevant, so thank you in advance if you can point this thread to an existing example of what I'm looking for. Does this also highlight the dual challenge that I might need to stop using the airport as both a time machine and PostgreSQL server?

https://forums.macrumors.com/threads/os-x-server-airport-timecapsule.1659908/

Summary TLDR

I have connected my iMac and an airport extreme via firewire and ethernet. Currently, they are acting as a time machine with a 4tb HDD upgrade. Can I start and serve a postgresql database on the airport extreme and access it on my MBP from any internet connection. I'm thinking I can but there must be pages of instruction somewhere, just can't find it.
 

priitv8

macrumors 601
Jan 13, 2011
4,075
654
Estonia
Some thoughts that come to my mind:
  • APX is only capable of file and print sharing, so you won't run PostgreSQL server on it. You could use it as a network storage for the database file. This means - you'd need still another computer to run the SQL server on.
  • APX is a terribly slow file server. It's CPU spends most of the time minding the network and routing tasks.
  • You can access anything behind the APX (or it's network file shares) once you've set up the port forwarding for necessary ports. This needs to be done on the external perimeter router (the one that has its WAN port connected to your ISP).
 

theluggage

macrumors 604
Jul 29, 2011
7,899
8,234
I want to know if it can be done (relatively easily) that I can access a PostgreSQL server on iMac imac or the airport extreme from my 13" MBP via an internet connection?

I'd say that if you want to run a 'home server' accessible from the Internet, from a typical home internet connection, these days some sort of cloud-based server is the answer. Azure, AWS... or you can get a basic virtual Linux server for $5/month from Linode.
  • Typical home internet connections don't include a fixed IP address - you may be able to work around that if your router supports dynamic DNS but its an extra hassle.
  • Your ISP T&Cs may prohibit running a server (its up to you how seriously you take that) or even block certain ports.
  • You'd have to open up ports on your Internet firewall.
  • You might have to faff around with using alternative ports for incoming HTTP requests, etc. which some ISPs might block.
  • Many home connections have an 'upload' rate that is much slower than the headline download rate - which will severely limit your server.
If you do want to go ahead and do it at home, I suspect that PostgreSQL on the Airport Extreme would be a non-starter, so my suggestion would be to run PostgreSQL in a Linux virtual machine on your Mac (VirtualBox is free - Docker is another option - learning curve involved but it could be useful for what you're doing) Set the virtual network connection as 'bridged ethernet' so it shows up as a device on your home network and gets allocated an internal IP address by your firewall/router. Don't enable VM features like shared folders - you want this to be a sandbox that can't touch your Mac.

Set up SSH logins on the VM. Set PostgreSQL to only accept connections from 'localhost'.

Now set your firewall/router to forward incoming connections on port 22 to the (internal) IP address of your Linux VM. So if you SSH to user@your,public.ip it should connect to the virtual machine & let you run pgsql on the command line, or use SSH tunnels to connect a remote copy of PgAdmin etc. You could forward port 5432 for direct connection to Postgres, but friends don't let friends expose unencrypted ports so you'd want to configure Postgresql to exclusively use SSL (...using SSH is probably easier and you're probably gonna need it anyway).

That's letting you access Postgresql - although what I'd assume you want to do is run a web app on the same machine that you accessed via HTTPS (and which talked to Postgresql locally via a Unix socket).
 

Mikael H

macrumors 6502a
Sep 3, 2014
864
539
So I have a 2013 27" iMac and it's connected via a firewire 800 cord and ethernet cord to my airport extreme. I want to know if it can be done (relatively easily) that I can access a PostgreSQL server on iMac imac or the airport extreme from my 13" MBP via an internet connection?

This involves a Machine Learning project in python that I have been coding up the last few years and this idea didnt come up in searches on the site, so I am asking.

There was this old tutorial that I found but not sure if it is relevant, so thank you in advance if you can point this thread to an existing example of what I'm looking for. Does this also highlight the dual challenge that I might need to stop using the airport as both a time machine and PostgreSQL server?

https://forums.macrumors.com/threads/os-x-server-airport-timecapsule.1659908/

Summary TLDR

I have connected my iMac and an airport extreme via firewire and ethernet. Currently, they are acting as a time machine with a 4tb HDD upgrade. Can I start and serve a postgresql database on the airport extreme and access it on my MBP from any internet connection. I'm thinking I can but there must be pages of instruction somewhere, just can't find it.

I’d say an experienced person should be able to achieve what you want to do in a couple of hours. However,
unless you want to present a web service from your home, I would suggest looking into creating a secure VPN from your laptop to your home network or the iMac specifically. The Internet is a dangerous place to host services unless you know what you’re doing. Never present to the Internet services that weren’t originally intended for and designed to be used on potentially hostile networks.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.