randomwalker-io / random_walker

This is the repository for the web application Random Walker
2 stars 1 forks source link

Implement the full Random Walker Application in one single Docker container #105

Closed mkao006 closed 8 years ago

mkao006 commented 8 years ago

The last implementation did not have the Random Walker Engine.

We will deploy with a single Docker container before using Docker Compose.

mkao006 commented 8 years ago

The image was built successfully at bf0547dc556a829e18e9b9aa93112997771ad4e3.

We now need to understand how to point the web client to the container when it is running. Also the Nginx may not be configured correctly.

mkao006 commented 8 years ago

Also review the Dockerfile, check whether packages such as setuptools are required and also maybe mount the static file in a different way.

mkao006 commented 8 years ago

Need to reconfigure the Dockerfile for postgres

mkao006 commented 8 years ago

The postgres/postgis reconfigured and installed in dc83a74718335415a62537beefc597404d7757c3

mkao006 commented 8 years ago

The build seems successful, but we need find how to point the client to the image when launched,

mkao006 commented 8 years ago

This answer shows how to host the container on local host http://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach

and maybe here http://blog.oddbit.com/2014/08/11/four-ways-to-connect-a-docker/

mkao006 commented 8 years ago

We can expose the port on the to the local host via

sudo docker run -d -p 8080:8000

However, it gave 502 bad gateway error suggesting that the uwsgi did not start.

mkao006 commented 8 years ago

After additional investigation, it would appear that the socket does not have the write permission. The owner group should have been set to www-data appears to be root, this means the connection can not be made I believe and resulted in the 502 gateway error.

mkao006 commented 8 years ago

Further, although there is a file called random_walker.sock but the file type is - instead of s for socket. This might be another source of error.

mkao006 commented 8 years ago

The socket problem is fixed when running uwsgi directly

uwsgi --emperor /etc/uwsgi/sites --gid www-data&

but it seems the local host is still not connected to the docker container.

mkao006 commented 8 years ago

We have confirmed that the localhost can now connect with the Docker container, as we have mounted the logs which reflects the access. However, we have a new error.

2016/07/08 22:25:03 [error] 52#0: *1 upstream prematurely closed connection while reading response header from upstream, client: 172.17.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "uwsgi://unix:///srv/random_walker/random_walker.sock:", host: "localhost:8080"
mkao006 commented 8 years ago

This bug is due to the uwsgi not luanched correctly. After installing the uwsgi plug in at 9b8f05db002f7e083f3891661f06d1185466a754 and also explicitly define the plugin at 01cb234e32557f94c8ac4506a1f8a3830496fc27 the uwsgi is serving the website correctly now.