grim/containers/trac-bootstrap

Add uid/gid support and fix the tar command
draft
2021-04-11, Gary Kramlich
e0330bc71c67
Add uid/gid support and fix the tar command
# trac-bootstrap
trac-bootstrap is meant to be used an in initContainer in kubernetes to
initialize a trac instead from a backup that's stored in an s3 compatible
provider.
## Configuration
This image requires a number of environment variables
* `DESTINATION` The destination path in the container to extrac the backup to.
* `GID` The group id to set on the extracted files.
* `S3_URL` Is the URL to your S3 bucket.
* `S3_KEY` The key in S3 that holds your trac backup.
* `S3_ACCESS_KEY` The S3 access key.
* `S3_SECRET_KEY` The S3 secret access key.
* `UID` The user id to set on the extracted files.
These environment variables are used to create an alias in mc and then extract
the backup with the following commands.
```
mc alias set trac-bootstrap "${S3_URL}" "${S3_ACCESS_KEY}" "${S3_SECRET_KEY}"
mc cat "trac-bootstrap/${S3_KEY}" | tar -xf -C "${DESTINATION}"
chmod -R "${UID}":"${GID}" "${DESTINATION}"
```
Note these commands are copied from [bootstrap](bootstrap) and may have not
always get updated. Please double check the file if you need to.
## Running
If this container finds an existing `${DESTINATION}/conf/trac.ini` it will
assume that the bootstrap is already complete and exit successfully. This
means you can happily leave the init container around forever and in the event
something should happen to your volume mount, it'll fix it.