aah Application Binary

This page describe the aah application binary capabilities and its artifact details.

News: Since v0.11.0 aah supports single and non-single binary build artifact packaging.

Note:

Go binary have no runtime dependencies (such as Go installation, GOPATH, libraries, etc.), once binary is built for targeted Operating System (OS); then it runs on any machine of targeted OS.

For example:

Building aah binary for Linux 64-bit OS - env GOOS=linux GOARCH=amd64 aah build <args>

Table of Contents

Input Flags

Application binary supports following input flags.

Start

Since v0.11.0 No intermediate script to start, stop, etc.

To start aah application, simply use the binary input flags.

For example

$ /home/aah/website/bin/aahwebsite -profile prod

Stop

aah application binary listens to SIGINT and SIGTERM OS signal. On receiving these signals -

  • application performs the graceful shutdown with timeout of server.timeout.grace_shutdown from aah.conf.
  • Then aah fires the OnShutdown server extension event.
$ kill -TERM <process-id>

# OR

$ kill -INT <process-id>

Reload

Since v0.10.0 aah application binary supports Hot-Reload via SIGHUP. Basically application perform same steps as application start but reloading config, i18n, views, etc. without restart.

$ kill -HUP <process-id>

Application logs information would appear similar to below-

2018-05-19 22:51:08.452 WARN  aahwebsite sfo-aahweb-01 Hangup signal (SIGHUP) received
2018-05-19 22:51:08.452 INFO  aahwebsite sfo-aahweb-01 Application hot-reload and reinitialization starts ...
2018-05-19 22:51:08.455 INFO  aahwebsite sfo-aahweb-01 Configuration files reload succeeded
2018-05-19 22:51:08.456 INFO  aahwebsite sfo-aahweb-01 Configuration values reinitialize succeeded
2018-05-19 22:51:08.456 INFO  aahwebsite sfo-aahweb-01 Logging reinitialize succeeded
2018-05-19 22:51:08.456 INFO  aahwebsite sfo-aahweb-01 I18n reinitialize succeeded
2018-05-19 22:51:08.457 INFO  aahwebsite sfo-aahweb-01 Router reinitialize succeeded
2018-05-19 22:51:08.564 INFO  aahwebsite sfo-aahweb-01 View engine reinitialize succeeded
2018-05-19 22:51:08.564 INFO  aahwebsite sfo-aahweb-01 Security reinitialize succeeded
2018-05-19 22:51:08.564 INFO  aahwebsite sfo-aahweb-01 Access logging reinitialize succeeded
2018-05-19 22:51:08.564 INFO  aahwebsite sfo-aahweb-01 Application hot-reload and reinitialization was successful

Know your Embedded Files

Since v0.11.0 aah supports single binary build packaging.

Once the single binary is build, there would be no easy way to know which files have got embedded into the binary. In real world scenario, it is important to have some mechanism to find out the contents. It could also be helpful for developers, devops, etc.

So aah provides easy convenient input flag called -list. It accepts regular expression as an input and print the file/directory path which matches with given regex pattern.

For regex syntax refer to https://golang.org/pkg/regexp or run go doc regexp/syntax on terminal.

Cross Compile Build

Since go1.5 we can build cross platform build easily. aah framework supports it, refer Cross Compile Build

Build Artifact Naming Convention

aah build produces the build artifact name as <app-binary-name>-<version>-<goos>-<goarch>.zip. Also you can supply your custom name for the artifact via -o or --output.

For e.g.: aahwebsite-381eaa8-darwin-amd64.zip