Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running Virtuoso as a service in GitLab CI #1247

Open
claudiu-cristea opened this issue Feb 21, 2024 · 3 comments
Open

Running Virtuoso as a service in GitLab CI #1247

claudiu-cristea opened this issue Feb 21, 2024 · 3 comments

Comments

@claudiu-cristea
Copy link

claudiu-cristea commented Feb 21, 2024

I have a case where I need to run VOS as a service in a GitLab CI (here's the gitlab-ci.yml file). In order to run the tests against the Virtuoso service, I need to set some permissions with isql:

DB.DBA.RDF_DEFAULT_USER_PERMS_SET('SPARQL', 7, 0);
GRANT SPARQL_UPDATE TO "SPARQL";

No idea how to run these commands because, with GitLab CI, I cannot map an .sql file inside the container, so that it would run as part of initdb.d.

Does anyone have a suggestion or clue?

@claudiu-cristea
Copy link
Author

claudiu-cristea commented Feb 22, 2024

Any chance for a feature that would allow to set permissions via env variables passed to the container, in a similar way as VIRT_* vars? That would allow to set permissions without needing to mount initdb.d in cases such GitLab CI, where we cannot do it.

The unofficial image https://hub.docker.com/r/tenforce/virtuoso is doing that but only for SPARQL_UPDATE

@HughWilliams
Copy link
Collaborator

HughWilliams commented Feb 22, 2024

The Virtuoso docker containers do not have support for the SPARQL_UPDATE environment variable, and there are no plans to implement such. Also, they only run one of the two commands you are seeking to run, so you need a more generic method.

The gitlab-ci.yml file you provided seems to have changed and now references the tenforce virtuoso docker image? In the original I saw, you were using the command attribute to make isql connect and run the required commands, which didn't look correct as it appeared to have mismatched double and single quotes, but now it has disappeared and so I cannot comment on why it was not working. But — something like the following should work:

command: ["/opt/virtuoso-opensource/bin/isql", "1111", "dba", "xxx", "EXEC=SELECT 'Hello World'"]

If you want to run custom commands on startup with the initdb.d scripts method, with something like GitLab CI which cannot map an .sql file inside the container, you can create your own own custom Virtuoso container with the docker FROM {image-name} command, and add the Virtuoso commands you want to run when starting your custom image to the initdb.d scripts of your own container image, which GitLab CI can then reference.

@claudiu-cristea
Copy link
Author

claudiu-cristea commented Feb 28, 2024

The Virtuoso docker containers do not have support the SPARQL_UPDATE environment variable and there are no plans to implement such. Also, they only run one of the two commands you are seeking to run, so you need a more generic method.

Yes, I understand this. I was thinking that this could be a future improvement: To allow setting various permissions via container environment vars. It would help with cases such as GitLab CI, where it's not possible to share a volume between host and container.

The gitlab-ci.yml file you provided seems to have changed and now references the tenforce virtuoso docker image? In the original I saw, you were using the command attribute to make isql connect and run the required commands, which didn't look correct as it appeared to have mismatched double and single quotes, but now it has disappeared and so I cannot comment on why it was not working.

The point is that, in my case, I need a triplestore in tests. I have to test whether some triples are correctly inserted/updated/deleted (including graph store operations) in a triplestore. I've tried with Virtuoso official image, then with Fuseki (not familiar at all with F), and, finally, I went with tenforce virtuoso docker image, just to not spend much time as that allows setting the SPARQL_UPDATE permission via env vars and has the other permissions set by default. Not a long term solution; I'll try to switch to Virtuoso official image when I have time to experiment with the "EXEC=SELECT 'Hello World'" command

But — something like the following should work:

command: ["/opt/virtuoso-opensource/bin/isql", "1111", "dba", "xxx", "EXEC=SELECT 'Hello World'"]

It's hard to understand how to escape quotes in the above, as double quotes are also present in the commands being executed.

If you want to run custom commands on startup with the initdb.d scripts method, with something like GitLab CI which cannot map an .sql file inside the container, you can create your own custom Virtuoso container with the docker FROM {image-name} command, and add the Virtuoso commands you want to run when starting your custom image to the initdb.d scripts of your own container image, which GitLab CI can then reference.

I know that this would work but it's quite a complicated for the simple tasks that I have to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants