stevenleeg / geemusic

A bridge between Google Music and Amazon's Alexa
GNU General Public License v3.0
665 stars 181 forks source link

Dynamic DNS issue #78

Closed Shaun87 closed 7 years ago

Shaun87 commented 7 years ago

Good day

I am using a dynu.com DNS and can access my pi from another pc outside my network. When I go to [my_addr].dynu.com:4000 I can see on the geemusic server that it was accessed. But when I do the Ask Gee Music test on amazon, It says the server is unavailable. My port forwarding is on.

I tried ngrok and it works, but I would prefer using my DDNS.

Any idea where I have gone wrong?

leaskovski commented 7 years ago

I have this working on my rig. I have geemusic running on a default port, and then I use nginx to act as a HTTPS forwarder to the geemusic 4000 port. I also use nginx to provide my Cert which is required by amazon.

Alexa doesn't like custom skills that point to a port other than 443, so on the skill on the amazon dev site, you can't use https://my.url.com:4000/alexa

Shaun87 commented 7 years ago

I am still struggling, I am a total noob.

I don't know where to start with nginx, do I need to set up a HTTPS Proxy server? I have apache2 on my pi, can I use it rather than ngnix? I have used openssl to create certificates following Amazon's instructions (https://developer.amazon.com/appsandservices/solutions/alexa/alexa-skills-kit/docs/testing-an-alexa-skill#create-a-private-key-and-self-signed-certificate-for-testing)

Thank you

leaskovski commented 7 years ago

A self created certificate won't work this as I had that problem, so I went down the route of using LetsEncrypt to provide that.

With regards to nginx, all I did was to install it using good old apt-get, and then I added a conf file into the /etc/nginx/conf.d directory with the following config...

server {
    listen       443 ssl;
    server_name  your.url.com;

    ssl_certificate      /etc/letsencrypt/live/your.url.com/fullchain.pem;
    ssl_certificate_key  /etc/letsencrypt/live/your.url.com/privkey.pem;

    ssl on;

    location ~ /alexa {
        proxy_pass          http://127.0.0.1:4000;
        proxy_read_timeout  90;

        proxy_redirect      http://192.168.0.20:4000 https://your.url.com;
    }

    location ~ / {
        return 301 http://www.google.com;
    }
}

I don't know why i mix'n'matched with the internal IP address of my PI (127.0.0.1 and 192.168.0.20), but you can either do the same, or just use 127.0.0.1.

This all works for me.

The main headache I had was getting certbot (LetEncrypt) to work properly to create my cert.

Shaun87 commented 7 years ago

Thank you so very much. You are awesome

leaskovski commented 7 years ago

Im assuming you got this working then?