TRIGGERcmd
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Building and deploying the TRIGGERcmd Linux agent using TRIGGERcmd

    Blog
    1
    1
    961
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Russ
      Russ last edited by Russ

      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 https://github.com/rvmey/TRIGGERcmd-Agent
        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 https://www.triggercmd.com/api/run/triggerSave -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
        wget https://s3.amazonaws.com/triggercmdagents/triggercmdagent_1.0.1_all.deb
        dpkg -i triggercmdagent_1.0.1_all.deb
        systemctl restart triggercmdagent

      Previous blog entry

      Russell VanderMey

      1 Reply Last reply Reply Quote 0
      • First post
        Last post