Building and deploying the TRIGGERcmd Linux agent using TRIGGERcmd

  • administrators

    If you get into DevOps or continuous integration, you'll probably appreciate this.

    I built these two scripts that build and deploy the TRIGGERcmd agent. The first script runs the second script via TRIGGERcmd.

    The first script on my CentOS Linux build VM does this:

    • Download the agent code from GitHub
    • Build the RPM and DEB Linux agents
    • Upload them to AWS S3
    • Build the Raspberry Pi DEB
    • Upload it to AWS S3
    • Run script 2 on the Raspberry Pi
    • Upgrade the local agent with the new build
    #!/bin/sh -x
    rm -rf /root/github/TRIGGERcmd-Agent
    cd /root/github
    git clone
    cd /root/github/TRIGGERcmd-Agent
    cp linuxpackage.json package.json
    npm install
    electron-forge make
    aws s3 cp /root/github/TRIGGERcmd-Agent/out/make/triggercmdagent_1.0.1_amd64.deb s3://triggercmdagents --acl public-read
    aws s3 cp /root/github/TRIGGERcmd-Agent/out/make/triggercmdagent-1.0.1.x86_64.rpm s3://triggercmdagents --acl public-read
    cp /root/github/TRIGGERcmd-Agent/src/* /root/nogui-node-debAgent/src
    cd /root/nogui-node-debAgent
    node-deb -- package.json src/ node_modules LICENSE
    aws s3 cp ./triggercmdagent_1.0.1_all.deb s3://triggercmdagents --acl public-read
    curl -X POST -H 'authorization: Bearer (my token)' -H 'content-type: application/json' -d '{"computername":"Garage","triggername":"update agent"}'
    yum -y reinstall /root/github/TRIGGERcmd-Agent/out/make/triggercmdagent-1.0.1.x86_64.rpm
    systemctl restart triggercmdagent

    The second script on my Raspberry Pi does this:

    • Download the new version
    • Upgrade the agent
    • Restart the background service
    #!/bin/sh -x
    cd /root
    rm triggercmdagent_1.0.1_all.deb
    dpkg -i triggercmdagent_1.0.1_all.deb
    systemctl restart triggercmdagent

    Previous blog entry

Log in to reply

Looks like your connection to TRIGGERcmd Forum was lost, please wait while we try to reconnect.