Deliverables!

Build

  • Builds code
  • Gets vendor dependencies
  • Publishes artifacts

build process per-repository

artifactory - platform segregated

Installation

  • Lays down the files
  • Manages versions
  • Runs scripts

Windows:

MSI (WIX)

Centos:

RPM (FPM)

OS Service Management

  • Starts / restarts process
  • Provides management
  • Handles log output

Windows:

NSSM

Centos:

systemd

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
     xmlns:fire="http://schemas.microsoft.com/wix/FirewallExtension"
        >
    <!-- The following must be defined via -d for candle.exe -->
    <!-- <?define ProductKey="spike" ?>  this is the root of various files, such as input, output installer, etc.-->
    <!-- <?define ProductVersion="0.0.1" ?> -->
    <!-- <?define UpgradeCode="3993798E-2D72-4EEA-B4FD-5B8D501CA3B2"?> -->
    <!-- <?define name="Logrhythm Product Name" ?> -->

    <Product
            Id="*" Name='$(var.name)'
            Language="1033"
            Codepage="utf-8"
            Version='$(var.version)'
            Manufacturer='LogRhythm'
            UpgradeCode='$(var.upgrade_code)'>

        <Package
                InstallerVersion="300"
                Compressed="yes"
                InstallScope="perMachine"
                Platform="x64"/>

        <MajorUpgrade
                AllowSameVersionUpgrades="yes"
                DowngradeErrorMessage="A newer version of [name] is already installed."/>

        <MediaTemplate EmbedCab="yes"/>

        <Icon Id="LogRhythm.ico" SourceFile="$(var.script_root)\LogRhythm.ico"/>
        <Property Id="ARPPRODUCTICON" Value="LogRhythm.ico"/>

        <Feature Id="ProductFeature" Title="$(var.name)" Level="1">
            <ComponentGroupRef Id="include_files_components"/>
            <ComponentGroupRef Id="install_sequence_components"/>
            <ComponentRef Id="firewall_rules_component"/>
            <!-- INJECT:cplusplus_feature -->
        </Feature>


        <!-- INJECT:custom_actions -->

        <!-- INJECT:firewall_rules -->

        <!-- INJECT:visual_cplusplus -->

    </Product>

    <Fragment>
        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="ProgramFiles64Folder">
                <Directory Id="INSTALLROOT" Name="LogRhythm">
                  <Directory Id="INSTALLFOLDER" Name='$(var.name)'>
                  </Directory>
                </Directory>
            </Directory>
        </Directory>
    </Fragment>

    <!-- INJECT:include_files -->

</Wix>
$ fpm -s dir -t rpm -n LogRhythmAPIGateway \
-v 1.0.1.0 -a all --rpm-user LogRhythmAPIGateway \
--rpm-group LogRhythmAPIGateway \
--directories /usr/local/logrhythm/LogRhythmAPIGateway \
-p /root/local/ApiGateway/tmp/LogRhythmAPIGateway-1.0.1.0.noarch.rpm \
--after-upgrade /root/local/ApiGateway/tmp/__after_upgrade.sh \
--after-install /root/local/ApiGateway/tmp/__after_install.sh \
--before-upgrade /root/local/ApiGateway/tmp/__before_upgrade.sh \
--before-remove /root/local/ApiGateway/tmp/__before_remove.sh \
--before-install /root/local/ApiGateway/tmp/__before_install.sh \
./openssl.cnf=/usr/local/logrhythm/LogRhythmAPIGateway/ \
./nginx.conf=/usr/local/logrhythm/LogRhythmAPIGateway/ \
./nginx.bat=/usr/local/logrhythm/LogRhythmAPIGateway/ \
./nginx.sh=/usr/local/logrhythm/LogRhythmAPIGateway/ \
./conf.d=/usr/local/logrhythm/LogRhythmAPIGateway/ \
./logs=/usr/local/logrhythm/LogRhythmAPIGateway/ \
./temp=/usr/local/logrhythm/LogRhythmAPIGateway/ \
./.proc=/usr/local/logrhythm/LogRhythmAPIGateway/ \
./restart.bat=/usr/local/logrhythm/LogRhythmAPIGateway/ \
./vendor=/usr/local/logrhythm/LogRhythmAPIGateway/ \
/root/local/ApiGateway/tmp/LogRhythmAPIGateway.service=/usr/lib/systemd/system/

Platform specific implementations...

Enter: buildScripts

{
  "name": "LogRhythm API Gateway",
  "description": "API Gateway for all LogRhythm Services",
  "version": "1.1.0",
  "artifact_id": "api-gateway",
  "guid": "738c7774-26c6-47e4-a39e-5412e37a87ec",
  "ports": [
    8501
  ],
  "vendor": {
    "nginx":"1.10.1",
    "procman":"1.0.0",
    "win/openssl" : "1.0.2g"
  },
  "command" : {
    "win" : ["%ROOT%vendor\\procman\\procman.exe"],
    "nix" : ["./vendor/procman/procman"],
    "osx" : []
  },
  "include_files": [
    "openssl.cnf",
    "nginx.conf",
    "nginx.bat",
    "nginx.sh",
    "conf.d",
    "logs",
    "temp",
    ".proc",
    "restart.bat"
  ],
  "after_install": {
    "win" : ["scripts/generate_cert.bat"],
    "nix" : ["scripts/generate_cert.sh"]
  }
}
#!/usr/bin/env python
import sys
from buildScripts.installer import Installer

BUILD_NUMBER = "0"
if len(sys.argv) > 1:
    BUILD_NUMBER = sys.argv[1]

installer = Installer.from_json_file('./installer.json', BUILD_NUMBER)
installer.build()
#!/usr/bin/env python
import sys
import platform
import buildScripts.vendor
import buildScripts.locations
from buildScripts.installer import Installer

BUILD_NUMBER = "0"
if len(sys.argv) > 1:
    BUILD_NUMBER = sys.argv[1]

installer = Installer.from_json_file('./installer.json', BUILD_NUMBER)
installer.get_vendors()

# Removes the npm directory after install, 
# as it creates a file path that is too long for windows
if platform.system() == "Windows":
    buildScripts.vendor.get("npm", "3.10.6")

buildScripts.vendor.npm_install(True)

if platform.system() == "Windows":
    buildScripts.locations.clean(buildScripts.vendor.get_vendor_dir('npm'))

installer.build()

Deliverables demo

By autoric

Deliverables demo

  • 584