I managed to create a new dashboard in our Grafana, to show the metrics collected from my services.
Learned today: How to provide Prometheus metrics in a Go program
Using https://godoc.org/github.com/prometheus/client_golang/prometheus I created a custom Collector that reads Stats from sql.DB and gives them out as Prometheus metrics.
Laravel Notification Channel for Zoner SMS-Gateway
We decided to use Zoner SMS-Gateway for sending SMS messages in a Laravel application I developed for a client. It is a Finnish service for sending SMS messages with a simple HTTP API.
In Laravel, Notification is the abstraction for any kind of message that can be sent via a Notification Channel. Laravel includes implementations for some notification channels, and there are community-provided ones in Laravel Notification Channels site.
There was no notification channel implementation for Zoner, so I created one. As instructed in Laravel Notification Channels site, I made a pull request to get my implementation listed there, but so far there hasn’t been any reaction to it. I wonder if there is anyone updating the site any more. Meanwhile, you can get the implementation from our own GitHub repository.
WordCamp Jyväskylä
Today I attended WordCamp Jyväskylä, a one-day event focused on WordPress, mostly from developer’s point of view this time. The event had presentations on two tracks, and it was difficult to choose which track to attend as both tracks had interesting presentations. I chose these presentations / workshops:
- Terraform, Docker, Heroku, AWS: WordPress DevOps in 2018, where Viljami Kuosmanen showed how to tie all these technologies together.
- Demo + työpaja: Serverless WordPress, where Arto Liukkonen introduced serverless architecture and Serverless framework and we got to create our own semi-serverless site on AWS.
- Esteettömyys osaksi WordPress-teemakehitystä, where Roni Laukkarinen told how we should consider accessibility when creating web sites.
- Accessibility testing workshop, where Rian Rietveld showed some tools for evaluating and testing the accessibility of web sites.
Workaround for gitlab-runner issue #2408 “Cannot connect to the Docker daemon”
TL;DR; Change your pull policy to “if-not-present” or “never”.
Our Continuous Deployment pipeline at Wysiwyg worked fine, until it stopped working. It started giving errors like this:
Pulling docker image registry.gitlab.com/wysiwygoy/dev/cd-deploy ...
ERROR: Preparation failed: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
A bit of googling resulted in gitlab-runner issue #2408. I tried some of the suggestions in the thread but couldn’t get it working.
Finally I found a workaround: Because it fails when pulling my custom image from gitlab.com registry, I changed the pull policy of the runner (in config.toml of the runner) to “if-not-present”. The executor then skips pulling the image and executes its actual job just fine.
I suspect that gitlab.com registry responds too slowly and the docker client library gives up with the error mentioned above.
The downside of course is that if I update my executor image I need to pull the new image manually. In practice it doesn’t happen that often, so I can live with that until the fix to gitlab-runner is in.
I posted my finding as a comment to the issue.