Author Archives: bullgare
Talk about pros and cons of GraphQL
Pros: Very flexible — clients decide which fields of which entities they need. Documentation and test UI are available by default. Cons: Code looks ugly. N+1 selects problem is hard to solve (most probably — with some ad-hoc). It’s harder to test as you don’t know all the use cases. Not a binary protocol — …
Datadog in a docker for integration tests and local dev
1 |
DOCKER_CONTENT_TRUST=1 docker run --rm --name dd-agent -p 8126:8126 -v /var/run/docker.sock:/var/run/docker.sock:ro -v /proc/:/host/proc/:ro -v /sys/fs/cgroup/:/host/sys/fs/cgroup:ro -e DD_API_KEY=REPLACE_WITH_NEW_KEY -e DD_SITE=datadoghq.eu datadog/agent |
Run virtual machine Ubuntu/Windows on m1 macos
There is a program called UTM based on QEMU and developed for m1 MacBook virtualization. At least Ubuntu Server is working fine for me. https://mac.getutm.app/guide/. More info on this — https://eshop.macsales.com/blog/72081-utm-virtual-machine-on-m1-mac/
Debugging go app in Jetbrains Goland on m1
First download a proper version of GoLand here — select .dmg (MacOS Apple Silicon) here (direct link — https://www.jetbrains.com/go/download/download-thanks.html?type=eap&platform=macM1&build=211.6556.11&code=GO). Then make sure you are using arm version of go (go version go1.16.2 darwin/arm64). If not, download and install arm version of golang (like «go1.16.2.darwin-arm64.pkg») from the list here — https://golang.org/dl/. Now it should work. With …
Run Steam on MacBook with m1 chip (apple silicon)
You need to install Crossover. Then you need to install Steam there. Good video explaining the process of installing Steam on Apple Silicon chips: https://www.youtube.com/watch?v=3TdCV7fn2CA Here is the list of supported games — https://applesilicongames.com/
Embedding assets to go binary in go 1.16
That’s how you can use it:
1 2 3 4 5 6 7 8 9 10 |
package server import "embed" // content holds our static web server content. //go:embed image/* template/* //go:embed html/index.html var content embed.FS data, _ := f.ReadFile("html/index.html") print(string(data)) |
Or embedding one file directly into a variable:
1 2 3 4 5 |
import _ "embed" //go:embed hello.txt var s string print(s) |
More details — https://golang.org/pkg/embed/
mmock for mocking microservices
It is a very easy to set up though pretty powerful tool with support for delays and handling query params. It also has a console for checking all the requests and corresponding responses matched. Here it is https://github.com/jmartin82/mmock. Below I describe a way to use it with docker-compose for local development.
Forward multiple kubernetes pods for local development
kubefwd is a great tool that can forward a lot of pods at once to your local machine. The only downside for me is that it touches your local /etc/hosts. That’s how I use it:
1 |
sudo KUBECONFIG=<path to your k8s config> kubefwd svc -l "app in (first-api, second-api, third-service)" |
It does not have huge documentation, but it is written in golang, and you can check how the source …
XDebug inside a docker container
That’s how you can debug your php app running in a docker container.