Caddy, an out-of-the-box web server

As we all know, the Web server is an indispensable basic service for Web development and is often used in development. Familiar open source Web servers are the well-known Apache, the powerful Nginx. The open source project we are going to introduce today is written in Go the up-and-coming “: Caddy It has a download without installation can be used, zero configuration to achieve HTTPS and other characteristics, so in

Quickly build new clusters on Kubernetes with Crossplane and VCluster

Crossplane is an open source Kubernetes plugin that solves the problem of provisioning cloud resources by extending the Kubernetes API. When using Crossplane, you can define declaratively what cloud resources need to be created for your application to work properly, without writing any code. The definition of these cloud resources can be done directly by creating the associated CRD objects, which can be thought of as a cloud-native version of Terraform.

Talking about gRPC's Trailers design

I’ve “critiqued” gRPC many times, and one of the most mysterious aspects of its complex design is its reliance on the trailers header. There is basically no information on the web about why gRPC uses trailers to pass status codes. I recently read an article by Carl Why Does gRPC Insist on Trailers?. Carl was a member of the gRPC R&D team and he Carl was part of the gRPC development team, and in this article he details the vision for designing gRPC and the process that led to it getting out of control.

Enable kvm nested virtualization on Linux

kvm supports nested virtualization, which means that virtual machines can be created within virtual machines. This article focuses on how to turn on kvm nested virtualization in CentOS 7 with Intel processors. kvm is mainly implemented through the kernel module, so we can check if kvm nested virtualization is enabled on our system by simply executing the following command and know if it is supported based on the output. 1 2 $ cat /sys/module/kvm_intel/parameters/nested N If not, we need to create a new kvm-nested.

The Sendfile command in nginx and how it works

This article explains the sendfile command in the http module in nginx and how it works. 1. Introduction to sendfile() The http module of nginx has a sendfile directive, which is on by default. The official website documentation explains it as follows. Enables or disables the use of sendfile(). Starting from nginx 0.8.12 and FreeBSD 5.2.1, aio can be used to pre-load data for sendfile(): 1 2 3 4 5 location /video/ { sendfile on; tcp_nopush on; aio on; } In this configuration, sendfile() is called with the SF_NODISKIO flag which causes it not to block on disk I/O, but, instead, report back that the data are not in memory.

Is Golang's Channel a free, lock-free implementation?

Today I saw a piece of code that exposes metrics with Prometheus’ client_go. Instead of simply inc()ing the corresponding metric counter, it implements a very strange logic of its own: when the program needs to add counter +1, it does not operate the corresponding metrics directly, but packages the metrics to be added in its own format and sends the object to a channel, each metric corresponds to a channel The program starts a globally unique worker goroutine at the beginning, which is responsible for all the metrics: it gets messages from different channels, unpacks them, finds the corresponding metrics that should be added, and then performs the final addition operation.

Does database MySQL need to be containerized?

Definition of Containers: Containers are designed to solve the problem of “how to ensure that the software can run properly when switching runtime environments”. Currently, containers and Docker are still the hottest words in the technology field, stateless services containerization has been the trend, but also brings a hot issue is debated by everyone: database MySQL need to be containerized? We carefully analyze the various views of everyone, and find that those who agree are only elaborating MySQL needs containerization from the perspective of container advantages, with little business scenarios to verify their views; on the other hand, if we look at the opponents, they elaborate MySQL does not need containerization from multiple factors such as performance and data security, and also cite some unsuitable business scenarios.

Using Prometheus to extend the kubernetes scheduler

This article will explain in depth how to extend the Kubernetes scheduler with each extension point, and the principles of extending the scheduler, which are required as knowledge points for extending the scheduler. Finally, an experiment will be done to record the scheduler for network traffic. kubernetes scheduling configuration Multiple different schedulers are allowed to run in a kubernetes cluster, and it is also possible to specify different schedulers for

Consistency Problems and Consensus Algorithms for Distributed Databases

When it comes to distributed databases, whether they are centralized databases like Etcd/Zookeeper or decentralized databases like Ethereum blockchain, there are two keywords that cannot be avoided: “consistency” and “consensus”. This article is the notes recorded by me when learning “consistency” and “consensus” and related theoretical knowledge, which can help us understand the difference between Etcd/Zookeeper/Consul/MySQL/PostgreSQL/DynamoDB/Cassandra/MongoDB/CockroachDB/ TiDB, etc., understand the advantages and limitations of each database, understand the meaning of database isolation level and how it should be set, and enable us to choose the applicable database in various application scenarios.

When using Dockerfile to build container images, you should pay more attention to the impact of "line breaks".

