logo

drewdevault.com

[mirror] blog and personal website of Drew DeVault git clone https://hacktivis.me/git/mirror/drewdevault.com.git

Learn-your-package-manager.md (2236B)


  1. ---
  2. date: 2018-01-10
  3. title: Learn about your package manager
  4. layout: post
  5. tags: [philosophy]
  6. ---
  7. Tools like virtualenv, rbenv, and to a lesser extent npm and pip, are
  8. occasionally useful in development but encourage bad practices in production.
  9. Many people forget that their distro already has a package manager! And there's
  10. more-- you, the user, can write packages for it!
  11. Your distro's package repositories probably already have a lot of your
  12. dependencies, and can conveniently update your software alongside the rest of
  13. your system. On the whole you can expect your distro packages to be much better
  14. citizens on your system than a language-specific package manager will be.
  15. Additionally, pretty much all distros provide a means for you to host your own
  16. package repositories, from which you can install and update any packages you
  17. choose to make.
  18. If you find some packages to be outdated, find out who the package maintainer is
  19. and shoot them an email. Or better yet - find out how the package is built and
  20. send them a patch instead. Linux distributions are run by volunteers, and it's
  21. easy to volunteer yourself! Even if you find *missing* packages, it's a simple
  22. matter to whip up a package yourself and submit it for inclusion in your
  23. distro's package repository, installing it from your private repo in the
  24. meanwhile.
  25. "But what if dependencies update and break my stuff?", you ask. First of all,
  26. why aren't you keeping your dependencies up-to-date? That aside, some distros,
  27. like Alpine, let you pin packages to a specific version. Also, using the
  28. distro's package manager doesn't necessarily mean you have to use the distro's
  29. package repositories - you can stand up your own repos and prioritize it over
  30. the distro repos, then release on any schedule you want.
  31. In my opinion, the perfect deployment strategy for some software is pushing a
  32. new package to your package repository, then SSHing into your fleet and running
  33. system updates (probably automatically). This is how I manage deployments for
  34. most of my software. As a bonus, these packages offer a good place to configure
  35. things that your language's package manager may be ill suited to, such as
  36. service files or setting up new users/groups on the system. Consider it!