Commit 1df238df authored by Yuanle Song's avatar Yuanle Song
Browse files

v1.4.0 better support when running in docker env

- support reading configs from environment variable.
  all config key can be configured by env variable.
  This feature is introduced in wells 1.4.0.
- add another configuration file position /etc/{{name}}/{{name}}.conf
  to allow easier volume mount in kubernetes.
- ci-build docker run use go user
- add host and port in app default configuration
- replace pep8 by pycodestyle
parent 0d4f06b0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
(defproject python/lein-template "1.3.1"
(defproject python/lein-template "1.4.0"
  :description "lein template for a python project"
  :repositories [["snapshots"
                  {:url "http://devserv.game.yy.com/nexus/content/repositories/snapshots"
+2 −2
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@ PYTHONPATH := .
VENV := .venv
PYTEST := env PYTHONPATH=$(PYTHONPATH) PYTEST=1 $(VENV)/bin/py.test
PYLINT := env PYTHONPATH=$(PYTHONPATH) $(VENV)/bin/pylint --disable=I0011 --msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}"
PEP8 := env PYTHONPATH=$(PYTHONPATH) $(VENV)/bin/pep8 --repeat --ignore=E202,E501,E402
PEP8 := env PYTHONPATH=$(PYTHONPATH) $(VENV)/bin/pycodestyle --repeat --ignore=E202,E501,E402,W504
PYTHON := env PYTHONPATH=$(PYTHONPATH) $(VENV)/bin/python
PIP := $(VENV)/bin/pip

@@ -83,7 +83,7 @@ just-test:
# image and push image on host.
ci-build:
	docker login -u $(DOCKER_USER) -p $(DOCKER_PASSWORD) $(BUILD_DOCKER_IMAGE)
	docker run --rm --name {{ name }}-test -v "$(CURDIR)":/app $(BUILD_DOCKER_IMAGE) make test deb -C /app
	docker run --rm --name {{ name }}-test -v "$(CURDIR)":/app -u $(shell id -u go):$(shell id -g go) $(BUILD_DOCKER_IMAGE) make test deb -C /app
	docker build -t $(DOCKER_IMAGE_PREFIX)/{{ name }}:$(VERSION) .
	docker push $(DOCKER_IMAGE_PREFIX)/{{ name }}:$(VERSION)
deploy:
+4 −1
Original line number Diff line number Diff line
@@ -26,6 +26,8 @@ if TESTING:
    logging.getLogger('').setLevel(logging.ERROR)

DEFAULTS = {
    "host": "127.0.0.1",
    "port": "8082",
    "db.host": "localhost",
    "db.port": "5432",
    "db.name": "{{name}}",
@@ -43,7 +45,8 @@ REQUIRED_KEYS = [

CONF = ConfigurationManger(defaults=DEFAULTS,
                           configfiles=["/opt/{{name}}/conf/{{name}}.conf",
                                        "/etc/{{name}}.conf"],
                                        "/etc/{{name}}.conf",
                                        "/etc/{{name}}/{{name}}.conf"],
                           required_keys=REQUIRED_KEYS,
                           optional_keys=OPTIONAL_KEYS)

+3 −3
Original line number Diff line number Diff line
pytest==3.0.7
pylint==1.6.5
pep8==1.7.0
pytest==3.5.1
pylint==1.8.4
pycodestyle==2.4.0
+1 −1
Original line number Diff line number Diff line
wells==1.1.0
wells==1.4.0
# six==1.10.0
# raven==6.0.0