scancode.io icon indicating copy to clipboard operation
scancode.io copied to clipboard

Setting up on Docker Windows fails at `make envfile`

Open OsmiumOP opened this issue 2 years ago • 9 comments

So I have Docker Windows Setup with WSL 2 also loaded in (Ubuntu 20.04 LTS) On Running the command make envfile, it returns The term make is not recognized... As make is a part of MinGW, I also tried mingw32-make envfile and it returns the error as shown in the attached image.

image

I am not sure if its supported on Windows or not, but the documentation says that its supported using Docker in a small information box. Link - https://scancodeio.readthedocs.io/en/latest/installation.html#local-development-installation

OsmiumOP avatar Feb 02 '22 16:02 OsmiumOP

@OsmiumOP It looks like you've tried that in PowerShell rather than WSL2 Ubuntu-20.04.

johnmhoran avatar Feb 02 '22 17:02 johnmhoran

@OsmiumOP It looks like you've tried that in PowerShell rather than WSL2 Ubuntu-20.04.

Isn't that supposed to be written in CMD when trying to deploy it on Windows? 🤔 How will I make my Ubuntu target to this directory?

OsmiumOP avatar Feb 02 '22 17:02 OsmiumOP

I am no expert in either Docker or ScanCode,io and have only begun to explore this, but here's what I did (after much experimentation ;-):

  • with Docker Desktop installed in Windows 10, launch it and go to Settings>Resources>WSL INTEGRATION and enable integration with your WSL2 Ubuntu-20.04 distro
  • launch an Ubuntu-20.04 terminal (I use Windows Terminal, which gives you access to Ubuntu, PowerShell and whatever else you have)
  • navigate to where you want to install ScanCode.io
  • clone ScanCode.io: git clone https://github.com/nexB/scancode.io.git
  • cd to your new folder: cd scancode.io
  • if you then run make envfile, hopefully you'll see in the terminal something like -> Create the .env file and generate a secret key

My next step was to run docker-compose build but I got an error The command 'docker-compose' could not be found in this WSL 2 distro. I did this back in December and my memory and notes are a bit spotty, but I believe I then

  • ran sudo apt install docker.io
  • confirmed success by running docker --version
  • docker-compose build failed again, but I think sudo docker-compose build worked. This seems to be because Docker requires root to run and you need to use sudo or add your user account to the Docker group so you don't have to run sudo. See, e.g., https://docs.docker.com/engine/install/linux-postinstall/
  • I then encountered some nginx port 80 conflicts, changed the nginx port setting in docker-compose.yml from 80:80 to 8080:80, ran sudo docker-compose up, navigated to http://127.0.0.1:8080/, and voila -- there was ScanCode.io.

johnmhoran avatar Feb 02 '22 17:02 johnmhoran

I tried what you said. make env succeeded, build succeeded and it even went up on Port 8000 without errors. I tried to access it through my Browser and it didn't seem to work image

Then I tried to edit my Docker-Compose.yml file, and I think there is some issue with permissions, but this shows its unreachable. image

OsmiumOP avatar Feb 03 '22 13:02 OsmiumOP

Hi @OsmiumOP . Looking at your screenshots, several thoughts come to mind.

  • It looks like you're trying to reach a scancode.io installation on your Windows side -- /mnt/c/Users/minio/scancode.io. My understanding is that the WSL2 folks strongly recommend installing the relevant code inside your Ubuntu distro. That's the approach I've taken and recommended in my earlier comment. In other words, when you start the process by running git clone https://github.com/nexB/scancode.io.git, you'd pick a location like /home/[your Ubuntu-20.04 username]/dev (just an example -- your directory structure may differ) and clone the repo there.

  • The URL you are using is http://0.0.0.0:8000. I've been able to launch and view ScanCode.io with http://127.0.0.1:8080/, which for you might be http://127.0.0.1:8000/ if you're using port 8000. Not sure, and in any event I suspect in the first instance you need to clone the repo inside your Ubuntu instance.

Hope this is helpful, and please don't hesitate to followup as you work through the installation process.

johnmhoran avatar Feb 03 '22 19:02 johnmhoran

@OsmiumOP for a dev setup, once you have your setup working in WSL2 this may be enough : https://scancodeio.readthedocs.io/en/latest/installation.html#local-development-installation

pombredanne avatar Feb 04 '22 07:02 pombredanne

Finally I am able to setup Scancode.io. All thanks to @johnmhoran and @pombredanne .

Still I would like that it should be deployable on Windows some direct way. I am interested in working on it too.

OsmiumOP avatar Feb 05 '22 09:02 OsmiumOP

How is it possible to edit the files and do some dev work on this repo as the files are not accessible directly from windows explorer? @johnmhoran

OsmiumOP avatar Feb 08 '22 07:02 OsmiumOP

Hi @OsmiumOP . If you cloned scancode.io into your WSL2 Ubuntu-20.04 distro as I described above . . .

  • navigate to your cloned scancode.io repo, e.g., cd /home/[yourusername]/dev/scancode.io
  • you can access the files directly if you really want to through File Explorer: explorer.exe . -- don't forget the final .

I have not yet tried any dev work in scancode.io, but I use Visual Studio Code in my WSL2 Ubuntu-20.04 distro extensively for Python and other development.

  • With VSCode (installed on the Windows 10 side), you can install the Visual Studio Code Remote - WSL extension and use VSCode to work with code in your Ubuntu distro. You'll probably want to research a few articles for the details -- sorry to say I have none to offer now off the top of my head but there are many good resources via a little googling or duckduckgoing.
    • With that extension installed (and I might have had to do a little configuration, don't recall atm, but it was a very straightforward installation), I open VSCode by simply running code . -- and again, there's that trailing . -- and VSCode opens whatever repo/folder I'm launching it from.
  • There's also a Visual Studio Code Remote - Containers extension which might be useful. I have it installed but I don't recall having taken it for a spin yet -- I'm still new to the world of containers. If you end up using this and find it helpful, please share your experience here. ;-]

As I mentioned above, I have not tried any dev work in scancode.io, so there may be more to setting up your scancode.io dev environment than I summarized above, e.g., perhaps a virtual environment (or whatever the container equivalent is). And as @pombredanne suggested a few days ago, the ReadTheDocs may also be helpful.

johnmhoran avatar Feb 08 '22 08:02 johnmhoran