examples icon indicating copy to clipboard operation
examples copied to clipboard

DEVX-2039: Microservices Orders demo fails on Ubuntu 18.04

Open russau opened this issue 3 years ago • 4 comments

Problem 1: elasticsearch container exits with a bootstrap check failure. Easy fix: set discovery.type: "single-node".

Problem 2: getting a permission denied writing to the logs folder in run-services.sh. This one comes down to different permissions for bind mounts in Docker on Linux and macOS. More on the way macOS docker works here.

On MacOS the streams user is the owner:

$ docker-compose exec microservices bash
streams@ac2c18b87e83:/build$ ls -la /opt/docker/
total 12
drwxr-xr-x  5 root    root    4096 Sep  3 03:04 .
drwxr-xr-x  1 root    root    4096 Sep  3 03:04 ..
drwxr-xr-x  2 root    root    4096 Sep  3 03:04 config
drwxr-xr-x 11 streams streams  352 Sep  1 03:38 logs
drwxr-xr-x  7 streams streams  224 Aug 31 04:08 scripts

On Linux the host user's id is the owner:

$ docker-compose exec microservices bash
streams@c07c5d12fa0b:/build$ ls -la /opt/docker/
total 20
drwxr-xr-x 5 root root 4096 Sep  3 02:53 .
drwxr-xr-x 1 root root 4096 Sep  3 02:53 ..
drwxr-xr-x 2 root root 4096 Sep  3 02:53 config
drwxrwxr-x 2 1001 1001 4096 Sep  3 02:46 logs
drwxrwxr-x 2 1001 1001 4096 Sep  3 00:43 scripts

Including a step to change the ownership of the logs folder on the host would fix it i.e.

cd examples/microservices-orders
git checkout 5.5.1-post
# If you are working on a Linux host change the ownership of the logs folder to allow the user in the microservices container
chown 999 logs 

I've also added a test to the run-services.sh to check permissions and send logs to /tmp if needed. These two commits will get the demo working on Linux. The chown 999 logs change to the instructions is up for debate.

Was an interesting thing to dig into! This will happen anywhere we have a non-root user container trying to write to a bind mount. We hit the same issue in training with the UBI containers.

russau avatar Sep 03 '20 23:09 russau

Tested on mac and linux

image

image

russau avatar Sep 04 '20 00:09 russau

@russau @rspurgeon ping on this PR to refresh a review or close?

ybyzek avatar Dec 01 '20 15:12 ybyzek

@russau @rspurgeon ping on this PR to refresh a review or close?

I've verified this PR works on macOS and CP 5.5.1 & 6.0.0

rspurgeon avatar Dec 01 '20 19:12 rspurgeon