vhs / api

VHS API - the Hackspace Data Store
4 stars 1 forks source link

Make VHSAPI Docker Image #3

Closed acropup closed 9 years ago

acropup commented 9 years ago

http://api.hackspace.ca needs to be migrated to the Talk server, which uses docker to manage its web services. We'll need to create a docker image of VHSAPI, deploy it to the Talk server, test it, and then reconfigure DNS entries for api.hackspace.ca and isvhsopen.com.

Important setup files: README.md - install notes INSTALL.sh - moves the config scritps below etc/service/vhsapi/run - starts perl service etc/nginx/vhs-api - nginx config

Here is a start to a Dockerfile:

FROM ubuntu         #Not sure what the Talk server is running

RUN apt-get update && apt-get install libexpat1-dev libssl-dev daemontools daemontools-run
#Do we need to apt-get carton as well?
RUN carton install

EXPOSE 3000        #VHSAPI listens on this port
CMD ["api/etc/service/vhsapi/run"]
interlock commented 9 years ago

@acropup Any thoughts on where Redis should be running for this? Ideally another container we link to this one (or pass an ENV indicating where to look).

Taking nginx out, since the machine running talk already runs it and we can route it there. I'll just open up port 3000 like your example shows.

Installing carton and doing carton install takes AGES btw... why perl... WHY?

acropup commented 9 years ago

Yes, ideally it'd be in another container, but I don't know if making that separation is worth the effort at this point.

Regarding the exposed port, I found out that the EXPOSE command is probably not what we want. If nginx is running within a Docker container, then we can continue to use EXPOSE, but otherwise, EXPOSE is unnecessary and we instead need to use the -p flag in the docker run command: > docker run -p 3000 [...] This is because EXPOSE apparently does not expose the port publicly, but only makes it available to other docker containers. -p makes the port public. Either way, I'm pretty sure that nginx is listening on port 80, so we just need to make sure that nginx knows port 3000 by way of the config file api/etc/nginx/vhs-api. If we do use EXPOSE, it should be left as: EXPOSE 3000 rather than EXPOSE 3000 80 (this tells docker that this container is listening on ports 3000 and 80, which is not true)