Permalink
Browse files

Remove need for fetching consul config in dev. Remove uploadconfig fr…

…om run flow. Add flag to specify log level. Other minor.
  • Loading branch information...
vlad-alexandru-ionescu committed Apr 30, 2016
1 parent fe0f4f1 commit 85cc25d87702eef48e36365241878d0b63593c7d
Showing with 21 additions and 40 deletions.
  1. +5 −14 Makefile
  2. +1 −1 README.md
  3. +1 −1 config/config.go
  4. +5 −11 doc/contributing.md
  5. +1 −1 docker-compose.yml
  6. +8 −8 host/proxy.go
  7. +0 −4 services/leveroshost/dev.config.json
View
@@ -12,18 +12,19 @@ GO := go
# docker image. Note: Installing go is strongly recommended for contributing.
HAVE_GO := $(shell which $(GO))
export LEVEROS_DEBUG ?=
export LEVEROS_DEBUG ?= 0
export LEVEROS_REPO_DIR ?= $(abspath repo)
export LEVEROS_IP_PORT ?= $(shell which $(DOCKER_MACHINE) > /dev/null && test -n "$$DOCKER_MACHINE_NAME" && docker-machine ip "$$DOCKER_MACHINE_NAME" || echo 127.0.0.1):8080
export LEVEROS_LOG_LEVEL ?= info
GO_VERSION_ARGS := -ldflags "-X main.Version=$(VERSION) -X main.GitHash=$(GIT_HASH)"
GO_BUILD_ARGS := $(GO_VERSION_ARGS) \
$(shell test -n "$(LEVEROS_DEBUG)" && echo -race)
$(shell test "$(LEVEROS_DEBUG)" -eq 1 && echo -race)
# Most things will run in a docker container. They need to be compiled for
# linux/amd64.
export GOOS ?= linux
export GOARCH ?= amd64
export CGO_ENABLED ?= $(shell test -n "$(LEVEROS_DEBUG)" && echo 1 || echo 0)
export CGO_ENABLED ?= $(LEVEROS_DEBUG)
ifdef MSVC
UNAME_S := Windows
@@ -54,7 +55,6 @@ GODEPS_CONFIG := Godeps/Godeps.json
DBDATA_VOL := leveros_dbdata
ADMIN_ENV := admin.lever
MISC_PROCESSES := consul aerospike
LEVEROSHOST_CONFIG := services/leveroshost/dev.config.json
BUILD_DIR := build
BIN_DIR := $(BUILD_DIR)/bin
@@ -125,9 +125,7 @@ runcommon:
admin-env
$(DOCKER_COMPOSE) up -d --force-recreate $(MISC_PROCESSES)
sleep 1
$(MAKE) \
upload-config \
init-db-tables
$(MAKE) init-db-tables
$(DOCKER_COMPOSE) up --force-recreate leveroshost nghttpxext
.PHONY: install-cli
@@ -316,13 +314,6 @@ clean-dbdata:
init-db-tables: $(BIN_DIR)/inittables
./runasdocker.sh $<
.PHONY: upload-config
upload-config: $(BIN_DIR)/uploadconfig
EXTRA_DOCKER_ARGS="-v $(abspath $(LEVEROSHOST_CONFIG)):/leveros/$(notdir $(LEVEROSHOST_CONFIG)):ro" \
./runasdocker.sh $< \
--file "/leveros/$(notdir $(LEVEROSHOST_CONFIG))" \
--service leveroshost
#
# Admin bootstrap targets.
View
@@ -76,7 +76,7 @@ module.exports.sayHello = function (name, callback) {
Deploy your service locally
```bash
$ lever deploy dev.lever
$ lever deploy
```
This takes the whole current directory, archives it and deploys it onto Lever, in an environment that was created by default: `dev.lever`.
View
@@ -214,7 +214,7 @@ func parseArgs() {
var err error
entry.commandLineValue, err = parseFromString(arg, entry.flagType)
if err != nil {
log.Fatalf("Unable to parse flag %s\n", arg)
log.Fatalf("Unable to parse flag value for %s\n", arg)
}
expectValue = false
continue
View
@@ -7,31 +7,25 @@ Prerequisites
* Install make.
* Install golang and set GOROOT and GOPATH correctly.
* If not on linux/amd64, go needs to be able to cross-compile for linux/amd64.
(On Mac you can achieve this by installing go with this command:
`brew install go --with-cc-common`).
* If not on linux/amd64, go needs to be able to cross-compile for linux/amd64. (On Mac you can achieve this by installing go with this command: `brew install go --with-cc-common`).
* Install protoc from https://github.com/google/protobuf/releases (eg https://github.com/google/protobuf/releases/download/v3.0.0-beta-2/protoc-3.0.0-beta-2-linux-x86_64.zip). Put protoc in your PATH somewhere.
* `go get -u github.com/golang/protobuf/protoc-gen-go`
* `go get -u github.com/tools/godep`
* In leveros dir: `godep restore ./...`
* Install docker and docker-compose.
* Optional (for multi-node testing), install VirtualBox and docker-machine.
* Check that everything works with `make run` and (in a different terminal)
`make systest`.
* Check that everything works with `make run` and (in a different terminal) `make systest`.
* If something is broken, please open a GitHub issue.
Contributing
------------
Committed code must pass golint, go vet, gofmt and go test. Running `make test`
will check all of these.
Committed code must pass golint, go vet, gofmt and go test. Running `make test` will check all of these. Also, no more than 80 characters per line, please.
If your editor does not automatically call gofmt, `make fmt` will format all go
files for you.
If your editor does not automatically call gofmt, `make fmt` will format all go files for you.
Running the system tests is also recommended. To run them use `make run`
and (in a different terminal) `make systest`.
Running the system tests is also recommended. To run them use `make run` and (in a different terminal) `make systest`.
Misc recipes
------------
View
@@ -14,11 +14,11 @@ services:
ports:
- 127.0.0.1:6514:6514 # Dev logger.
command: >-
--config leveroshost
--service leveroshost
--containerName leveroshost
--dockerutil.leverCodeHostDir ${LEVEROS_REPO_DIR}
--dockerutil.disableRemoveContainer ${LEVEROS_DEBUG}
--leverutil.loggingLevel ${LEVEROS_LOG_LEVEL}
environment:
LEVEROS_IP_PORT: ${LEVEROS_IP_PORT}
View
@@ -24,14 +24,14 @@ var (
ConnectionConnectTimeoutFlag = config.DeclareDuration(
PackageName, "connectionConnectTimeout", 20*time.Second)
// ListenProxyExtFlag enables listening to the external interface
// DisableProxyExtFlag enables listening to the external interface
// (regional LB).
ListenProxyExtFlag = config.DeclareBool(
PackageName, "listenProxyExt")
// ListenProxyInOutFlag enables listening to requests going to or coming
DisableProxyExtFlag = config.DeclareBool(
PackageName, "disableProxyExt")
// DisableProxyInOutFlag enables listening to requests going to or coming
// from a local environment.
ListenProxyInOutFlag = config.DeclareBool(
PackageName, "listenProxyInOut")
DisableProxyInOutFlag = config.DeclareBool(
PackageName, "disableProxyInOut")
// EnvOutListenPortFlag is the environment listen port for outward
// connections. This port is accessible only from within the env network.
@@ -104,13 +104,13 @@ func NewLeverProxy(
proxy.inLogger = proxy.logger.WithFields("listener", "in")
proxy.outLogger = proxy.logger.WithFields("listener", "out")
proxy.extLogger = proxy.logger.WithFields("listener", "ext")
if ListenProxyExtFlag.Get() {
if !DisableProxyExtFlag.Get() {
err = proxy.serveExt()
if err != nil {
return nil, err
}
}
if ListenProxyInOutFlag.Get() {
if !DisableProxyInOutFlag.Get() {
err = proxy.serveIn()
if err != nil {
return nil, err
@@ -1,4 +0,0 @@
{
"host.listenProxyExt": true,
"host.listenProxyInOut": true
}

0 comments on commit 85cc25d

Please sign in to comment.