getavalon / docker

Avalon in a Dockerfile
MIT License
5 stars 2 forks source link

Demo #3

Closed tokejepsen closed 6 years ago

tokejepsen commented 6 years ago

Going through the demo, and getting this slightly mysterious error:

A:\>avalon --import batman
Error: Please change your current working directory
A:\
tokejepsen commented 6 years ago

Next after that comes this error:

C:\Users\admin\batman>A:\avalon.bat --import batman
error: requires 'mongoimport' to be on your PATH
mottosso commented 6 years ago

It's a limitation of the avalon executable having the same name as avalon the Python package. Python will look for modules in the current working directory, so you can't be in the directory of the executable whilst using it.

$ c:
$ a:\avalon --import batman

It's a limitation, was considering renaming the exe to ava or the like.

mottosso commented 6 years ago

error: requires 'mongoimport' to be on your PATH

This is where we need to update the exe for this repo. The original file assumed Mongo would be installed. Now instead it is running in Docker.

tokejepsen commented 6 years ago

It's a limitation of the avalon executable having the same name as avalon the Python package. Python will look for modules in the current working directory, so you can't be in the directory of the executable whilst using it.

Maybe we should start with elaborating on the error message?

mottosso commented 6 years ago

I'd rather get rid of the error, to be honest. Let's call it ava.py? "The Avalon CLI"?

tokejepsen commented 6 years ago

Or avalon_cli.py?

mottosso commented 6 years ago

On Linux, the Python file is also the executable and it'd be preferable if it's something short and sweet. Something you wouldn't mind typing over and over.

Alternatively, we could call it that, and have a .bat and .sh executable for calling it on the command-line on either platform.

tokejepsen commented 6 years ago

On Linux, the Python file is also the executable and it'd be preferable if it's something short and sweet. Something you wouldn't mind typing over and over.

Ohh, I thought this was the entry point for Linux/Mac?

mottosso commented 6 years ago

Yeah, it can be, I've included both to support shells other than Bash, shells that support running Python as-is. But we can limit support to Bash for the time being.

tokejepsen commented 6 years ago

This is where we need to update the exe for this repo. The original file assumed Mongo would be installed. Now instead it is running in Docker.

The error originates from the examples project. Could you point in the direction of an alternative?

mottosso commented 6 years ago

The example is calling on mongoimport which is an executable added to your PATH when installing mongo. Now that Mongo is in a container, we need to instead call docker exec getavalon/docker /usr/bin/mongoimport (with it full path) with similar arguments.

The container has access to the resources (A:\) at /avalon.

tokejepsen commented 6 years ago

Now that Mongo is in a container, we need to instead call docker exec getavalon/docker /usr/bin/mongoimport (with it full path) with similar arguments.

That would assume you have access to docker in the examples project. Is that not cross pollution?

tokejepsen commented 6 years ago

Just had a successful brief run-through on David's fork.

This does not need mongoimport, and works with the Docker container.

mottosso commented 6 years ago

Cool, that sounds a lot better.

tokejepsen commented 6 years ago

https://github.com/getavalon/examples/pull/1

tokejepsen commented 6 years ago

I accidentally pushed changes directly to the repository to fix this issue: https://github.com/getavalon/docker/commit/745130eaad4982a01cd384c3d64ee7f76c008ef8