Grafana + Playwright + Docker Problems
I am using Grafana to graph one of my applications, and I wanted to export these graphs to PDF and email them periodically.
I decidede to use playwright, which is a testing framework that uses a real browser engine and run it without user interface, and it support PDF printing too (only chromium engine).
اول نسخ لينكس اعمل عليها My First Linux
نسخ سي دي من عام ١٩٩٧ لانظمة تشغيل Slack ware Linux و FreeBSD نظم سلاك وير هو اول نسخة لينكس عملت عليها (نسخة اقدم من هذي) اذكر جلست اسبوعين حتى نجحت في تشغيل الواجهة الرسومية، في نفس الفترة كان تركيب ويندوز يحتاج ٢٠ قرص ٣،٥ وتحتاج تغيرها كل شوي جهازي كان انتل ٤٨٦ بدسك ٢٠ ميجا
How to Write a C Module and Build it with Meson
In this post I put my latest C project skeleton, you can find a github repo for the this tiny project here: https://github.com/rayed/c_module_meson
Fast Way to Edit SSH known_hosts
Few days ago I migrated my website to a new server, and whenever you try to connect
to a server using ssh
it must know it first, if not it will complain, and ask you
verfiy the server key signature:
$ ssh rayed.com
The authenticity of host 'rayed.com (x.x.x.x)' can't be established.
:
Are you sure you want to continue connecting (yes/no/[fingerprint])?
If you say yes, it will add the server signature to your system as known host, in
the file ~/.ssh/known_hosts
Migrating From Centos to Debian
Finally I managed to migrate from Centos 7 to Debian.
The migration was motivated by two updates:
- Debian has improved a lot, specially in the field of ease of use, I can now recommend it without hesitation.
- Redhat decided to stop supporting Centos as a downstream version from its own OS, it is now continuous update OS similar to Fedora but for the server version. Thank you Redhat but I don’t think I can rely on it any more.
I also updated my Hugo website setup.
Debian New System Useful Commands
Update System
# switch to user root
su -
apt update && apt upgrade
apt install sudo
usermod -aG sudo rayed
# logout from root & user
Network
Enable New Interface
Ref: https://wiki.debian.org/NetworkConfiguration
sudo vi /etc/network/interfaces
:
auto enp0s8
iface enp0s8 inet dhcp
:
sudo ifup enp0s8
NTP
sudo vi /etc/systemd/timesyncd.conf
:
NTP=sa.pool.ntp.org
:
sudo systemctl restart systemd-timesyncd
timedatectl timesync-status
Security
Secure SSH
sudo vi /etc/ssh/sshd_config
:
PasswordAuthentication no
:
sudo systemctl restart ssh
Firewall
Ref: https://wiki.debian.org/Uncomplicated%20Firewall%20%28ufw%29
Django and NGINX in Docker
In this post we will run Django application behind a NGINX webserver, which is a very common practice in production.
Build small Go Program Docker Image
Let’s start with this small Go program:
package main
import "github.com/gin-gonic/gin"
func main() {
r := gin.Default()
r.GET("/ping", func(c *gin.Context) {
c.JSON(200, gin.H{
"message": "pong",
})
})
r.Run() // listen and serve on 0.0.0.0:8080 (for windows "localhost:8080")
}
We will use go modules to manage dependencies:
go mod init rayed.com/server
go mod tidy
You can run it without installing Go on your machine using Docker:
docker run --rm -it -v `pwd`:/app -w /app golang:1.16 go run server.go
Building a Docker Image
Next step we will make a custom Docker image from our application, we would need a Dockerfile
like this:
SELinux Tip: Web Contents in User Home
I moved my website to new a server, since I moved my blog to Hugo I only needed small machine with minimal spec, so I downgraded my server to one costing $5 per month instead of $10.
I usually put all my personal projects including the blog under my home directory /home/rayed
, and point the Apache web server to serve content from inside it.
So I configured Apache web server as follow:
My "Introduction to Cryptography & PGP" Talk
I had the pleasure to give a talk at The Saudi Federation for Cyber Security and Programming titled “Introduction to Cryptography & PGP”
You can watch Video of the talk, and for the slides: