Skip to content

Instantly share code, notes, and snippets.

@ehazlett
ehazlett / gist:8713753
Last active August 29, 2015 13:55
Shipyard Standalone

Shipyard Standalone

This describes how to launch Shipyard on a single machine.

Containers

  • docker run -i -t -d -p 6379 -name shipyard_redis shipyard/redis
  • docker run -i -t -d -p 80 -link shipyard_redis:redis -name shipyard_router shipyard/router
  • docker run -i -t -d -p 80:80 -link shipyard_redis:redis -link shipyard_router:app_router -name shipyard_lb shipyard/lb
  • docker run -i -t -d -p 5432 -e DB_PASS=1q2w3e -name shipyard_db shipyard/db
  • docker run -i -t -p 8000:8000 -e ADMIN_PASS=shipyard shipyard/shipyard app master-worker
@ehazlett
ehazlett / gist:9348225
Created March 4, 2014 15:13
Unable to import GPG key in private AWS VPC

Change --keyserver keyserver.ubuntu.com to --keyserver hkp://keyserver.ubuntu.com:80

@ehazlett
ehazlett / gist:9515069
Last active August 29, 2015 13:57
Deis Installation

Deis Private

Provision an instance for the Chef Server (must be >= 1G ram).

  • Create instance with Ubuntu 12.04 amd64

  • Install Chef Server: wget https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/12.04/x86_64/chef-server_11.0.11-1.ubuntu.12.04_amd64.deb -O /tmp/chef.deb ; sudo dpkg -i /tmp/chef.deb

  • Configure Chef Server: sudo chef-server-ctl reconfigure

  • Copy /etc/chef-server/admin.pem and /etc/chef-server/chef-validator.pem to client (I use a docker container)

  • Start Docker instance to configure: docker run -i -t -v /path/to/certs:/deis stackbrew/ubuntu:13.10 bash

  • Install deps: sudo apt-get install -y ruby1.9.1 ruby1.9.1-dev rubygems git-core

[2014-03-13T15:25:58+00:00] INFO: Sending resource update report (run-id: f9475138-be6e-4bdf-8c4c-f7e9c10d71be)
[2014-03-13T15:25:58+00:00] ERROR: service[deis-ablest-moonrise.web.1] (deis::runtime line 25) had an error: Chef::Exceptions::Exec: /sbin/start deis-ablest-moonrise.web.1 returned 1, expected 0
[2014-03-13T15:25:58+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
[2014-03-13 09:25:58,955: ERROR/MainProcess] Task api.tasks.converge_node[9f5f3166-3178-4f24-95a1-58ddb51c239e] raised unexpected: RuntimeError(u'Node converge error',)
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/celery/app/trace.py", line 238, in trace_task
R = retval = fun(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/celery/app/trace.py", line 416, in __protected_call__
return self.run(*args, **kwargs)
File "/app/deis/api/tasks.py", line 85, in converge_node
@ehazlett
ehazlett / gist:11068998
Created April 18, 2014 23:58
Go: CSV parsing
package main
import (
"encoding/csv"
"flag"
"fmt"
"io"
"os"
)
FROM debian:jessie
RUN apt-get update && apt-get install -y nginx-extras
EXPOSE 80
curl -H 'X-Service-Key: YOUR-SERVICE-KEY' 'http://shipyard-controller/api/engines' -XPOST -d '{"id": "foo", "engine": {"id": "foo", "addr": "http://172.16.1.50:2375", "cpus": 4.0, "memory": 4096, "labels": ["testing"] } }'
curl -H 'X-Service-Key: YOUR-KEY' 'http://shipyard-host/api/servicekeys' -XPOST -q -d '{"description": "interlock test"}' | jq '.key'
@ehazlett
ehazlett / gist:ad74f022aa6b6fe659af
Created November 14, 2014 05:20
grid controller ec2 user data
#!/bin/bash
apt-get update
apt-get install -y curl
curl get.docker.io | sh -
docker run -it -d --restart=always -p 8080:8080 ehazlett/docker-grid controller
dev@shipyard ~/d/g/s/g/s/s/controller> go test
? github.com/shipyard/shipyard/controller [no test files]
dev@shipyard ~/d/g/s/g/s/s/controller> go test -v
? github.com/shipyard/shipyard/controller [no test files]
dev@shipyard ~/d/g/s/g/s/s/controller> go test ./...
? github.com/shipyard/shipyard/controller [no test files]
ok github.com/shipyard/shipyard/controller/manager 10.440s
? github.com/shipyard/shipyard/controller/middleware/access [no test files]
ok github.com/shipyard/shipyard/controller/middleware/auth 0.003s
dev@shipyard ~/d/g/s/g/s/s/controller> go test ./...