Your new microservice local environment friend. This CLI tool allows you to define a configuration to do (or mix) both local applications (Go, NodeJS, Rust or others) and also forward other applications over Kubernetes in case you don't want to run them locally.
What Monday can do for you?
✅ Run your local applications
✅ Hot reload your applications automatically when a change is made locally
✅ Port-forward an application on Kubernetes (targeting a pod via label) or over SSH
✅ Auto reconnect when a port-forward connection is lost
✅ Forward multiple times the same port locally, using an hostname
Installation
Download binary
You can download the latest version of the binary built for your architecture here:
From sources
Optionally, you can download and build it from the sources. You have to retrieve the project sources by using one of the following way:
$ go get -u github.com/eko/monday
# or
$ git clone https://github.com/eko/monday.git
Install the needed vendors:
$ GO111MODULE=on go mod vendor
Then, build the binary (here, an example to run on Raspberry PI ARM architecture):
$ go build -o monday .
Usage
First, you have to initialize monday and edit your configuration file (you have a configuration example file here).
Run the following command and edit the ~/monday.yaml
configuration file just created for you:
⚠️ Important note: Because Monday tries to be your best dev tool and manage things for you, you have to give it some chances to help you in editing host file and manipulating network interface for IP/port mapping.
That's why I suggest to add your current user to the /etc/hosts
file access list and run Monday using the following alias:
sudo chmod +a "$USER allow read,write" /etc/hosts
alias monday='sudo -E -u $USER monday'
$ monday init
Once your configuration file is ready, you can simply run Monday:
$ monday
When you want to edit your configuration again, simply run this command to open it in your favorite editor:
$ monday edit
Configuration example
Here is a configuration example that allows you to see all the things you could do with Monday:
# Settings
gopath: /Users/vincent/golang # Optional, default to user's $GOPATH env var
# Local applications
<: &graphql-local
name: graphql
path: github.com/acme/graphql # Will find in GOPATH (as executable is "go")
executable: go
args:
- run
- cmd/main.go
<: &grpc-api-local
name: grpc-api
path: github.com/acme/grpc-api # Will find in GOPATH (as executable is "go")
executable: go
args:
- run
- main.go
<: &search-api-local
name: search-api
path: github.com/acme/search-api # Will find in GOPATH (as executable is "go")
executable: go
args:
- run
- main.go
<: &pub-front-local
name: pub-front
path: /Users/vincent/dev/pub-front
executable: npm
args:
- run
- start
<: &elasticsearch-local
name: elasticsearch
path: /Users/vincent/dev/docker
executable: docker
args:
- start
- -i
- elastic
# Kubernetes forwards
<: &kubernetes-context preprod
<: &graphql-forward
name: graphql
type: kubernetes
values:
context: *kubernetes-context
namespace: backend
labels:
app: graphql
hostname: graphql.svc.local # Optional
ports:
- 8080:8000
<: &grpc-api-forward
name: grpc-api
type: kubernetes
values:
context: *kubernetes-context
namespace: backend
labels:
app: grpc-api
hostname: grpc-api.svc.local # Optional
ports:
- 8080:8080
<: &search-api-forward
name: search-api
type: kubernetes
values:
context: *kubernetes-context
namespace: backend
labels:
app: search-api
hostname: search-api.svc.local # Optional
ports:
- 8080:8080
<: &pub-front-forward
name: pub-front
type: kubernetes
values:
context: *kubernetes-context
namespace: frontend
labels:
app: pub-front
hostname: pub-front.svc.local # Optional
ports:
- 8080:8080
<: &composieux-fr
name: composieux-fr
type: ssh
values:
remote: vincent@composieux.fr # SSH <user>@<hostname>
hostname: composieux.fr.svc.local # Optional
ports:
- 8080:80
# Projects
projects:
- name: full
local:
- *graphql-local
- *grpc-api-local
- *search-api-local
- *pub-front-local
- *elasticsearch-local
- name: graphql
local:
- *graphql-local
forward:
- *grpc-api-forward
- *search-api-forward
- *pub-front-forward
- name: forward-only
forward:
- *graphql-forward
- *grpc-api-forward
- *search-api-forward
- *pub-front-forward
Run tests
Test suite can be run with:
$ go test -v ./...