Skip to content

Commit

Permalink
deploy core itself
Browse files Browse the repository at this point in the history
  • Loading branch information
CMGS committed Oct 13, 2017
1 parent 3805d11 commit 8f82128
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 3 deletions.
6 changes: 4 additions & 2 deletions Makefile
@@ -1,4 +1,4 @@
.PHONY: golang python deps build test
.PHONY: grpc deps build test binary

REPO_PATH := github.com/projecteru2/core
REVISION := $(shell git rev-parse HEAD || unknown)
Expand All @@ -17,9 +17,11 @@ deps:
rm -rf ./vendor/github.com/docker/docker/vendor
rm -rf ./vendor/github.com/docker/distribution/vendor

build: deps
binary:
go build -ldflags "$(GO_LDFLAGS)" -a -tags netgo -installsuffix netgo -o eru-core

build: deps binary

test: deps
# fix mock docker client bug, see https://github.com/moby/moby/pull/34383 [docker 17.05.0-ce]
sed -i.bak "143s/\*http.Transport/http.RoundTripper/" ./vendor/github.com/docker/docker/client/client.go
Expand Down
22 changes: 21 additions & 1 deletion README.md
Expand Up @@ -59,7 +59,7 @@ $ export ERU_CONFIG_PATH=/path/to/core.yaml
$ eru-core
```

### Dockerized Core
### Dockerized Core manually

Image: [projecteru2/core](https://hub.docker.com/r/projecteru2/core/)

Expand All @@ -73,3 +73,23 @@ docker run -d \
projecteru2/core \
/usr/bin/eru-core
```

### Build and Deploy by Eru itself

After we implemented bootstrap in eru2, now you can build and deploy agent with [cli](https://github.com/projecteru2/cli) tool.

1. Test source code and build image

```shell
<cli_execute_path> --name <image_name> https://goo.gl/KTGJ9k
```

Make sure you can clone code by ssh protocol because libgit2 ask for it. So you need configure core with github certs. After the fresh image was named and tagged, it will be auto pushed to the remote registry which was defined in core.

2. Deploy core itself

```shell
<cli_execute_path> --pod <pod_name> [--node <node_name>] --entry core --network <network_name> --image <projecteru2/core>|<your_own_image> --count <count_num> [--cpu 0.3 | --mem 1024000000] https://goo.gl/KTGJ9k
```

Now you will find core was started in nodes.
44 changes: 44 additions & 0 deletions app.yaml
@@ -0,0 +1,44 @@
appname: "eru"
entrypoints:
core:
cmd: "/usr/bin/eru-core"
restart: always
publish:
- "5001"
healthcheck:
ports:
- "5001/tcp"
log_config: "journald"
volumes:
- <HOST_CONFIG_DIR_PATH>: /etc/eru
- <HOST_BACKUP_DIR_PATH>: /data/backup
stages:
- build
- pack
builds:
build:
base: "projecteru2/footstone:latest"
# only support ssh protocol
repo: "git@github.com:projecteru2/core.git"
version: "HEAD"
dir: /.go/src/github.com/projecteru2/core
commands:
- make test
- make binary
cache:
/.go/src/github.com/projecteru2/core/eru-core: /usr/bin/eru-core
/.go/src/github.com/projecteru2/core/core.yaml.sample: /etc/eru/core.yaml.sample
# envs:
# HTTP_PROXY: <HTTP_PROXY>
# HTTPS_PROXY: <HTTPS_PROXY>
pack:
base: alpine:3.6
labels:
ERU: 1
version: latest
core: 1
envs:
CORE_IN_DOCKER: 1
commands:
- mkdir -p /etc/eru/

0 comments on commit 8f82128

Please sign in to comment.