Skip to content
This repository has been archived by the owner on May 11, 2022. It is now read-only.

Commit

Permalink
issue #4: add How to section
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilsk committed May 16, 2019
1 parent 6bc2a86 commit 54d41ff
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 4 deletions.
Binary file added .github/goland_integration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 50 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,60 @@

In [Avito](https://tech.avito.ru) 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](https://github.com/kubernetes/minikube) provides.
For that reason, I need a possibility to up services written on Go locally from IDE like
[GoLand](https://www.jetbrains.com/go/) without losing the benefits that
[minikube](https://github.com/kubernetes/minikube) provides.

## The concept

```bash
$ lift env > .env
$ eval $(lift up)
```

## How to

0. Describe your dependencies and storage in `app.toml`.

1. Define everything you need in `env_vars` and `envs.local.env_vars`. See [example](testdata/app.toml).

2. Dump environment variables into `.env` file

```bash
$ lift env > bin/.env
```

3. Use it in your IDE with [EnvFile](https://plugins.jetbrains.com/plugin/7861-envfile) plugin

![GoLand integration](.github/goland_integration.png)

4. Forward required ports using `kubectl port-forward`

- or use my other tool named [forward](https://github.com/kamilsk/forward) for that

```bash
$ lift forward
forward -- demo-local-postgresql- 5432 demo-local-redis- 6379

$ eval $(lift forward)
```

5. or run all together

```bash
$ lift up
export SERVICE_A_URL="http://service-a.cluster/";
export SERVICE_C_URL="http://service-c.cluster/";
export SERVICE_B_URL="http://service-b.cluster/";
export PGHOST="localhost";
export PGPORT="5432";
export PGDATABASE="postgres";
export PGUSER="postgres";
export PGPASSWORD="";
export REDIS_PORT="6379";
export CUSTOM="variable";
forward -- demo-local-postgresql- 5432 demo-local-redis- 6379 &;
go run cmd/service/main.go;
ps | grep '[f]orward --' | awk '{print $1}' | xargs kill -SIGKILL

$ eval $(lift up)
```
Expand Down
2 changes: 1 addition & 1 deletion testdata/app.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name = "demo"
description = "Some demo service at Avito"
host = "demo.cluster"
kind = "business"
unit = "Highload"
unit = "SWAT"
replicas = 1

[engine]
Expand Down

0 comments on commit 54d41ff

Please sign in to comment.