Skip to content
πŸ‹οΈβ€β™‚οΈ Up your service locally.
Go Shell Makefile
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
bin
internal
testdata
tools integrate tools Sep 1, 2019
vendor
.gitattributes automate build May 13, 2019
.gitignore
.goreleaser.yml
.travis.yml
LICENSE
Makefile
README.md
go.mod update deps and improve code Sep 1, 2019
go.sum
main.go
pkg_test.go remove cc-test-reporter May 15, 2019

README.md

πŸ‹οΈβ€β™‚οΈ lift

Up your service locally.

Build

πŸ’‘ Idea

$ eval $(lift up)

Full description of the idea is available here.

πŸ† Motivation

In Avito we have an excellent PaaS which helps us to run our services in Kubernetes clusters with just a few commands. But I want to run it so quickly and frequently as possible to debug during development. For that reason, I need a possibility to up services written on Go locally from IDE like GoLand without losing the benefits that minikube provides.

πŸ€Όβ€β™‚οΈ How to

  1. Describe your dependencies and storage in app.toml.

  2. Define everything you need in env_vars and envs.local.env_vars. See an example.

  3. Dump environment variables into .env file

$ lift env > bin/.env
  1. Use it in your IDE with EnvFile plugin

GoLand integration

  • πŸ”¦ tip: use shift + cmd + . to see hidden dot files
  1. Forward required ports using kubectl port-forward, or use my other tool named forward for that
$ eval $(lift forward)
  1. or run all together
$ eval $(lift up -- go run cmd/service/main.go); eval $(lift down)

$ eval $(lift forward -d)
$ lift call -- go run cmd/service/main.go
$ eval $(lift down)

Good to have

.PHONY: format
format:
	@lift call -- goimports -local '$$GOMODULE' -ungroup -w .

.PHONY: lift
lift:
	@lift env > bin/.env

.PHONY: up
up:
	@avito start
	@avito service dev --no-watch
	@nohup $$(lift forward) &

.PHONY: status
status:
	@minikube status
	@kubectl get pod

.PHONY: forward
forward:
	@eval $$(lift forward)

.PHONY: down
down:
	@-avito service deletelocal
	@-eval $$(lift down)

goimports integration

🧩 Installation

Homebrew

$ brew install kamilsk/tap/lift

Binary

$ curl -sfL https://bit.ly/install-lift | bash

Source

# use standard go tools
$ go get -u github.com/kamilsk/lift
# or use egg tool
$ egg github.com/kamilsk/lift -- go install .
$ egg bitbucket.org/kamilsk/lift -- go install .

egg1 is an extended go get.

Bash and Zsh completions

$ lift completion bash > /path/to/bash_completion.d/lift.sh
$ lift completion zsh  > /path/to/zsh-completions/_lift.zsh

🀲 Outcomes

Patches

1 The project is still in prototyping.↩


made with ❀️ for everyone

You can’t perform that action at this time.