Md Toy Blog

Dotfiles scripts

Mon Jul 20 2020 00:00:00 GMT+0000 (Coordinated Universal Time)

Dotfiles scripts remove much of the day today friction. Here are the different scripts explained:

  • ~/dotfiles/scripts/link-dotfiles.bash is the script that will link all the dot files in dotfiles to the current user's dot files (keeping a backup of the existing ones). To do that you need to:
  # make it executable
  chmod +x ~/dotfiles/scripts/link-dotfiles.bash
  # execute it
  • alias-script, whenever you create a new script, and you want to use it as an alias, you can call this very simple script by specifying the name of your script file relative to dotfiles/scripts folder and the intended script alias.
  • docker-build-push this lets you build the Dockerfile in the current directory with a tag, and immediately push it to the registry.

It encapsulates two very simple commands, but it's the awaiting between the first and the second that makes them a nightmare to run manually

  • docker-restart-service, restart a docker-compose service. IMPORTANT, it only works if you follow a directory structure where the service that you want to restart is located in $ws/some-name, and you pass some-name to this command, to let it go to the dir and restart the service whose docker-compose file is in $ws/some-name dir. So make sure to have the $ws variable pointing to your workspace. NOTE it is internally used by git-pushup. NOTE the actual some-name does not matter so much to docker, since the actual name for the service will be picked up from docker-compose.yml, so if they do not match it is not a biggie.
  docker-restart-service -d some-name
  • flush-start is a very specialized script which only works for a few specific services in my machine.
  • git-pushup will git push and restart the service whose docker-compose.yml file lives in directory $ws/some-name. IMPORTANT it uses docker-restart-service internally for that matter, read about it for the directory structure.