Skip to content

Commit 35b0ddc

Browse files
committed
chore: add aboutme package
1 parent 1c8bbf8 commit 35b0ddc

3 files changed

Lines changed: 16 additions & 103 deletions

File tree

Makefile

Lines changed: 7 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Some uses for short name:
33
# - Docker image name
44
# - Kubernetes service, rc, pod, secret, volume names
5-
SHORT_NAME := example
5+
SHORT_NAME := pkg
66

77
# Enable vendor/ directory support.
88
export GO15VENDOREXPERIMENT=1
@@ -14,55 +14,14 @@ VERSION := 0.0.1-$(shell date "+%Y%m%d%H%M%S")
1414
# Common flags passed into Go's linker.
1515
LDFLAGS := "-s -X main.version=${VERSION}"
1616

17-
# Docker Root FS
18-
BINDIR := ./rootfs
17+
all: build test
1918

20-
# Legacy support for DEV_REGISTRY, plus new support for DEIS_REGISTRY.
21-
DEV_REGISTRY ?= $(eval docker-machine ip deis):5000
22-
DEIS_REGISTY ?= ${DEV_REGISTRY}
23-
24-
# Kubernetes-specific information for RC, Service, and Image.
25-
RC := manifests/deis-${SHORT_NAME}-rc.yaml
26-
SVC := manifests/deis-${SHORT_NAME}-service.yaml
27-
IMAGE := ${DEIS_REGISTRY}/deis/${SHORT_NAME}:${VERSION}
28-
29-
all:
30-
@echo "Use a Makefile to control top-level building of the project."
31-
32-
# This illustrates a two-stage Docker build. docker-compile runs inside of
33-
# the Docker environment. Other alternatives are cross-compiling, doing
34-
# the build as a `docker build`.
19+
# This builds .a files, which will be placed in $GOPATH/pkg
3520
build:
36-
mkdir -p ${BINDIR}/bin
37-
docker run --rm -v ${PWD}:/app -w /app golang:1.5.1 make docker-compile
38-
39-
# For cases where build is run inside of a container.
40-
docker-compile:
41-
go build -o ${BINDIR}/bin/boot -a -installsuffix cgo -ldflags ${LDFLAGS} boot.go
42-
43-
# For cases where we're building from local
44-
# We also alter the RC file to set the image name.
45-
docker-build:
46-
docker build --rm -t ${IMAGE} rootfs
47-
perl -pi -e "s|[a-z0-9.:]+\/deis\/${SHORT_NAME}:[0-9a-z-.]+|${IMAGE}|g" ${RC}
48-
49-
# Push to a registry that Kubernetes can access.
50-
docker-push:
51-
docker push ${IMAGE}
52-
53-
# Deploy is a Kubernetes-oriented target
54-
deploy: kube-service kube-rc
55-
56-
# Some things, like services, have to be deployed before pods. This is an
57-
# example target. Others could perhaps include kube-secret, kube-volume, etc.
58-
kube-service:
59-
kubectl create -f ${SVC}
21+
go build ./...
6022

61-
# When possible, we deploy with RCs.
62-
kube-rc:
63-
kubectl create -f ${RC}
23+
test:
24+
go test $(shell glide nv)
6425

65-
kube-clean:
66-
kubectl delete rc deis-example
6726

68-
.PHONY: all build docker-compile kube-up kube-down deploy
27+
.PHONY: all build test

README.md

Lines changed: 8 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,15 @@
1-
# Prototype Component Repo
1+
# Deis Pkg
22

3-
This repo is a prototype for what a Deis component's Git repository
4-
should look like.
3+
The Deis Pkg project contains shared Go libraries that are used by
4+
several Deis projects.
55

6-
A Deis component is...
6+
## Usage
77

8-
- An isolated piece of functionality (e.g. a microservice)
9-
- That can be packaged into a container (via `docker build`)
10-
- And can be run inside of Kubernetes
11-
12-
Typically, Deis components are written in Go.
13-
14-
## Practical Usage
15-
16-
If you want to experiment with creating a new repo using this framework,
17-
try something like this:
8+
Add this project to your `vendor/` directory using Godeps or
9+
[glide](https://github.com/Masterminds/glide):
1810

1911
```
20-
$ mkdir my_project
21-
$ cd my_project
22-
$ curl -fsSL https://github.com/technosophos/prototype-repo/archive/master.tar.gz | tar -zxv --strip-components 1
12+
$ glide get --import github.com/deis/pkg
2313
```
2414

25-
## First-Class Kubernetes
26-
27-
Every component must define the appropriate Kubernetes files.
28-
Preferably, components should use *Replication Controllers* over pods,
29-
and use *Services* for autodiscovery.
30-
31-
*Labels* should be used for versioning components and also for
32-
identifying components as part of Deis.
33-
34-
*Secrets* should be used for storing small bits of shared information,
35-
and their contents may be set at startup time.
36-
37-
All Kubernetes definitions should be placed in the `manifests/` directory.
38-
39-
The _Makefile_ should have targets that use `kubectl` to load
40-
definitions into Kubernetes.
41-
42-
## Dockerfiles are for Running
43-
44-
Source code should be built either outside of Docker or in a special
45-
Docker build phase.
46-
47-
A separate Dockerfile should be used for building the image. That
48-
Dockerfile should always be placed inside of the `rootfs` directory, and
49-
should manage the final image size appropriately.
50-
51-
(See the Makefile for one possible way of doing a Docker build phase)
52-
53-
## RootFS
54-
55-
All files that are to be packaged into the container should be written
56-
to the `rootfs/` folder.
57-
58-
## Extended Testing
59-
60-
Along with unit tests, Deis values functional and integration testing.
61-
These tests should go in the `_tests` folder.
15+
(The `--import` flag will get any additional dependencies.)

aboutme/aboutme.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
"os"
1717
"strings"
1818

19-
"github.com/deis/deis/pkg/k8s"
19+
"github.com/deis/pkg/k8s"
2020

2121
"k8s.io/kubernetes/pkg/api"
2222
"k8s.io/kubernetes/pkg/client/unversioned"

0 commit comments

Comments
 (0)