sarkonovich / Alexa-Hue

Control Hue Lights with Alexa
131 stars 28 forks source link

Add docker as server-side installation option #8

Closed jpeffer closed 8 years ago

jpeffer commented 8 years ago

While my Docker experience equates to the sum total of a few hours, I threw together a dockerfile for getting the server-side component up and running. It can be found here https://hub.docker.com/r/jpeffer/docker-alexa-hue.

Docker toolset, along with Kitematic, can get things up and running quite easily. If using Kitematic, set the externally mapped port under the container's settings, otherwise a random port will be used every time the container restarts.

sarkonovich commented 8 years ago

This is awesome. I'm going to try to get this up and running. I does seem like it would shortcut lots of installation headaches...Thank you!

jpeffer commented 8 years ago

Next stop, ngrok. There is a ngrok v2 container available I started playing with tonight. If you follow the instructions above and start the docker-alexa-hue container, you can open a docker CLI instance and run the following to set up ngrok:

$ docker run --rm -it --link docker-alexa-hue wernight/ngrok ngrok http docker-alexa-hue:4567

Other advanced ngrok configuration settings can be found here.

sarkonovich commented 8 years ago

This is great! Thanks.

I spent a few minutes looking into Docker the other day. But it would be really helpful if you write just a few lines about getting started with it, e.g., the step required to run the docker commands.

People still struggle with all kinds of Ruby installation issues. That's the biggest roadblock to getting this going. I'm hoping the docker route makes things easier!

jpeffer commented 8 years ago

Docker Setup

  1. If on Windows or OSX download and install Docker Toolbox otherwise follow instructions for your OS
    • Default installation settings most likely adequate
    • Select Yes if prompted to install additional drivers
  2. Open Docker Quickstart Terminal
    • Again, select Yes if prompted
  3. Run the following commands in the Docker CLI terminal
    • docker run -itdP --name=docker-alexa-hue jpeffer/docker-alexa-hue
    • docker run --rm -it --link docker-alexa-hue wernight/ngrok ngrok http docker-alexa-hue:4567
  4. Copy the HTTP or HTTPS Ngrok URL for use with the lambda function

That should do it!

sarkonovich commented 8 years ago

Awesome. I'm going to run through the install myself, and then integrate these instructions into the readme. I looked into running Docker on a Pi, and it's more complicated than just installing Ruby. So, I'll make a Debian image for that. Between the docker container and the image, things should be much easier!

jpeffer commented 8 years ago

Yea, for now an image for PI would be easiest. Once there is an easy way of getting docker on a raspberry pi, it should be fairly simply to create a dockerfile with a different base image that is ARM compatible. Probably need to pick one up one of these days. Let me know if you run into any issues.

sarkonovich commented 8 years ago

Okay! I got this up and running super fast! One question, for the docs: what's the easiest way to stop and restart the process? Suppose the sinatra server crashes. How does the user "reboot" the thing.

In particular, we need to be able to get back to the new ngrok address....

Thanks again for this!

jpeffer commented 8 years ago

Nice! The command above leaves the docker terminal attached to the ngrok container, so the ngrok address should be visible, along with introspection. If the tunnel fails or times out, a simple ctrl+c will shut it down. From there, just run the command again.

If there is an issue with the Sinatra process container, since it is running in the background, you need to stop the container first. Just run the following:

docker stop docker-alexa-hue

After it shuts down the container, simply run the first command again: docker run -itdP --name=docker-alexa-hue jpeffer/docker-alexa-hue

sarkonovich commented 8 years ago

Readme updated with Docker install instructions.