aah Application Binary
This document describes 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 binaries have no runtime dependencies (such as Go installation, GOPATH, libraries, etc.), once a binary is built for the targeted Operating System (OS), it runs on any machine of such targeted OS.
For example:
Building aah binary for Linux 64-bit OS - env GOOS=linux GOARCH=amd64 aah build <args>
Table of Contents
- App Binary Help
- Command Input Flags
- Start
- Stop
- Reload
- Know your Embedded Files for aah single binary
- Cross Compile Build
- Build Artifact Naming Convention
App Binary Help
Since v0.12.0 aah application binary evolved further. It provides powerful console commands with POSIX flags support.
Command Input Flags
Since v0.12.0 Application binary comes with one more commands with respective input flags. Explore it via command help.
For example: command run
Start
Since v0.11.0 No intermediate script to start, stop, etc.
To start aah application, simply use the binary with command.
For example
Stop
aah application binary listens to SIGINT
and SIGTERM
OS signal. On receiving these signals:
- Application publishes
OnPreShutdown
server extension event. - Application performs the graceful shutdown with timeout of
server.timeout.grace_shutdown
fromaah.conf
. - Application publishes
OnPostShutdown
server extension event.
Reload
Since v0.10.0 aah application binary supports Hot-Reload
via SIGHUP
. Basically the app performs the same steps as Start
but reloading config, i18n, views, etc. without actually restarting itself.
Application logs inform of this reload process. Example below:
Know your Embedded Files
Since v0.11.0 aah supports single binary build packaging.
aah provides command vfs
and its sub-commands to explore files embedded into the application binary. It accepts regular expression as an input via flag pattern
and will print the file/directory path which matches the given regex pattern.
Idea behind command vfs
: Typically once the single binary is built, there would be no easy way to know which files have been embedded into the binary. In a real world scenario, it’s important to have some mechanism to find out the contents. It could also be helpful for developers, devops, etc.
Help: vfs sub-command find
For regex syntax refer to https://golang.org/pkg/regexp or run go doc regexp/syntax
on terminal.
Example: vfs sub-command find
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 --output
or -o
.
For e.g.: aahwebsite-381eaa8-darwin-amd64.zip