For higher productivity with bosh ssh
.
Inspired by cloudfoundry-community/root-env-boshrelease
, dotfiles-boshrelease
aims to make a better admin experience for bosh ssh
, which is crucial for both dev & ops on BOSH based infrastructures.
Dotfiles-boshrelease
and root-env-boshrelease
are similar in a sense that both enables the customization of /root
directory. However they do it in different ways.
root-env-boshrelease
customizes /root by downloading a tarball from a url daily and then replace the /root. The good thing of such implementation is one can update /root
without recreating release/re-deploying. However a concern would be downloading root-executing scripts to production servers might not be the best practice. Also, dotfiles usually should not be changing in a daily pace.
In contrast, dotfiles-boshrelease
only use local rc files from /var/vcap/jobs/shrc
. They are deployed by bosh. If you remove shrc
from manifest, your admin environment will be (almost) clean again.
In manifest file, add dotfiles
to releases. In template, add shrc
job.
Deploy the shrc
job in a template, then find the amazing changes with bosh ssh
.
A property shrc.extra_commands
are provided for you to inject your own commands easily. The value of extra_commands
will be executed after .shrc
.
On the other hand, you can also just fork and modify this project, then use bosh to create, upload and deploy your own release.
- It is known that if you modify
shrc.extra_commands
(although this should not happen frequently), all jobs those haveshrc
installed will be re-deployed since the templated files are changed. Considering that it is common to haveshrc
installed on ALL jobs, this will trigger re-deploy on ALL jobs, and sometimes it is known to be a pain in the ass. shrc
is bound toroot
,vcap
andbosh_$TEMP
account. Means that when you su toroot
,extra_commands
will be executed automatically with root priviledge. The extra commands are executed withset -eu
for your flight safety. Don't shoot your feet.
- inputrc:
- Enable word jump (alt + Left/Right);
- Enable history search (alt + Up/Down; alt + p/n; PageUp/PageDown)
- Completion-ignore-case on
- shrc:
- Frequently used dirs: link to $HOME (vcap, packages, jobs, sys/log, etc..)
- PS1: Meaningful and colorful PS1. You can set your favorite PS1 color in spec.
- packages bins: add packages/*/bin to PATH.
- cd $HOME: Home sweet home.
- extra_users:
- Set
shrc.extra_users
property to let dotfiles create admin account and inject public key for you. Note that there is a sanity check when creating account. If user'sname
andpublic_key
failed to pass the check, they will be ignored. For more details, checkbin/add-users.erb
. - Caveat: dotfiles will remove /home/*/.ssh/authorized_keys before it injects public keys, in order to keep system safe. If you unfortunately set /home/vcap/.ssh/authorized_keys, it will be removed.
- extrarc:
- You can inject commands from manifest by overriding
shrc.extra_commands
property. However be careful not to crash your machine ^_^
- shrc/userbin:
- ack
- (home made) link_apps: link warden container directories to $HOME/app.
- (home made) wwsh: a shortcut to wsh into warden containers.
- (home made) haste: a hastebin client, is convenient when you have a internal hastebin server.
- completion:
- monit completion
- wwsh completion
- properties dump:
- Use
show-bosh-properties
command to see properties that's used by bosh-template. Useful for debugging.
For some reason, by default the bash in stemcell doesnot recognize .profile
or .bash_profile
, and it will only read the already existed .bashrc
. Therefore this release use .bash_aliases
to trigger customized shrc
script.
- Inspired by root-env
- ack
- monit.complete is taken from linsong/my_bash
- haste bash client are modified from haste-client
Weichu Liu (Rakuten, Inc.)