Package: laika-deploy
Laika 🐶A command-line utility for easy and reliable management of manual deployments from Git repositories.Even manual deployments can be made reliable if some minimal automation is applied. This utility performsatomicdeployments from a Git repository, with an optionalbuildphase (e.g. installing dependencies). The previous deployment is not affected until the build completes successfully – no more inconsistency errors when you update your Git branch but your application is not yet fully updated – e.g. missing new dependencies from your package manager.Each deployment is built in a new directory made just for that deployment. Previous deployments are kept (and can be later purged), and the target is only updated when the build completes – that’s what we meant byatomic! If the build fails, the target will not be updated.The meaning ofbuildis defined by the user; it can be any command runnable from a shell. Configuration is made in a simple.inifile.InstallationRequirements:Python ≥ 3.6 (has been tested with 3.6 and 3.7)Git ≥ 2.7 (depends on thegit worktreefeature)Install viapip:$ pip install laika-deployIf this fails and you have no idea what to do, you can try adding the--useroption afterpip install, though other options can be better in the long run – e.g. you can usepipx, or simply create avirtualenvfor your installed scripts.UsageAfterinstalling this utility, you can runlaika --helpfor basic usage instructions.The easiest way is to runlaika deploy <git-branch-name>. But before first usage you must create adeploy.inifile with at least the settings below (look further for an example):dirs.deploy: directory where your application will be deployed. The current deployment will be available atcurrentunder this directory. This will be a symlink to the actual deployment directory.So, for example, if you have a PHP application, you can point Nginx to the/app/deployments/currentdirectory which will contain a working tree of your Git repository and will be updated whenever you deploy a new version, provided you add this to yourdeploy.ini:[dirs]deploy=/app/deploymentsEach deployment will also live in this directory with a name containing the date/time of the deployment, the Git commit hash and the name of the branch/tag that was deployed.build.run: which command to run in thebuildphase. Typical usages are running your package manager, copying configuration files, compiling assets.This is run as a shell command line – so you can chain commands as innpm install && npm run build.A complete configuration file would thus be:[dirs]deploy=/app/deployments[build]run=npm install && npm run buildIt is assumed that the build will be run in the same host where the application is to be deployed.Also, the user running this script must havepermission to write on the deployment directory.Purging old deploymentsYou can purge old deployments withlaika purge. There are two ways to specify what exactly is to be removed:--keep-latest N: keep only the latestNdeployments (other than the current one). WithN=0, only the current deployment is kept, and withN=1only one deployment other than the current is kept.--older-than DATETIME: discard deployments with a timestamp strictly older than the given date/time. A wide range of both absolute and relative formats is accepted; see thedateparser documentationfor full information. Common cases may be written as10d,1w(10 days and 1 week, respectively).Development setupIf you want to set this project up for development, seeCONTRIBUTING.md.