Skip to content

Instantly share code, notes, and snippets.

@kpettijohn
Created October 30, 2016 22:09
Show Gist options
  • Select an option

  • Save kpettijohn/e816a86b10495ee6cf7070872e11c1e6 to your computer and use it in GitHub Desktop.

Select an option

Save kpettijohn/e816a86b10495ee6cf7070872e11c1e6 to your computer and use it in GitHub Desktop.

Revisions

  1. kpettijohn created this gist Oct 30, 2016.
    28 changes: 28 additions & 0 deletions bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    #!/bin/bash
    # Install
    # - Consul agent
    # - Prometheus node_exporter
    # - Jenkins

    curl -O -L -s https://github.com/prometheus/node_exporter/releases/download/v0.13.0-rc.1/node_exporter-0.13.0-rc.1.linux-amd64.tar.gz
    curl -O -L -s https://releases.hashicorp.com/consul/0.7.0/consul_0.7.0_linux_amd64.zip

    unzip consul_0.7.0_linux_amd64.zip
    mv consul /usr/bin/consul

    tar xf node_exporter-0.13.0-rc.1.linux-amd64.tar.gz
    mv node_exporter-0.13.0-rc.1.linux-amd64/node_exporter /usr/local/bin/node_exporter

    mkdir -p /var/node_exporter/textfile
    mkdir -p /etc/consul /etc/consul.d /var/consol/data

    # Cleanup
    rm -rf node_exporter-0.13.0-rc.1.linux-amd64.tar.gz node_exporter-0.13.0-rc.1.linux-amd64/ consul_0.7.0_linux_amd64.zip

    # Install Jenkins
    yum install java-1.8.0-openjdk.x86_64
    wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
    rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
    yum install jenkins
    systemctl enable jenkins
    systemctl start jenkins
    10 changes: 10 additions & 0 deletions consul_agent.service
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    [Unit]
    Description=Consul agent - client
    After=syslog.target network.target

    [Service]
    Type=simple
    ExecStart=/usr/bin/consul agent -config-dir /etc/consul -config-dir /etc/consul.d -join 10.0.0.10 -join 10.0.0.11 -join 10.0.0.12

    [Install]
    WantedBy=multi-user.target
    7 changes: 7 additions & 0 deletions consul_client.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    {
    "datacenter": "hbc",
    "data_dir": "/var/consul/data",
    "encrypt": "my_secret_key",
    "log_level": "info",
    "enable_syslog": true
    }
    15 changes: 15 additions & 0 deletions jenkins_consul_service.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    {
    "service": {
    "name": "jenkins",
    "tags": ["master"],
    "address": "127.0.0.1",
    "port": 8080,
    "enableTagOverride": false,
    "checks": [
    {
    "http": "http://localhost:8080/login",
    "interval": "10s"
    }
    ]
    }
    }
    10 changes: 10 additions & 0 deletions node_exporter.service
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    [Unit]
    Description=Prometheus node_exporter - Exporter for machine metrics
    After=syslog.target network.target

    [Service]
    Type=simple
    ExecStart=/usr/local/bin/node_exporter --collector.textfile.directory /var/node_exporter/textfile --collectors.enabled systemd,textfile,conntrack,diskstats,entropy,filefd,filesystem,loadavg,meminfo,netdev,netstat,stat,time,vmstat

    [Install]
    WantedBy=multi-user.target