chef-server icon indicating copy to clipboard operation
chef-server copied to clipboard

Make Chef Server distributable under a configurable name - wordmarks in outputs

Open bobchaos opened this issue 5 years ago • 4 comments

Motivation

As a Chef Infra redistributor, I would like to be able to redistribute Chef Infra server under a configurable name in order to make 3rd party distributions easier to produce and maintain in compliance with Chef Software's policy on trademarks https://www.chef.io/trademark-policy/

Specification

In other Chef Software repositories, we've adopted an approach wherein we create a file with constants in it (dist.rb in chef/chef) that correspond to Chef's wordmarks. We then replace all user-facing references to the wordmarks in the codebase with the constants. This allows 3rd party distros like Cinc.sh to build the code under new branding by swapping out the dist file and performing minor tweaks to the Omnibus conf.

Another approach also exists for Golang projects. Salim Afiune cooked up a a go code generator that's being implemented in Chef's go projects (see chef/go-libs for a full implementation + the code generator proper). When building, 3rd party distros simply feed a URL to a JSON file with their distro's wordmark replacements into go generate and then run plain old go build.

Original design proposal in chef/chef, which was re-used in multiple projects: https://github.com/chef/chef/issues/8376

Initial PR implementing dist.rb in chef/chef: https://github.com/chef/chef/pull/8368

The go code generator: https://github.com/chef/go-libs/tree/master/distgen

Let me know if I can provide any additional info about existing implementations of dist stuff, or if you want to explore an altogether different approach.

Downstream Impact

Somewhere between "none" and "everything" o.O For example, in chef/chef, we had a few situations that required changes beyond log messages and CLI outputs, such as having to rename the configuration directories. In the client repo, we addressed such concerns as we went, and ultimately managed to avoid breaking changes (altho a few deprecations resulted from the distro work). The bulk of the work should have no impact however, as it consists mostly of string replacements happening outside of logic and flow-control.

bobchaos avatar Apr 06 '20 22:04 bobchaos

I have created an initial PR for review on this. It builds for me locally, but this is nowhere near a complete fix. Notably missing is anything outside the ruby code, and I focused on replacing chef-server and chef-server-ctl but there are probably many instances of chef still in the codebase which will need additional PRs.

I do not have buildkite set up but I did an Omnibus build and the resulting package appeared to be a fully functional Chef server. I can't get tests to run locally even when just building on the master branch so I may need help there from someone in Slack.

jgitlin-p21 avatar Apr 28 '20 22:04 jgitlin-p21

Coming back to this finally. At last check the smoke tests were failing with uninitialized constant Chef::Dist::Server from a recipe at cookbooks/private-chef/recipes/default.rb:25. I had refactored the wordmarks to use a cookbook attribute for everything under cookbooks and am now trying to ensure all tests pass.

Latest work is here: https://github.com/jgitlin-p21/chef-server/tree/jgitlin-p21/wordmarks

jgitlin-p21 avatar Jul 01 '20 15:07 jgitlin-p21

New PR for an initial pass here. Now with passing tests!

jgitlin-p21 avatar Aug 12 '20 20:08 jgitlin-p21

I now have an updated PR for the first round of wordmark replacements: https://github.com/chef/chef-server/pull/2808

jgitlin-p21 avatar Sep 09 '21 18:09 jgitlin-p21