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

Add minimal CouchDB container for WMAgent #1409

Merged
merged 14 commits into from
Mar 28, 2024

Conversation

todor-ivanov
Copy link
Contributor

@todor-ivanov todor-ivanov commented Aug 18, 2023

fixing dmwm/WMCore#11312

This PR adds all necessary changes for setting up a WMAgent couchdb container.

  • The default CouchDB version is 3.2.2, but with the help of the wrapper scripts any couchdb version can be built and uploaded to registry.cern.ch
  • The containers are uploaded at:
    • registry: registry.cern.ch
    • repository: [cmsweb/wmagent-couchdb](https://registry.cern.ch/harbor/projects/1771/repositories/wmagent-couchdb)

It is ready to use.

Remove anything unnecessary

Remove local-upstream-minimal.ini
@khurtado
Copy link
Contributor

khurtado commented Mar 7, 2024

@todor-ivanov Should we add a mechanism to read the couch user/pass from a config file ? Read my comment from:

dmwm/WMCore#11312 (comment)

@todor-ivanov
Copy link
Contributor Author

Hi @khurtado we should indeed. I am workign on that now, and hopefully will provide the code later tonight.
Sorry for not replying ... I was concentrating the Oracle functionalities fro wmagent.

@khurtado
Copy link
Contributor

khurtado commented Mar 7, 2024

@todor-ivanov Sounds good! I will test on my end once you are done but let me know if you need help with anything.

…CH}_SECRETS_FILE && Start couchDB from run.sh
@todor-ivanov
Copy link
Contributor Author

todor-ivanov commented Mar 11, 2024

@khurtado
Copy link
Contributor

@todor-ivanov I was testing the options in the script and this one didn't work for me:

(CouchDB-3.2.2) [cmst1@vocms0265:data]$ manage updatecouchapps
ME : 3.2.2
TOP : /data
ROOT : /data/srv
CFGDIR : /data/srv/couchdb/3.2.2/config
LOGDIR : /data/srv/couchdb/3.2.2/logs
STATEDIR : /data/srv/couchdb/3.2.2/state
KEYFILE : /data/srv/couchdb/auth//hmackey.ini

COUCH_ROOT_DIR : /data
COUCH_BASE_DIR : /data/srv/couchdb
COUCH_STATE_DIR : /data/srv/couchdb/3.2.2/state
COUCH_INSTALL_DIR : /data/srv/couchdb/3.2.2/install
COUCH_CONFIG_DIR : /data/srv/couchdb/3.2.2/config

/data/srv/couchdb/3.2.2/install/stagingarea/tmp /data

Pulling couchapps version  from Github...
https://codeload.github.com/dmwm/WMCore/tar.gz/refs/tags/:
2024-03-12 00:38:14 ERROR 400: Bad Request.
Error pulling couchapps version  from Github

@todor-ivanov
Copy link
Contributor Author

hi @khurtado

I was testing the options in the script and this one didn't work for me:
(CouchDB-3.2.2) [cmst1@vocms0265:data]$ manage updatecouchapps

You need to provide the WMCore tag from which the relevant coucapps should be updated:

(CouchDB-3.2.2) [cmst1@vocms0290:data]$ manage updatecouchapps 2.3.0
ME : 3.2.2
TOP : /data
ROOT : /data/srv
CFGDIR : /data/srv/couchdb/3.2.2/config
LOGDIR : /data/srv/couchdb/3.2.2/logs
STATEDIR : /data/srv/couchdb/3.2.2/state
KEYFILE : /data/srv/couchdb/auth//hmackey.ini

COUCH_ROOT_DIR : /data
COUCH_BASE_DIR : /data/srv/couchdb
COUCH_STATE_DIR : /data/srv/couchdb/3.2.2/state
COUCH_INSTALL_DIR : /data/srv/couchdb/3.2.2/install
COUCH_CONFIG_DIR : /data/srv/couchdb/3.2.2/config

/data/srv/couchdb/3.2.2/install/stagingarea/tmp /data

