Relinker hackery

Posted on Apr 5, 2018 3 mins read


Overview

The idea of a relinker is pretty simple. It's basically an internal version of Google's URL shortner. The internal part is important because it's all about keeping things internal.

What we want to create at the end of this is the ability to use or local browser and hit http://go/ to get to the webui for relinker. Then, once we have a link loaded, we can simply type something like "go/s" in our browser and know that it'll go to wherever "s" is pointed at.

This works really well for local develoopment, and in many ways it's basically just a weird way of creating a bizare kind of bookmarking system that runs in the cloud. However, it gets really useful when we look at a few interesting aspects of why we would do this:

  1. It proves out the container story, which can be useful for companies that are new to the containerization journey
  2. It allows for something called telepresence which allows us to run the local container with the remote database connection.
  3. If we get the IT folks on board, they can wire in an office DNS entry so that we don't need a local docker container to redirect to the cloud service.

The trippy part about this is how we do the redirection. This document assumes that we have a macbook running VirtualBox where VBox is running a debian VM ( or similar ). You could probably do the same thing with docker-engine or similar. Basically we have to hack our local dns on the macbook as such:

127.0.0.1 go

Then we have a docker container on the debian VM that redirects :80 to our cloudy instance. We'll get into how this is wired up later. We use the local redir hack if we don't have IT buyin quite yet. This is often the case when we want to prove things out before we actually start playing with things.

Layout

  • Mongodb for storing stuff. We assume, at least for now, that this is going to be transient, which is fine.
  • Relinker docker container that connects to the mongodb container.
  • ECS because containers are awesome.
  • Local redir container running in debian.

Plan

  1. First, we'll set up our local environment using docker-compose and the like.
  2. Deploy ECS cluster
  3. Deploy mongodb and relinker service.
  4. Wire everything up end to end

Build locally

 cd web
 ./api.rb

Now we can play around with the UI.

    amazon-ecs:     Chef::Exceptions::Service
    amazon-ecs:     -------------------------
    amazon-ecs:     service[procps]: Service is not known to chkconfig.
    amazon-ecs: Profile Summary: 48 successful controls, 4 control failures, 2 controls skipped
    amazon-ecs: Test Summary: 117 successful, 6 failures, 2 skipped
    amazon-ecs:   ×  package-08: Install auditd (1 failed)
    amazon-ecs:      ✔  System Package audit should be installed
    amazon-ecs:      ✔  Audit Daemon Config log_file should cmp == "/var/log/audit/audit.log"
    amazon-ecs:      ✔  Audit Daemon Config log_format should cmp == "raw"
    amazon-ecs:      ✔  Audit Daemon Config flush should match /^INCREMENTAL|INCREMENTAL_ASYNC$/
    amazon-ecs:      ×  Audit Daemon Config max_log_file_action should cmp == "keep_logs"
    amazon-ecs: Profile Summary: 52 successful controls, 0 control failures, 2 controls skipped
    amazon-ecs: Test Summary: 123 successful, 0 failures, 2 skipped

Path

  • /shatterdome
    • /clusters
      • /cluster_type_name
 cloudformation

Share This Post