skohub-io / skohub-vocabs

A lightweight tool to publish SKOS Vocabularies
https://skohub.io/
Apache License 2.0
32 stars 25 forks source link

217 separation of vocabs and webhook #244

Closed sroertgen closed 1 year ago

sroertgen commented 1 year ago

I separated the skohub webhook part from skohub-vocabs since these are two distinct services though the webhook makes use of SkoHub Vocabs. The webhook is now living in https://github.com/skohub-io/skohub-webhook

The webhook is now using the docker image of SkoHub Vocabs to build the vocabularies. So it is not necessary anymore for the webhook to have the latest SkoHub Vocabs repo nearby to build the vocabs.

In order to make this work and avoid permission issues it was also necessary to modify the Dockerfile. It is now run by the node user, which should be better anyway than running as root.

Also tests and scripts that are not related to SkoHub Vocabs were moved to SkoHub Webhook.

sroertgen commented 1 year ago

@dr0i @Phu2

I assign you as reviewers, because these are major changes regarding current deployment of the SkoHub Webhook service which we should discuss before merging.

Phu2 commented 1 year ago

I think we don't need the listen script anymore: https://github.com/skohub-io/skohub-vocabs/blob/217-separation-of-vocabs-and-webhook/package.json#L68

Phu2 commented 1 year ago

Tested on my local machine and everything worked fine!

dr0i commented 1 year ago

Trying this following the README's docker section (sudo docker run -v $(pwd)/public:/app/public -v $(pwd)/data:/app/data -v $(pwd)/.env:/app/.env skohub/skohub-vocabs-docker:latest) I got:

docker: Error response from daemon: failed to create shim: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/home/pc/git/skohub-vocabs/.env" to rootfs at "/app/.env": mount /home/pc/git/skohub-vocabs/.env:/app/.env (via /proc/self/fd/6), flags: 0x5000: 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. ERRO[0000] error waiting for container: context canceled

Which led me to https://stackoverflow.com/questions/45972812/are-you-trying-to-mount-a-directory-onto-a-file-or-vice-versa/45973133#45973133 where it's stated:

running the docker run command while the file was not present at the location where it should have been in the host directory. In this case docker daemon would have created a directory inside the container in its place, which later fails to map to the proper file when the correct files are put in the host directory and the docker command is run again

So just doing the initial creating of .env solves this. I've added this to the docker section in the README.

sroertgen commented 1 year ago

Thanks for the review. We will wait with merging till https://github.com/skohub-io/skohub-webhook/issues/1 and https://github.com/skohub-io/skohub-webhook/issues/2 are resolved and the new webhook service is running.