Organising repos into app-format

admin's picture

Increasingly people are using one of the major Version Control System (VCS) hosts, such as Github, BitBucket or Codeplane to store and version their code.

Good code has many homes

During its life that code will be deployed to several servers, such as dev (the development machine on which it was first created), staging (a live-like environment used to check that it will work when integrated alongside other new code and in the live environment) and live (the machine on which it will be hosted for consumption). As teams like ours are making it easier to setup machines, code is getting deployed to more and more machines, often several instances of each of the dev/staging/live. The goal therefore is to make it possible for apps to be deployed to a server quickly and easily.

App-specific config in the app repo

Most general machine config lives in the puppet manifests which, while themselves versioned, are a different logical entity to the app repo. As the line between the code that describes the app's execution (dev) and the code that describes the environment in which it needs to execute (ops) blurs, it becomes more convenient to store app-specific config in the app repo. By organising the way that config is stored in the app repo, it can be automatically detected. We organise repos into app format and provide an open-source puppet defined type (dorepos::installapp) to install that app during a puppet-run.

App format

Top-level

/htdocs - web document root
/conf - configuration files
/docs - documentation pertaining to this app (everything that's not in-code comments)

The structure of the /conf folder means that puppet can distribute the config files out to where they need to live on the target machine, e.g. vhosts into /etc/httpd/conf.d (CentOS) or /etc/apache2/sites-available/

/conf

/conf/hosts - domains exposed by this app
/conf/vhosts - Apache virtual hosts
/conf/cron - regular tasks that should be setup in the user's crontab, then periodically executed by cron
/conf/backup - backup operations that might be manually triggered or automatically scheduled

Recent Articles

published 3 years 1 month ago

Site

Follow Us

Twitter icon
Facebook icon
LinkedIn icon
SlideShare icon
YouTube icon
RSS icon