Posts Tagged: apache ant


15
Mar 10

How to fetch .property file content in bash script

Recently I had a task – implementation of automated deployment procedure to dev/stagin environment.

1) Update server’s source code to the latest version available
2) Create/recreate DB(if necessary) with certain db access parameters.
3) Implement all the latest SQL delta schema updates(via LiquiBase).

My main idea was to reduce duplicity in config management as much as possible.
So I decided to store all db config data in one property file.

nikita@laptop:/var/www/fooproject# cat build.properties
database.port = 3306
database.name = fooproject_devel
database.username = foo_username
database.password = foo_password

This is how I pass parameters from property file to my custom bash script:

nikita@laptop:/var/www/fooproject# cat build.xml

<project name=“Foo” default=“build” basedir=“.”>

    <property file=“build.properties”/>
   
    <target name=“recreate-db”>
        <exec executable=“expect” dir=“${basedir}” failonerror=“on”>
            <arg line =“recreate-db.sh” />
            <arg line =“${database.username}” />
            <arg line =“${database.password}” />
            <arg line =“${database.name}” />
        </exec>
    </target>
</project>

nikita@laptop:/var/www/fooproject# cat recreate-db.sh
#!/usr/bin/expect

set username [lindex $argv 0]
set password [lindex $argv 1]
set database [lindex $argv 2]

That’s it.


23
Dec 08

Index page “Under construction” while deploying

I have noticed a few times earlier on different sites an index pages with title “Please be patient, while we are deploying new software version. You’ll like it”. And one day, I decided that it is the time, to integrate the similar feature to our automated deployment process.

I think, that this page has to show user some indication of action progress(real or fictional), not just a static page, user has to refresh to see if it is finished or not. What user has to do – is just open once the site, see the message, that it is “Under construction”, and stay the page for a while.

It has to refresh itself until the time, deployment has finished. After that it has to load index page of new version’s website.

I wan’t to tell you, how and when this new index page is setting up. Right, all the deployment processes can vary a lot depending on the software it deploys, environment it uses, deployment tools etc.

under_construction1 Continue reading →


23
Dec 08

Versionable static content deployment

Recently, at some project, we planned to dedicate some time to improve our deployment and build packing process, so we can use the solution in future projects.

What we decided to do:

  1. make a pack of all the Java scripts and CSSes, to reduce the page load time
  2. make a static content versionable

If first is quite a common practise, I wan’t to tell more about the second point, on example.
We use an automatic deployment system. So installing of new software version can be done easily and takes little time. So, for example, if we faced some serious bug with CSS, something is very bad with User Interface and the problem is with some external CSS directive.

If we will just change solve the problem, locally in those CSS file, make a build and upload it to the server we’ll have some users, with loggined sessions and cached CSS files in browser. We have uploaded the fixed version of CSS, but user still see the old one, with bugs.

The same problems can arise with all the static content(java scripts, CSS files, images).  So we decided to make that content versionable too.  Main purpose is to force the browser to load new version of those content, when we deploy new version.

That is how we decided to do that:

Continue reading →