Closed jjackzhn closed 2 years ago
Here's an example from OSC's Hiera:
openondemand::apps_config_repo: https://github.com/OSC/osc-ood-config.git
openondemand::apps_config_revision: v130
openondemand::apps_config_repo_path: "%{lookup('apps_config_dir')}/apps"
openondemand::locales_config_repo_path: "%{lookup('apps_config_dir')}/locales"
openondemand::public_files_repo_paths:
- "%{lookup('apps_config_dir')}/public/logo.png"
- "%{lookup('apps_config_dir')}/public/favicon.ico"
We have different configs for different instances so for example our main instance will set this:
apps_config_dir: ondemand.osc.edu
I'll add this to README for this module
Actually it appears to already be in README, look for Configure OnDemand via git repo
Sorry for the vague report. I meant to ask how the configs themselves are written. I looked at the config files in the osc-ood-config repo but it's unclear to me how they correspond to app behavior.
That might be more a question for OnDemand discourse, https://discourse.openondemand.org/. Most configs for OnDemand happen in other places, these are app configs so one example is we use initializers like this: https://github.com/OSC/osc-ood-config/tree/master/ondemand.osc.edu/apps/dashboard/initializers to configure the apps before they start. Most of it's done by modifying environment variables that OnDemand reads to change behavior.
Thanks for the reply. I'll bring the question to Discourse.
Another question - it seems like this module only installs apps that are available as RPM from the Ondemand repo. Is it possible to add the ability to install custom apps? Say, from a Git repo that hosts app source codes under subpaths named after apps.
That should be possible. Do you have CLI commands about how you do the app install using a Git repo? That's not how we install apps so would need steps you use to try and replicate with Puppet.
It's just a simple "git clone" into /var/www/ood/apps/sys/app-name. For now I'm managing all changes manually, but I can probably look into adding fields manageable via app configs.
Something like:
openondemand::apps_source_repo: https://github.com/app/source.git
openondemand::git_apps:
- app1
- app2
If you can work out the Puppet logic in a profile, I can then take that and integrate into module. I think the challenging part will be a single git repo with sub paths for apps as we tend to see 1 git repo per app.
this is what the ansible config look like if that helps. It is also 1:1, but it also kinda piggybacks off of the ansible git
support.
https://github.com/OSC/ood-ansible#ood_install_apps
Indeed - I heard someone on the recent office hours (harvard maybe?) is using the puppet supported module (git maybe?) for this. In any case, they are doing this functionally with some other module.
I'll try to implement it in a profile and let you know.
I agree that one repo per app is likely more common; I was going off the scheme currently implemented for app configs. Could also have it as a hash of "app:link_to_repo".
I think the Puppet equivalent for repo management is vcsrepo (which is also currently used for apps_config_repo).
This is what I came up with:
class profile::ondemand (
...
Hash[String,String] $custom_apps
){
...
$custom_apps.each | $app_name, $source_repo |
{
vcsrepo { "/var/www/ood/apps/sys/${app_name}":
ensure => 'latest',
provider => 'git',
source => "${source_repo}"
}
}
...
}
and it would appear in Hiera as
profile::ondemand::custom_apps:
app1: 'https://github.com/path/app1.git'
If I was to incorporate that into this module I think it'd have to be a little more granular in terms of the ensure
value. At OSC we tend to deploy tagged apps (that generate RPMs) to production but might deploy latest
to our dev instance. Looking at the openondemand::install::app
I think I see a way to incorporate this. I think for your case it'd be like this:
openondemand::install::app { 'app1':
ensure => 'latest',
type => 'git',
git_repo => 'https://github.com/path/app1.git',
}
This would just bypass the package resource and instead use the vcsrepo
resource like you have. Does this look like it would work? If yes I can get a pull request going that you can test against.
How would that look like in Hiera? Something like this?
openondemand::install_apps:
app1:
type: 'git'
git_repo: 'https://github.com/path/app1.git'
ensure: 'latest'
I think we can give it a try.
That is how it would work. I added logic and updates to README in #85. If you use r10k to sync modules can point it at git-apps
branch of this module to try it out. Just FYI I will delete the branch once merged.
I can confirm that it's working correctly.
The changes to support git repo for apps will be released with v2.11.0 once Github Actions complete.
How does one actually use app configs (i.e. openondemand::apps_config_repo)? Little documentation seems to exist in either the puppet module docs or the OpenOndemand docs.