oeg-upm / soca

Software Catalog Creator. A repository that given an organization URL, it will create a software catalog for browsing all repositories
Apache License 2.0
12 stars 5 forks source link

Unable to build soca image #117

Closed debkantap closed 4 months ago

debkantap commented 5 months ago

I was trying to build soca image in docker desktop. Edited the installer.sh file to include influxdb configuration. Edited the container_run.sh to configure my repository. The image is not getting build properly. Poping with below error:

Step 14/16 : RUN python -m nltk.downloader stopwords ---> Running in 8c69df305ff4 /usr/local/lib/python3.10/runpy.py:126: RuntimeWarning: 'nltk.downloader' found in sys.modules after import of package 'nltk', but prior to execution of 'nltk.downloader'; this may result in unpredictable behaviour warn(RuntimeWarning(msg)) [nltk_data] Downloading package stopwords to /root/nltk_data... [nltk_data] Unzipping corpora/stopwords.zip. Removing intermediate container 8c69df305ff4 ---> 55db5528867e Step 15/16 : RUN ./installer.sh ---> Running in 60de6f47f4c0 /bin/sh: 1: ./installer.sh: not found The command '/bin/sh -c ./installer.sh' returned a non-zero code: 127

Please help.

TR Deb

dgarijo commented 5 months ago

Thanks @debkantap we'll have a look.

esgg commented 5 months ago

Hi @debkantap !

Are you executing the docker build command from the directory where you clone the repo?

For example: your_path\soca

This is the command you have to use from the soca directory: docker build -t [INSERT_NAME] .

Thanks!

debkantap commented 5 months ago

Hi @esgg yes, I have cloned the soca repo inside "C:\Deb\Working\Poc". then cd into 'soca' , where I have the Docker file and then running the blow command:

docker build -t socadebkantap:latest .

After that I am getting one image, but I think that is not error free, as image tag is none, the build is exiting with code 127 ..

PFA

TR Deb ![Uploading images.jpg…]()

esgg commented 5 months ago

From what I'm seeing, the problem only happens when the image is built in Windows.

The script installer.sh is inside of the container but it can't be executed.

I have replaced the line RUN ./installer.sh for RUN sh installer.sh in the Dockerfile, but appears another error. It seems is related to the if command.

I will continuw working to find a solution for Windows.

esgg commented 5 months ago

HI @debkantap !

I have removed the IF block initializing the databaseToken variable. It doesc't make sense to have this block.

I have checked in a Windows and it works.

Could you check again?

Remember: 1º/ Download the new version of the files (Dockerfile + installer.sh). You can use the git pull command 2º/ Generate the image. Remember to include the option --no-cache to avoid the use of the cache.

debkantap commented 5 months ago

Many Thanks @esgg. Now I am able to build the image. and run the image as docker run -it --network soca_socaNet socadebkantap:latest /bin/bash Let me procced with other steps to generate the portal. I shall update you

TR Deb

debkantap commented 4 months ago

Hello @esgg .

Now I am able to run soca on docker desktop and generate the all artifacts for my github repository. But when I click on the 'index.html' it is not fetching the right data. pls see attached. Pls note that I mapped my local windows directory to the container folder. I am opening from my local windows machine only. I guess this is because of 'path' issue. I have similar issue logged, it that resolves this will also resolve I think. https://github.com/oeg-upm/soca/issues/118 Pls advice.

Also I did setup the influxdb and grafana..there also the dashboard is not coming properly. PFA Pls help.

In addition in the documentation I found few issues:

  1. typo in soca-dash setup it will be "Authorisation" and "Authorization"
  2. in "docker run exec -it [influx container id] /bin/bash" , "run" is not required as it is already running with docker compose command

TR Deb

esgg commented 4 months ago

Thank you for the new issues @debkantap . They are some typos, indeed.

I do not see any attached file. Could you send it again?

I am going to check the related issue #118 .

debkantap commented 4 months ago

sorry ....my bad ..I missed the attachment. Here it is soca-deb

Also the attachment from grafana dashboard ...which is showing nothing!! Bith pointing to same repo. soca-grafana

TR Deb

esgg commented 4 months ago

We are going to focus in the first screenshoot.

Could you run the container again with the previous command "docker run -it --network soca_socaNet socadebkantap:latest /bin/bash"? Then, verify: 1º/ The csv files have been generated (oeg-upm_repos and oeg-upm_metadata). See if they have some content. 2º/ There is an oeg-upm_portal directory and the existance of the card_data.json. This file should contain a json object of each repository analized.

An alternative: After running the docker with the previous command, execute the command "sh container_run.sh" (in the soca directory). Then verify the points 1 and 2.

If everything fails, send me the docker's logs (command docker logs )

Thanks!

debkantap commented 4 months ago

Hi @esgg I have logged in to container with "docker run -it --network soca_socaNet socadebkantap:latest /bin/bash", and then runthe commands as you suggested:

  1. soca fetch -i oeg-upm --org -o oeg-upm_repos.csv -na output is same in both cases. 322 rows
  2. soca extract -i oeg-upm_repos.csv -o oeg-upm_metadata In this case the 'oeg-upm_metadata' directory has 322 folders and 322 json files as expected. This directory was blank in earlier case
  3. soca portal -i oeg-upm_metadata -o oeg-upm_portal yes the card_data.json in 'oeg-upm_portal' directory has the json object of each repository analized. This card_data.json was blank in earlier case.

Now the problem is if I open "/soca/oeg-upm_portal/index.html" in browser, it is not showing the repo cards :)) PFA soca-portal-error

What I am doing wrong here?

TR Deb

dgarijo commented 4 months ago

@debkantap cards are loaded through javascript. By default your browser will block javascript, unless you set up a local server. If you put the example on a github page or you serve the files in a local server you will be able to see everything correctly

debkantap commented 4 months ago

Hi @dgarijo ..u mean I need a web server to run this? I though I will host in on any object storage like minio or s3 Is this a static portal? ..'static' means if I add or modify something on the Git repo/org, then again I have to generate the portal through soca to reflect it on cards portal?

TR Deb

dgarijo commented 4 months ago

The generated portal is static. You can serve it through GitHub pages, see: https://oeg-upm.github.io/soca/example/oeg-upm/index.html as an example. You just need to host the files in order to see the website, because loading JSON is usually disabled in your local machine by browsers. Or set up a local Apache Tomcat server in order to see the results.

You will have to re-generate the cards (cards_data.json file) in order to refresh the contents of the portal

debkantap commented 4 months ago

thanks @dgarijo for the clarification. One more thing, does this code supports only github repo or it will also work with bitbucket, gitlab or azure repo as well?

TR Deb

dgarijo commented 4 months ago

Somef (the tool used to generate the cards) works with GitHub and Gitlab. We have not tested it out with BitBucket or azure, but I think it should work as long as a readme/repo is publicly available.

debkantap commented 4 months ago

@dgarijo many thanks for the input..I will test it in azure repo and post. Can you pls also explain what is the role of soca-dash which uses influxdb and grafana

TR Deb

dgarijo commented 4 months ago

Soca-dash is optional. It provides a dashboard with metrics of the good practices followed by the repositories in an organization. For example, repos with license, repos with citation, repos with descriptions, most used languages, etc. It can be used to monitor the evolution of the best practice adoption in the org. The idea is to regenerate/update the portal once in a while to show the evolution.

Soca-dash has a stable release but we have some updates planned.

debkantap commented 4 months ago

Thanks @dgarijo and @esgg for your support. I am closing this issue. I shall do some experiment of my own and keep you posted if I further face any issue. Many thanks once again. BR Deb