You searched for articles tagged with Deployment.

Simple Deployment with a Makefile Permalink

Deployment, Makefile, Perl Added less than a year ago

I have used Capistrano to deploy a complex web site before, but I have recently looked to Makefiles for a simple solution.

I will describe the project and situation where I have successfully used a Makefile to deploy a static website - this situation does not require complex tasks that capistrano would be able to handle - and certainly can't do rollbacks. If you are deploying something complex then please use a proper deployment tool.

The project builds an HTML website using a yaml config file (config.yaml), a bunch of chapters written in markdown (input/*.md), templates written in Dotiac::DTL (template/*.html) and a Perl script build.pl.

Running build.pl builds HTML files in an output directory (output/*.html) using the aforementioned parts.

Some targets in our Makefile include:

  1. Making the output - make all
  2. Creating an archive of the output - make archive
  3. Deploying the archive to a remote host - make deploy

Our Makefile looks like this:

ARCHIVENAME=$(shell grep Title config.yaml | sed -e 's/ *Title: //;s/ //g;')
DATESTAMP=$(shell date '+%Y%m%d')
ARCHIVEDIR=archive
OUTPUTDIR=output
HOST=targethost.com
HOSTCOPYDIR=/home/www/docroot
HOSTTARGETDIR=/home/www/docroot/mysite

all: clean input output
    perl build.pl

archive: archivedir
    cd ${OUTPUTDIR} && tar -cjf ../${ARCHIVEDIR}/${ARCHIVENAME}-${DATESTAMP}.tar.bz .

deploy: all archive
    scp ${ARCHIVEDIR}/${ARCHIVENAME}-${DATESTAMP}.tar.bz ${HOST}:${HOSTCOPYDIR}
    ssh ${HOST} mkdir -p ${HOSTTARGETDIR}
    ssh ${HOST} tar -xjvf ${HOSTCOPYDIR}/${ARCHIVENAME}-${DATESTAMP}.tar.bz -C ${HOSTTARGETDIR}

archivedir:
    mkdir -p ${ARCHIVEDIR}

clean:
    rm -rf ${OUTPUTDIR}
    rm -rf ${ARCHIVEDIR}

output:
    mkdir ${OUTPUTDIR}

Now whenever I make a change to an input markdown file I can just run make deploy and the production site will get updated.




Releasing Using Git Permalink

Git, Deployment Added more than a year ago and last edited less than a year ago

As you are no-doubt aware, I am developing this blog with the aid of Git. Since it is just me, I am working on master and intend on releasing straight from there. (On a larger project you might branch first, create release candidates etc, and then eventually tag and release from the branch.)

So, to tag and release from master, I followed this process:

$ git branch
* master

... confirms I'm on master.

$ git tag 0.1

... creates my 0.1 release as a tag from master.

$ git archive --format=tar --prefix=vnv-v0.1/ 0.1 | gzip > vnv-v0.1.tar.gz

... creates a gzipped tarball from the 0.1 tag. The prefix specifies the root directory that the tarball will explode to. (Don't forget that trailing slash.)

$ ls *tar.gz
vnv-v0.1.tar.gz

Nice!

$ mv vnv-v0.1.tar.gz /tmp/
$ cd /tmp/
$ tar -xzf vnv-v0.1.tar.gz
$ ls vnv*
vnv-v0.1.tar.gz

vnv-v0.1:
README  SETUP*  code/  db/  deploy.pl*  dist/  doc/  media/  template/

... if prefix had been XXX then the tarball would still be called vnv-v0.1.tar.gz but it would have exploded to a directory called XXX/




(Nothing Older) ... (Nothing Newer)

Colophon

Django Python 960.gs Git Vim NetBSD Nginx

The Author

The author is a software engineer living in Australia. He sux at guitar, loves camping, doesn't like cake, does like coffee and is a lazy home brewer.

Meta

Help
Latest entries

*BSD Agile Apache Apple Athletics Beer Best-Practice Censorship Comedy Cool Crosswords Deployment Django English Exim Firefox Git Hardcore Health Interface irssi Javascript Jira Languages Linux Makefile Markdown Mathematics Mobile Broadband MySQL NetBSD nginx Nokia OSX Perl Photo Privacy Python Rant Requirements rsync Ruby Shell Slackware SQL SQLite SSH Standards Subversion Testing ThisBlog Vim VMWare (Fusion) VPN WDTEM X Yum zsh

Recent Entries

Yum
Possum
Git's Index
Jira Project Keys
The Coffee Shop
Git GUI
It is more important...
Questioning Unix (and Other) File Times
The Frog King Photo
Rain Cloud Photo
rsync
Timezone
utf8 in your Perl
Theatre Ceiling Photo
Some problems are so complex...
Colours in your PAGER
zsh vared
zsh magic-equals and double-star
Funny Tweets
iMac 27" i7

Links

ChoppingBoard, Project365, RageQuit

♥ Actors/Artists/Characters