2020-05-12 08:20:41 +00:00
# changelog : manage changes on a server
Based on the Masters Book of Serious Sysadmin's Best Practices Chapter, this script aims at unifying and simplifying the management of changelog files on a server.
## Crash course
```
2020-05-19 08:29:26 +00:00
wget https://git.interhacker.space/alban/changelog/raw/branch/master/changelog.sh
2020-05-12 08:20:41 +00:00
chmod +x changelog
2020-05-19 08:29:26 +00:00
sudo -E ./changelog
2020-05-12 08:20:41 +00:00
```
2020-05-19 08:29:26 +00:00
## How it works
2020-05-12 08:20:41 +00:00
The script will ask for your name if no `CHANGELOG_USERNAME` environment variable is found.
2020-05-19 08:29:26 +00:00
Then it will ask for change informations:
2020-05-12 08:20:41 +00:00
* The nature of the change: which software / domain did you change? Why?
* Some comments: How did you do it? What was happening? Is it fixed?
2020-05-19 08:29:26 +00:00
You can then add multiple lines for a single change as well as multiple changes for a changelog entry (ex: deploy a new service and remove old packages).
This changelog entry is now inserted on top of the /etc/changelog file, which is created with a default entry if not present yet.
2020-05-12 08:20:41 +00:00
**Limitations**
2020-05-19 08:29:26 +00:00
* Please note that to enter multiline comments, you have for now to escape newline characters using the `\\\\n` sequence. Ugly.
2020-05-12 08:20:41 +00:00
* By default, it will attempt to create and edit `/etc/changelog` . You better be running it as root, by default.
2020-05-19 08:29:26 +00:00
## Plugins and config
You can add plugins to hook actions at two points in time. The `plugins-available` directory contains two working examples of these hooks.
* adding a changelog entry lines. Example `content-hastebin.sh` plugin pushes a file content to a pastebin service
* saving the changelog. Example `output-changelog-server.sh` plugin pushes a changelog to a remote central server
You can activate the plugins by placing/linking them in the `plugins-enabled` directory.
The plugins might need some configuration variables.
Do `mv config.sample.sh config.sh` and edit the file to suit your needs.
## Baking a fat exec
While providing a mean to run plugins is cool, it's not very efficient at deployment time.
Run `build.sh` to get a single exec, ready for shipping, embedding:
* your config.sh file
* all the plugins you added to plugins-enabled
2020-05-12 08:20:41 +00:00
2020-05-19 08:29:26 +00:00
## Possible improvements
2020-05-12 08:20:41 +00:00
2020-05-19 08:29:26 +00:00
* [x] Enable a sudo requirement / ways to restart oneself as a root user
* [] Enable simple multiline comments
* [x] Provide a way to attach files
* [x] Provide a way (plugins?) to report each change to a central server
* [x] Provide a build system to cook config and plugins in a single exec
2020-05-12 08:20:41 +00:00