Node server on Ubuntu - any way to enable access from other hosts without localhost GUI?

So, I am redoing my Node server on Ubuntu. The machine that is running PhotoStructure (PS) not easily accessible with GUI. I am sshing to it. I follow instruction on PhotoStructure | PhotoStructure for Node and before I do ./start.sh I plugged PS_EXPOSE_NETWORK_WITHOUT_AUTH='true" into ~/.profile, logged out, logged back in and did source .profile as well. After starting PS for the first time and waiting a bit for it to built what it needs to I got: PhotoStructure is ready: http://localhost:1787/. Now I am trying to reach this host from another machine and I am getting ERR_CONNECTION_REFUSED. Do I need to login to this Ubuntu box via GUI and give it a kick - aka create library and enable exposeNetworkWithoutAuth in library settings or is there a way to run PS server on Ubuntu in completely headless manner?

Thanks,
Konstantin.

If you’re on a different computer, are you hitting the local IP address of your ubuntu box? You may want to set up either your router’s DHCP server to give your server a static IP address, or set your box to take an IP address that’s outside of the range of dynamic addresses that your router’s DHCP service gives out.

For example, my router at home has a DHCP server that gives out dynamic IPs from 128-254 (like, 192.168.0.129), and I’ve set up static IP addresses for my printer, NAS and server (like, 192.168.0.3 is my printer).

It is setup as static IP on router. This box hosts Plex/Tautulli servers (that are accessed by that static IP as well) and I am sshing to it by IP.

K

What’s the actual IP address of your server? Let’s assume it’s 192.168.1.42

What happens when you try curl https://192.168.1.42:1787 from another computer on your LAN?

You may have installed ipfw or some other firewall ages ago that you’re fighting against. Lord knows this has happened to me…

Both http and https gave ERR_CONNECTION_REFUSED

bash-3.2$ curl https://192.168.1.3:1787
curl: (7) Failed to connect to 192.168.1.3 port 1787: Connection refused

The same host on diff port number (Plex) complains about SSL cert.
bash-3.2$ curl https://192.168.1.3:32400

curl: (51) SSL: no alternative certificate subject name matches target host name ‘192.168.1.3’

I don’t think I have firewalls installed anywhere. Let me try Ubuntu GUI…

K

OK. I went to Ubuntu GUI and added my assets dir to the path. Clicked the button at the bottom of UI. It started scan. Still have no remote access from other LAN IPs. Then I sshed again to Ubuntu box, stopped PS and changed Library settings to exposeNetworkWithoutAuth = true and started PS. Voila! Remote access is working now.

It would be super useful to be able to setup PS on headless server prior to authentication feature implemented. I don’t mind doing my GUI dance when I need to redo the installation, but if it works out of the box - that would be great. :slight_smile:

K

I agree, headless installations should totally be doable.

The code that spins up express doesn’t change if there is a library or there isn’t, so binding to localhost or outbound network ports shouldn’t change. I wonder what’s different between your box and my test machines :thinking:

I am willing to help to compare, but only if it helps others. It does not look like anybody else had these troubles starting PS Node on Ubuntu, so might be isolated to my setup. What’s the proper format for env var for PS? This: PS_EXPOSE_NETWORK_WITHOUT_AUTH=“true”, cause you have I here PhotoStructure | PhotoStructure for Node as “set the environment variable PS_EXPOSE_NETWORK_WITHOUT_AUTH to 1”. Both work?

K

Yeah, 1 and true both work:

export function isEnvTrue(key: string): boolean {
  return isTrue(getEnv(key))
}

/**
 * (Fairly) strict coercion to true.
 *
 * @return false unless `o` is `true` or `1` (or stringifies to "true" or "1")
 */
export function isTrue(o: any): boolean {
  if (typeof o === "boolean") return o
  if (o == null) return false
  if (o === 1) return true
  const s = String(o).toLowerCase()
  return ["true", "1"].includes(s)
}

And while I’m sharing code, here’s the only code that references it:

    this.server.listen(
      this.port,
      Settings.exposeNetworkWithoutAuth.valueOrDefault ? undefined : "127.0.0.1"
    )