UniversalDevicesInc/polyglot-v2

Localhost:3000 not working in Docker

Closed this issue · 6 comments

I grabbed the latest code and ran it verbatim using docker-compose (on Windows). Both mongo and polyglotv2 containers start but I am unable to render http://localhost:3000.

What an I doing wrong?

Thanks

R

You can use
docker logs <container_name>
to see the polyglot logs and help you identify where you are having issues.

I've been running into this issue and have been doing some debugging to figure it out. In my case, the application seems to stop on this step:

Auto Discovering ISY on local network.....

For me, anyway, there definitely seems to be an issue with polyglotv2 not being able to auto-discover my ISY address when it's in docker. I have to assume it's network related, but I didn't dig too much deeper into that.

To try and get past that, I set the ISY_HOST, ISY_PORT, and ISY_HTTPS environment variables in the docker-compose file. However, the portion of the code that skips the autodetection of the ISY host doesn't look at the environment variables in docker: it looks for environment variables stored in the .env file in ~/.polyglot. In the docker environment using that particular docker compose file, i wasn't able to make it work, because there's no mounted volume.

I think you could probably just add something like this:
`volumes:

  • /path/on/host:/root/.polyglot`

and then, put a .env file on your host (/path/on/host/.env) and set your ISY_HOST, ISY_PORT, and ISY_HTTPS values in the .env file. It should skip the auto discovery.

Also, by default, the container wants to run in HTTPS (https://localhost:3000). Since i use SSL offloading, i turned that off (USE_HTTPS=false in the .env file)

Here are my new Dockerfile and docker-compose.yml files. Note a few differences:

  1. Based the build off of ubuntu/trusty instead of debian/stretch. You can use whatever you like there.
  2. Created a new directory on the host (/var/polyglot) and created a symbolic link from /root/.polyglot to /var/polyglot.
  3. Added a volume at /var/polyglot
  4. My .env file looks like this:
    ISY_HOST=my.isy.address ISY_PORT=80 ISY_HTTPS=false

Making that folder a volume means that you will preserve your logs, nodeservers, and SSL across machine up/down and upgrades.

Try using my Dockerfile/docker-compose.yml and see if that helps.

Unfortunately I'm still not able to get anything to render on http://localhost:3000. Using the docker logs command I see that polyglot is starting with the following warnings:

node:6) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(node:6) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:6) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:8) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(node:8) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:8) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:7) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(node:7) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:7) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:6) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(node:6) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:6) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:6) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(node:6) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:6) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:6) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(node:6) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:6) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:8) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(node:8) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:8) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:6) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(node:6) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:6) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:6) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(node:6) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:6) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:7) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(node:7) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:7) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:6) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(node:6) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:6) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:9) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(node:9) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:9) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:8) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(node:8) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:8) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:7) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(node:7) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:7) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:6) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(node:6) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:6) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:8) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(node:8) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:8) Warning: Use Cipheriv for counter mode of aes-256-ctr

Also, I assume you use the COPY cmd in your Dockerfile somewhere to create your .env file. If I shell in and create it manually it's gone later when I run docker-compose up.

I must confess, I'm new to Docker.

Also, I assume you use the COPY cmd in your Dockerfile somewhere to create your .env file. If I shell in and create it manually it's gone later when I run docker-compose up.

I must confess, I'm new to Docker.

No, I manually created the .env file in my data directory on the host. If you're using my docker-compose.yml file to start up the environment, then it's mapping to ~/polyglot. Put a .env file in that folder.

Regarding your errors, I get those warnings. Note that, by default, Polyglot wants to use ssl, so you need to navigate to https://localhost:3000 OR set USE_HTTPS=false in the docker environment (or use your .env file)

@robgarrett , did you ever get this working. I'm in the same boat. I've composed polyglotv2 on three different platforms(synology, linux ubuntu, and my mac) and have the same issue as you on all three.