Giter Site home page Giter Site logo

foomo / gograpple Goto Github PK

View Code? Open in Web Editor NEW
1.0 15.0 2.0 9.11 MB

go grapple that go program ...

License: MIT License

Makefile 0.46% Go 96.22% Dockerfile 0.90% Smarty 2.43%
golang k8s debugging debugging-tool kubernetes remote-debug remote-debugging delve helper

gograpple's Introduction

gograpple

gograpple that go program and delve into the high seas ... or in other words: delve debugger injection for your golang code running in k8 pods

requirements

  • helm
  • kubectl
  • docker

quick start

brew install foomo/gograpple/gograpple
OR
go install github.com/foomo/gograpple@latest

start patch debugging in interactive mode

gograpple interactive

when you configure your patch correctly a file will be saved in your cwd and the debug session will start immmediatelly

configuration

patch (default)

field default value description
source_path absolute path to the main.go (entrypoint)
cluster cluster context to use
namespace kubernetes namespace
deployment kubernetes deployment
container pod container to use
listen_addr 127.0.0.1:2345 address to listen on for delve server
image alpine:latest image to use as base when building the patch
delve_continue false continue the debugged process on start
launch_vscode false launch vscode with debug config

example config explained

if we use the following gograppe-patch example:

source_path: /home/runz0rd/dev/backend/cmd/search/search.go
cluster: gke_my-awesome-webshop-stage_europe-west1_default
namespace: stage-a
deployment: search-service-default
container: search
listen_addr: 127.0.0.1:2345
source_path: alpine:latest
delve_continue: false
launch_vscode: true

the following will happen:

  • your application at specified source_path will be built with base image image into a patch image
  • that patch image will be pushed into the same repo as the image thats originally deployed, for example my-image-repo.com/backend/search-service:some-tag will be my-image-repo.com/backend/search-service-patch:latest
  • the deployment you specified in namespace and cluster will be patched to allow running a delve server on it with your application
  • delve server will be started in your container and port-forwarded to be on listen_addr
  • if configured delve_continue will be applied on dlv startup and launch_vscode will simplify the debug session for vscode users

common issues

stuck with patched deployment

in case your deployment is styck in patched state, use

gograpple rollback [namespace] [deployment]

vscode

The debug session doesnt start until the entrypoint is triggered more than once.

Review and remove any extra breakpoints you may have enabled, that you dont need (Run and Debug > Breakpoints panel). Vscode seems to like them saved across projects.

gograpple's People

Contributors

dreadl0ck avatar franklinkim avatar janhalfar avatar loeffert avatar runz0rd avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

ekmixon runz0rd

gograpple's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.