Pulling couchapps version 2.3.0 from Github...
2024-03-13 12:45:01 URL:https://codeload.github.com/dmwm/WMCore/tar.gz/refs/tags/2.3.0 [11592963] -> "2.3.0.tar.gz" [1]

Pulling additional reqmon and t0_reqmon dependencies...

Downloading jquery-ui.min.js...
2024-03-13 12:45:02 URL:https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js [201842/201842] -> "jquery-ui.min.js" [1]

Downloading jquery.min.js...
2024-03-13 12:45:02 URL:http://code.jquery.com/jquery-1.7.2.min.js [94840/94840] -> "jquery-1.7.2.min.js" [1]

Downloading Datatables...
2024-03-13 12:45:02 URL:https://datatables.net/releases/DataTables-1.9.1.zip [2415658/2415658] -> "DataTables-1.9.1.zip" [1]

Downloading YUI...
2024-03-13 12:45:03 URL:https://yui.github.io/yui2/archives/yui_2.9.0.zip [14294111/14294111] -> "yui_2.9.0.zip" [1]
/data/srv/couchdb/3.2.2/install/stagingarea/tmp/yui /data/srv/couchdb/3.2.2/install/stagingarea/tmp /data
/data/srv/couchdb/3.2.2/install/stagingarea/tmp /data
Removing old couchapps...
Installing new couchapps...
/data
Cleaning up!

@todor-ivanov
Copy link
Contributor Author

@khurtado @amaltaro

Please take a look at the final version of this setup.
I think it is now working as expected.

Copy link
Contributor

@khurtado khurtado left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@todor-ivanov Code is looking good to me, I left a few comments. Just one thing overall, this PR is in general not covering non-cmst1 users, right? I vaguely remember CERN IT was going to be involved in this, security wise (regarding including uuids and usernames of all three users Agents use)

I updated the documentation suggestion with the updatecouch output in your previous comment.

docker/pypi/wmagent-couchdb/README.md Outdated Show resolved Hide resolved
docker/pypi/wmagent-couchdb/couchdb-docker-build.sh Outdated Show resolved Hide resolved
@khurtado
Copy link
Contributor

@todor-ivanov Just a reminder of this review for when you get a change to look at it

Co-authored-by: Kenyi Hurtado <khurtado@nd.edu>
@todor-ivanov
Copy link
Contributor Author

Hi @khurtado I have merged all your suggeted changes to the current PR. I also addressed your comments and also added the needed push and pull parameters to the scripts in order to run upload and run this image to/from the cern registry. Please take another look.

@khurtado
Copy link
Contributor

@todor-ivanov
I think the unused var COUCH_SECRETS_FILE was not yet removed from this file:

https://github.com/dmwm/CMSKubernetes/pull/1409/files/8b2c2ab89b6865d5ded9f1e14591e0c2c2147a88#diff-cc2d7495d3dd0b8fb61cfc89481c74747c3ba277501b1f8270ed096ab42229ee

The push & pull code in the new commit looks good to me, but since the image name has changed I think now the documentation instructions mentioning couchdb alone like:

cmst1@vocms0290:wmagent-couchdb $ docker exec -it couchdb bash
(CouchDB-3.2.2) [cmst1@vocms0290:data]$

would be:

cmst1@vocms0290:wmagent-couchdb $ docker exec -it wmagent-couchdb bash
(CouchDB-3.2.2) [cmst1@vocms0290:data]$

Is that right? Could you please change that to be consistent with the new name?

@todor-ivanov
Copy link
Contributor Author

todor-ivanov commented Mar 18, 2024

hi @khurtado, the environment variable I kept there on purpose just to stay consistent with the structure of the rest of the containers. And also to have the placeholder once we start having those database accesses properly set with the correct database level access rights for the accounts (which, IIUC, we are to do it in some near future).

For the command for running/accessing and connecting to the container nothing has changed. The image name has changed, but the container name is still couchdb, so this:

docker exec -it couchdb bash

is still valid.

Copy link
Contributor

@khurtado khurtado left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you Todor! I just marked the requests as resolved and approved the PR.