NET 6 and SQL Server development environment into a Docker container using Visual Studio Code’s Remote Development today. Although it went smoothly with the documentation, the problem arose after the project was versioned. I think the point of this article is that in today’s containerized, cross-platform era, line breaks actually have to be confronted, or else you’ll be at a loss for what to do. Experience the feeling of developing

PostgreSQL is becoming increasingly popular

Timescale has released a new State of PostgreSQL Survey 2022, which ran from June 6 to June 30, 2022. The survey, which ran from June 6 to June 30, 2022, received 992 responses from developers around the world, and the State of PostgreSQL Survey provides some key insights into PostgreSQL functionality and the broader PostgreSQL community. The first version of the report released in 2019 collected feedback from more than 500 developers, and the second version of the report in 2021 also sampled nearly 500 participants.

What is DevOps

1. The Cause I am a “DevOps engineer”, so I always get asked: “What is DevOps?” This question seems very basic, so basic that many people don’t bother to answer. But in fact, calm down for a second and ask yourself “What is DevOps?” and every DevOps engineer probably knows “what is DevOps”, but they give different answers. So how would I answer this? Let’s talk about it below. 2. Memories I first saw the term DevOps around the fall of 2016.

Linux tree-structured file system

For every Linux learner, understanding the directory structure of the Linux file system is a crucial step to learn Linux well. An in-depth understanding of the standards of the Linux file directory structure and the detailed functions of each directory is very important for us to use the Linux system well. The file system’s are used to organize and arrange file access, so it is visible, in Linux, we can view its structure through tools such as ls, in Linux, we see a tree structure; for example, the operating system is installed in a file system, he behaves as a tree structure starting from /.

Getting started with stimulus.js

The stimulus.js framework is a lightweight JavaScript framework developed by the big name Basecamp, the company that developed the core Ruby on Rails framework. I’ve heard of the stimulus.js framework for a long time, but I’ve never actually used it. Recently, I just had the opportunity to practice in a small project of my own, and have some experience, so I’d like to share a summary. Reminder: If you want to quickly experience the demo made by stimulus.

Getting Started with Service Worker - Rapid Development of Service Worker with Workbox

For optimizing front-end loading performance, many people use http-cache, asynchronous loading, 304 status codes, file compression, CDN and other methods to solve the problem. In fact, in addition to these methods, there is one more powerful than all of them, and that is Service Worker. We can use Google Chrome team’s Workbox to implement Service Worker for rapid development. Registering a Service Worker Add the following to the page to

Python 3.10 native coroutine asyncio in practice

We have always believed that coroutines are a more efficient way to work concurrently than multithreading, and that they are completely controlled by the program itself, i.e., executed in the user state. coroutines avoid the context switching that occurs with thread switching, resulting in significant performance gains. But in fact, coroutines are much more complex than most people think. Because of their “user state” nature, task scheduling is in the

Digital Signing with ECDSA in Golang

ECDSA ECDSA is the famous elliptic curve signature algorithm that provides security comparable to RSA3072 with a 256-bit private key size. The Golang standard library provides crypto/ecdsa, which provides the ability to sign, verify and generate public and private keys. However, in general we do not use Go to generate and save public-private keys, but rather OpenSSL to do so. For the OpenSSL command to generate public-private keys, we generally use prime256v1 or secp384r1, the two recommended curve parameters, here we choose prime256v1.

Solve 2502/2503 error when installing golang on windows

Golang 1.19 was just released and I couldn’t wait to update to the latest version. My OS is Win10 and when I installed it there was an exception. 1 The installer has encountered an unexpected errorinstalling this package. This may indicate a problem withthis package. The error code is 2502. 1 The installer has encountered an unexpected errorinstalling this package. This may indicate a problem withthis package. The error code is 2503.

Using GitHub Actions as a VPN Server

In regions where the Internet is strictly regulated (e.g. China), direct access to well-known websites such as Google, youtube, Twitter, etc. is not available. This article introduces a technique to break through network blocks based on the GitHub Actions service, which allows you to watch YouTube 4k videos smoothly, with unlimited traffic, completely free! GitHub Actions is a free build tool provided by Microsoft for developers. Whenever a task needs to run, GitHub creates a virtual machine (2C4G) in the Azure cloud.

NGINX Dynamic and static mixed path Overlay

I recently came across a requirement to implement something like Overlay FS with NGINX when deploying MediaWiki. Specifically, I was using the Git version of MediaWiki and needed to add some custom files to the directory (such as logos, favicon.ico, various verification files, etc.). I wanted to keep these files separate from the source code in order not to pollute Git and to reduce the hassle when upgrading. To abstract the problem, NGINX needed to serve from /srv/foo/orig, and now it needs to additionally try to search for files from /srv/foo/overlay in addition to the original path (note that unlike Overlay FS, the original path is used first).