Automating GWE install using software tools


#1

Hi @willcharlton

I’m trying to write a script that downloads latest version of GWE to a gateway and install it. Is there any such script that already exists? What are the error codes / success codes returned after the installation? How do I access these error codes? Is there a heartbeat register / progress meter to check the installation progress so that I can use that to interrupt my shell script and wait till I get a valid result code?

In short, please walk me through the process of automating the install. Thank you!

Kind regards,
Vijay.


#2

Hi Vijay,

This is something we do every day at Exosite and it is a well-paved path.

The following steps will largely depend on your environment, but will get you most of the way there. The examples use bash for scripting.

First, download the latest copy of GWE by using the curl command on the Release Packages page of the GWE docs: https://gateway-engine.exosite.io/release_packages.html#downloads

Example:

# note: some systems don't play nicely with the -k flag in curl
LATEST_RELEASE=$(
    basename \
        $(curl -v -k --remote-name \
            $(curl --silent -k https://s3-us-west-2.amazonaws.com/exosite-client-downloads/gateway-engine-release-area/gmq-master/latest.lnk) 2>&1 \
            | awk '/GET/{print $(NF-1)}' \
        )
)

This fetches a file called latest.lnk, and extracts the name of the latest published release of GWE, then downloads it and prints the name of the release to the env variable LATEST_RELEASE.

Copy the downloaded GWE tarball (e.g. GatewayEngine.v1.5.9.tar.gz) to your target gateway. The following example assumes your gateway is on, its IP address is 192.168.0.50 and sshd is running on the standard port:

GW_IPADDRESS=192.168.0.50
scp ${LATEST_RELEASE} root@${GW_IPADDRESS}:/tmp

Using the same shell, unpack the release onto the host system (gateway) and execute the installer:

ssh root@${GW_IPADDRESS} "
    cd /tmp
    tar zxvf ${LATEST_RELEASE}
    cd gateway-engine
    ./install.sh
"

This step generates a lot of output, but at the very end you should see the results of a self-test similar to this:

********************* Installation Summary : ******************************
Username: root
GWE Installed Successfully
'ez_setup.py' installation successful.
device-client: 1.5.2
gateway-engine: 1.5.9
Installation for elementtree.v126-20050316.tar.gz passed.
Installation for gmq.v1.2.8.tar.gz passed.
Installation for meld3.v102.tar.gz passed.
Installation for supervisor.v30.tar.gz passed.
Running self test...
Linux bebbe4c7f653 4.9.36-moby #1 SMP Fri Jul 14 17:47:34 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
x86_64
bebbe4c7f653
4.9.36-moby
Linux
x86_64
#1 SMP Fri Jul 14 17:47:34 UTC 2017
.......1.5.2
.device-client: 1.5.2
gateway-engine: 1.5.9
.1.2.8
.
----------------------------------------------------------------------
Ran 10 tests in 1.132s

OK
uname -a
uname -a
uname -m
uname -m
uname -n
uname -n
uname -r
uname -r
uname -s
uname -s
uname -p
uname -p
uname -v
uname -v
import json
Test 'import json' PASSED
import requests
Test 'import requests' PASSED
import twisted
Test 'import twisted' PASSED
import exo
Test 'import exo' PASSED
import GatewayEngine
Test 'import GatewayEngine' PASSED
import gmq
Test 'import gmq' PASSED
Test 'gdc --version' PASSED
Test 'gmq --version' PASSED
********************* Installation Complete ******************************

Sometimes failures are encountered but it isn’t always a show-stopper. If you see output from the installer that you find troubling or problematic, post it back onto this thread and we’ll help you figure out what’s going on.

Now that the installation is complete, configure the gateway to use your murano account. We can answer any specific questions about configuration, but you should find what you need as far as configuring GWE for your Murano account in the docs: https://gateway-engine.exosite.io/getting_started.html#configure-gwe


#3

Thanks @willcharlton. I’ll try this procedure and let you know if I have any issues.

Kind regards,
Vijay.