github.com/choria-io/go-choria@v0.28.1-0.20240416190746-b3bf9c7d5a45/docs/content/packaging/_index.md (about) 1 +++ 2 title = "Custom Packaging" 3 toc = true 4 weight = 60 5 pre = "<b>6. </b>" 6 +++ 7 8 Choria binary, being a compiled binary with no external dependencies, needs to be recompiled when adding certain kinds 9 of plugin, changing some default locations or adding your own plugins. 10 11 The project provides the tooling to perform these builds and has a compile-time configuration that can be adjusted to local 12 needs. 13 14 ### Requirements 15 16 The host used to perform the compile need to have Docker on it and be able to fetch the `registry.choria.io/choria/packager` container. You can 17 build a local version of the Packager using [https://github.com/choria-io/packager](https://github.com/choria-io/packager). 18 19 In general you should only do this if you know what you are doing, have special needs, want custom agents etc. 20 21 ### Plugins 22 23 A number of [plugins types are supported](https://choria.io/docs/development/server/) and we build many in at compile time ourselves. 24 25 The general process is that all the plugins in `packager/plugins.yaml` will be included in the build, if you want to add 26 additional plugins you list them in `packager/user_plugins.yaml`. 27 28 If you wish to remove some default plugins you need to remove them from the `packager/plugin.yaml`. 29 30 In order to add your own RPC Agent you would list it in `packager/user_plugins.yaml`: 31 32 ```yaml 33 --- 34 acme: ghe.example.net/backplane/acme_agent 35 ``` 36 37 During your CI run `go get ghe.example.net/backplane/acme_agent` then `go generate` and start the build: 38 39 ```nohighlight 40 BUILD=foss VERSION=0.26.0acme rake build 41 ``` 42 43 Your plugin will now be included in the final build, see `choria buildinfo -D` for al ist of all 44 dependencies, which should include your plugin. 45 46 ### Custom builds, paths and packages 47 48 The `choria-io/go-choria` repository has `packager/buildspec.yaml` in it, this defines the binaries and packages to build, 49 there are also some supporting files to call RPM, Deb etc. 50 51 Lets look at building a custom 64bit Linux binary with different paths and creating an Enterprise Linux 8 RPM. 52 53 ```yaml 54 flags_map: 55 Version: github.com/choria-io/go-choria/build.Version 56 SHA: github.com/choria-io/go-choria/build.SHA 57 BuildTime: github.com/choria-io/go-choria/build.BuildDate 58 ProvisionJWTFile: github.com/choria-io/go-choria/build.ProvisionJWTFile 59 60 acme: 61 compile_targets: 62 defaults: 63 output: backplane-{{version}}-{{os}}-{{arch}} 64 flags: 65 ProvisionJWTFile: /etc/acme/backplane/provisioning.jwt 66 pre: 67 - rm additional_agent_*.go || true 68 - rm plugin_*.go || true 69 - go generate --run plugin 70 71 64bit_linux: 72 os: linux 73 arch: amd64 74 75 packages: 76 defaults: 77 name: backplane 78 display_name: Backplane 79 bindir: /opt/acme/bin 80 etcdir: /etc/acme/backplane 81 release: 1 82 manage_conf: 1 83 manage_server_preset: 0 84 contact: Backplane Engineering <backplane@eng.example.com> 85 rpm_group: System Environment/Base 86 server_start_runlevels: "-" 87 server_start_order: 50 88 broker_start_runlevels: "-" 89 broker_start_order: 50 90 91 el8_64: 92 template: el/el8 93 dist: el8 94 target_arch: x86_64 95 binary: 64bit_linux 96 ``` 97 98 We can now run: 99 100 ```nohighlight 101 BUILD=acme VERSION=0.26.0acme rake build 102 ``` 103 104 When you are done you will have: 105 106 * an rpm called `backplane-0.26.0acme.el8.x86_64.rpm` 107 * the binary will be `/opt/acme/bin/backplane` 108 * config files, log files, services all will be personalized around `backplane` 109 * it will have a custom path to the `provisioning.jwt` 110 111 A number of things are customizable see the section at the top of the `buildspec.yaml` and comments in the build file.