docker/pypi/wmagent-couchdb/manage Show resolved Hide resolved
ENV COUCH_LOG_DIR=$COUCH_CURRENT_DIR/logs
ENV COUCH_DEPLOY_DIR=/usr/local
ENV COUCH_ENV_FILE=$COUCH_DEPLOY_DIR/deploy/env.sh
ENV COUCH_SECRETS_FILE=$COUCH_ADMIN_DIR/CouchDB.secrets
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is var not being used anymore, it can be removed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is marked as resolved, but I see no follow up. It might be confusing to leave an unused secret reference in this docker file. I would suggest to remove this COUCH_SECRETS_FILE line?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was discussed with @khurtado in another comment/thread as well ( I cannot remember already which exactly), but we have agreed to keep the variable as a placeholder for the sake of consistency with the MariaDB container and because we do plan to fix this single user problem in the future.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would leave it commented out, but that's Okay.

@todor-ivanov
Copy link
Contributor Author

thanks @khurtado

@khurtado
Copy link
Contributor

@amaltaro Do you want to take a final look at the PR before merging it?

@amaltaro
Copy link
Contributor

Yes, I plan to look into it by tomorrow. Apologies for the delay.

@todor-ivanov
Copy link
Contributor Author

@amaltaro would you be able to look into this before the start of this long weekend.
I'd really want to complete this before that.

Thanks in advance

Copy link
Contributor

@amaltaro amaltaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Todor, it's looking good in general, however I did leave many comments/questions/requests along the code.

In addition to that, please update the initial pull request description.

docker/pypi/wmagent-couchdb/README.md Outdated Show resolved Hide resolved
docker/pypi/wmagent-couchdb/README.md Outdated Show resolved Hide resolved
docker/pypi/wmagent-couchdb/README.md Outdated Show resolved Hide resolved
docker/pypi/wmagent-couchdb/README.md Outdated Show resolved Hide resolved
docker/pypi/wmagent-couchdb/README.md Outdated Show resolved Hide resolved
cacert_file = /data/certs/servicecert.pem
ssl_certificate_max_depth = 10
verify_ssl_certificates = false
fail_if_no_peer_cert = false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This configuration is new w.r.t. the actual one. I would drop it unless there is a strong reason to keep it.

cacert_file = /data/certs/servicecert.pem
ssl_certificate_max_depth = 10
verify_ssl_certificates = false
fail_if_no_peer_cert = false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

docker/pypi/wmagent-couchdb/local.ini Show resolved Hide resolved
docker/pypi/wmagent-couchdb/manage Outdated Show resolved Hide resolved
docker/pypi/wmagent-couchdb/manage Outdated Show resolved Hide resolved
@todor-ivanov
Copy link
Contributor Author

@amaltaro I have addressed all your comments please take another look.

Copy link
Contributor

@amaltaro amaltaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the prompt turnaround, Todor. I left a few more comments along the code.

In addition, please add a few more details to the PR description. For someone that didn't work on this, it's not clear where docker images are uploaded; what the assumptions are (secrets? accounts?); current couchdb version; any relevant changes w.r.t. the current couchdb setup.

ENV COUCH_LOG_DIR=$COUCH_CURRENT_DIR/logs
ENV COUCH_DEPLOY_DIR=/usr/local
ENV COUCH_ENV_FILE=$COUCH_DEPLOY_DIR/deploy/env.sh
ENV COUCH_SECRETS_FILE=$COUCH_ADMIN_DIR/CouchDB.secrets
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is marked as resolved, but I see no follow up. It might be confusing to leave an unused secret reference in this docker file. I would suggest to remove this COUCH_SECRETS_FILE line?

docker/pypi/wmagent-couchdb/README.md Show resolved Hide resolved
docker/pypi/wmagent-couchdb/README.md Outdated Show resolved Hide resolved
@todor-ivanov
Copy link
Contributor Author

@amaltaro take another look

Copy link
Contributor

@amaltaro amaltaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Todor, it looks good to me.

@todor-ivanov todor-ivanov merged commit 326de33 into dmwm:master Mar 28, 2024
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

Successfully merging this pull request may close these issues.

3 participants