Skip to content

Instantly share code, notes, and snippets.

@osule
Last active October 16, 2019 16:47
Show Gist options
  • Save osule/e1d732ff8cb7bd8bfdb13157935342ab to your computer and use it in GitHub Desktop.
Save osule/e1d732ff8cb7bd8bfdb13157935342ab to your computer and use it in GitHub Desktop.
Errors encountered in solution setup
  1. First, I ran setup target defined in Makefile as per documentation

    make setup
    

Error logs

 Error response from daemon: OCI runtime create failed: container_linux.go:345: starting container process caused "process_linux.go:424: container init caused \"rootfs_linux.go:58: mounting \\\"/home/beebox/d2d-data-challenge-master/app/init_db.py\\\" to rootfs \\\"/var/lib/docker/overlay2/701b781612fb56ef3bc68cffefa7d7deacd10c9e0957cdd667f00ccc69f88eb4/merged\\\" at \\\"/var/lib/docker/overlay2/701b781612fb56ef3bc68cffefa7d7deacd10c9e0957cdd667f00ccc69f88eb4/merged/data/app/init_db.py\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
make: *** [Makefile:16: initdb] Error 1
  1. Tried getting past this error with the next command

    docker-compose up --force-recreate
    

Error logs

app_1          | for i in 1 2 3 4 5 6 7 8; do echo | nc -q 1 telemetrydb 5432 >/dev/null && break; echo 'DB unavailable, sleeping...'; sleep 3; done
app_1          | pytest app/challenge
app_1          | ============================= test session starts ==============================
app_1          | platform linux -- Python 3.6.5, pytest-3.6.1, py-1.8.0, pluggy-0.6.0
app_1          | rootdir: /data/app, inifile:
app_1          | 
app_1          | ========================= no tests ran in 0.01 seconds =========================
app_1          | ERROR: file not found: app/challenge
app_1          | 
app_1          | Makefile:5: recipe for target 'test' failed
app_1          | make: *** [test] Error 4
d2d-data-challenge-master_app_1 exited with code 2
  1. Attempt to run tests result in error

    make test
    

Error logs

docker-compose -f docker-compose.yml -p d2d-challenge run --rm app test
Starting d2d-challenge_telemetrydb_1 ... done
Error response from daemon: OCI runtime create failed: container_linux.go:345: starting container process caused "process_linux.go:424: container init caused \"rootfs_linux.go:58: mounting \\\"/home/beebox/d2d-data-challenge-master/app/init_db.py\\\" to rootfs \\\"/var/lib/docker/overlay2/5e24a2cb5376cb29a393bf97b60c550af5eb746f7b0fdaa1a4811b1823e0167b/merged\\\" at \\\"/var/lib/docker/overlay2/5e24a2cb5376cb29a393bf97b60c550af5eb746f7b0fdaa1a4811b1823e0167b/merged/data/app/init_db.py\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
make: *** [Makefile:19: test] Error 1
  1. I made changes in the docker-compose.yml based on the error in Step 1 to the following, did step 1 again and got this error

docker-compose.yml

version: '3.7'
services:
  app:
    build: ./app
    links:
      - telemetrydb
    command:
      - test
    volumes:
      - ./app/Makefile:/data/app/Makefile
      - ./app/challenge/init_db.py:/data/app/init_db.py
      - ./app/run.py:/data/app/run.py
  telemetrydb:
    image: postgres:9.6
    ports:
      - 5432:5432

Error logs

telemetrydb [172.18.0.2] 5432 (postgresql) : Connection refused
DB unavailable, sleeping...
python init_db.py
Traceback (most recent call last):
  File "init_db.py", line 1, in <module>
    from resources import config, create_conn
ModuleNotFoundError: No module named 'resources'
Makefile:14: recipe for target 'initdb' failed
make: *** [initdb] Error 1
make: *** [Makefile:16: initdb] Error 2
@r-chauhan
Copy link

r-chauhan commented Oct 15, 2019

Edit 3: I noticed there were few other parameters that might be off in other files, since I realized that the zip-file shared had some outdated references.
Below are the correct values for sections within each file:

  1. volume: section in docker-compose.yml:
      - ./app/Makefile:/app/Makefile
      - ./app/challenge:/app/challenge
      - ./app/run.py:/app/run.py
  1. host= property in dwhdb.ini:
host=telemetrydb
  1. initdb: and test: commands for app/Makefile:
initdb: waitfordb
	python challenge/init_db.py
test: waitfordb
	pytest challenge
  1. References to app/dwhdb.ini in init_db.py, run.py, test_solution.py to be updated to:
'dwhdb.ini'

These changes seem to be a lot and in order to make it simpler I have included zip archive from the latest commit to my solution.

Thanks for your patience and apologies for the mix-up.

@osule
Copy link
Author

osule commented Oct 16, 2019

Thanks for the revision @r-chauhan!

Looks good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment