Skip to content

Instantly share code, notes, and snippets.

View RichardHightower's full-sized avatar

Richard Hightower RichardHightower

View GitHub Profile

installing aws on a box (logged in as su)

mkdir /tmp/awscli; cd /tmp/awscli
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
unzip awscli-bundle.zip
 ./awscli-bundle/install -i /usr/lib/aws -b /usr/bin/aws
 
@RichardHightower
RichardHightower / ansible_java_ec2_install.md
Last active March 3, 2017 01:49
Using ansible to install Java on an ec2 box running in the cloud

I am writing this down so I don't forget. I started this task but had to stop a few times, and then remember where I left off and at some point, others will need to know how to get started.

Install ansible

brew install ansible

Install Amazon EC2 Ansible integration tool

@RichardHightower
RichardHightower / logback.xml
Last active August 24, 2016 17:55
Java setup for Mesos/Gradle/QBit zip that uses logback/sl4j and virtual hosting
<configuration>
<appender name="STASH-UDP" class="net.logstash.logback.appender.LogstashSocketAppender">
<host>${LOGSTASH_HOST:-192.168.99.100}</host>
<port>${LOGSTASH_PORT:-5001}</port>
<customFields>{"serviceName":"sample-dcos-qbit","serviceHost":"${HOST}","servicePort":"${PORT0}","serviceId":"sample-dcos-qbit-${HOST}-${PORT0}","serviceAdminPort":"${PORT1}"}</customFields>
</appender>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
@RichardHightower
RichardHightower / install_docker.sh
Created August 21, 2016 00:37
Installing lab env
## Setup docker repo
sudo apt-get install apt-transport-https ca-certificates
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo touch /etc/apt/sources.list.d/docker.list
sudo echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" > /etc/apt/sources.list.d/docker.list
## Install Docker
sudo apt-get update
sudo apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
@RichardHightower
RichardHightower / consul.md
Last active July 19, 2017 05:49
consul setup on mesos / coreos

We are having troubles talking to Mesos DNS if our Marathon application / service has two ports.

We could use mesos consul https://hub.docker.com/r/ciscocloud/mesos-consul/ but that would require a consul cluster.

The following are instructions to install consul on dcos/mesos/coreos. This may not be the best way. Coreos does have a package manager (but we don't know how to use it). At a minimum we should script this with ansible. (We are not ansible experts either).

So far, I have been unable to get mesos-consul to work but consul is running on the mesos-masters and mesos-slaves in a special snowflake fashion.

@RichardHightower
RichardHightower / foo.md
Created August 15, 2016 23:11
Installing exhibitor....
$ dcos package install exhibitor
We recommend a minimum of three nodes with 3GB of RAM available.
Continue installing? [yes/no] yes
Installing Marathon app for package [exhibitor] version [1.0.0]
Object is not valid
got 1.0, expected 0.5 or less
got 1.0, expected 0.0
must be false

/etc/logstash/conf.d

The key is that it is ok to have many logstash processes running with different input and output filters. And we need json in and json out for UDP. The non UDP/JSON versions do not seem to work with extra fields/MDC. The output encoder moving from logstash and into kibana was wrong so it would black hole all of our logs from logback.

# cat 50-udp.conf 

input {
    udp {
        port => 5001
@RichardHightower
RichardHightower / TwoAsyncCalls.java
Last active July 7, 2016 19:20
Make two async calls and not returning until both come back or fail
override fun removeArtistFromSystem(artistId: Long): Promise<Boolean> {
return Promises.invokablePromise { promise ->
val saveSystemDataPromise = Promises.promiseBoolean()
.catchError { e -> logger.info("removeArtistFromSystem:: unable to save system data for $artistId", e) }
val removeArtistFromSystemPromise = Promises.promiseBoolean()
.catchError { e -> logger.info("removeArtistFromSystem:: unable to remove $artistId from repo", e) }
Promises.all(saveSystemDataPromise, removeArtistFromSystemPromise)
interface Config {
    String getString(String path);
    int getInt(String path);
    float getFloat(String path);
    double getDouble(String path);
    long getLong(String path);
    Map<String, Object> getMap(String path);
  T getObject(String path, Class type);
@RichardHightower
RichardHightower / setup_for_logback_logstash.md
Created April 20, 2016 02:15
Logstash Logback setup for Mesosphere for debugging distributed microservices

Logstash and Logback setup for running in Mesosphere.

.../salt/logstash/files/conf.d/input-json.conf

input {
  udp {
    port => 5000
    codec => "json"
  }