西维蜀黍

【Linux】命令 - rm

rm -f - force - 强行删除

Attempt to remove the files without prompting for confirmation, regardless of the file’s permissions. If the file does not exist, do not display a diagnostic message or modify the exit status to reflect an error. The -f option overrides any previous -i options.

rm -d - directory - 删除文件夹

Attempt to remove directories as well as other types of files.

  ...


【Golang】依赖 - Checksum Mismatch

Context

执行 go mod tidy 报错

$ go mod tidy
go: verifying github.com/docker/docker@v1.13.1: checksum mismatch

Expect (go version go1.12.9 darwin/amd64):

$ go mod tidy -v
go: downloading github.com/panjf2000/ants v1.2.0
go: extracting github.com/panjf2000/ants v1.2.0

Actual (go version go1.13 darwin/amd64)

$ go mod tidy -v
verifying github.com/panjf2000/ants@v1.2.0: checksum mismatch
        downloaded: h1:Ufw4aDz9RqH1RVblx2W9L9Uv5vSX5apbX5+peR7LQ5k=
        sum.golang.org: h1:pMQ1/XpSgnWx3ro4y1xr/uA3jXUsTuAaU3Dm0JjwggE=

SECURITY ERROR
This download does NOT match the one reported by the checksum server.
The bits may have been replaced on the origin server, or an attacker may
have intercepted the download attempt.

For more information, see 'go help module-auth'.
  ...


【hugo】hugo 博客加载速度优化

Background

在将博客从 hexo 迁移到 hugo 下之后,顺便把使用的 CDN 从 GitHub 迁到了 AWS S3,再测了一下速度(via https://www.uptrends.com/tools/cdn-performance-check):

看起来速度还可以。

  ...


【AWS】使用 AWS Lambda Functions

Requirements and Restrictions on Lambda Functions

https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-requirements-limits.html

Using AWS Lambda with CloudFront Lambda@Edge

https://docs.aws.amazon.com/lambda/latest/dg/lambda-edge.html

Lambda@Edge lets you run Node.js and Python Lambda functions to customize content that CloudFront delivers, executing the functions in AWS locations closer to the viewer. The functions run in response to CloudFront events, without provisioning or managing servers. You can use Lambda functions to change CloudFront requests and responses at the following points:

  • After CloudFront receives a request from a viewer (viewer request)
  • Before CloudFront forwards the request to the origin (origin request)
  • After CloudFront receives the response from the origin (origin response)
  • Before CloudFront forwards the response to the viewer (viewer response)

Customizing Content at the Edge with Lambda@Edge

https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-at-the-edge.html

  ...


【AWS】使用 AWS CloudFront

Specifying a Default Root Object

https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DefaultRootObject.html

Managing How Long Content Stays in an Edge Cache (Expiration)

https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html

  ...


【hugo】使用 AWS S3 服务 hugo 博客

Create Buckets

Set up non-WWW Bucket (Root Domain Bucket)

One bucket for the naked domain called: example.com. This bucket will hold our static website files.

  1. Go to https://console.aws.amazon.com/s3/home
  2. Press Create bucket button
    1. Enter bucket name: example.com
    2. Choose the Region where you want to create the bucket.
    3. Press Next, Next and Create bucket.
      • Now your bucket list should contain the example.com bucket
  3. Click example.com bucket and select the Properties tab.

Set up WWW Bucket (Subdomain Bucket)

One bucket for the naked domain called: example.com. This bucket will hold our static website files.

  1. Go to https://console.aws.amazon.com/s3/home
  2. Press Create bucket button
    1. Enter bucket name: www.example.com
    2. Press Next, Next and Create bucket.
      • Now your bucket list should contain the www.example.com bucket
  3. Click www.example.com bucket and select the Properties tab.
  ...


【AWS】使用 AWS S3

How do I create an S3 Bucket?

https://docs.aws.amazon.com/AmazonS3/latest/user-guide/create-bucket.html

Using Amazon S3 block public access

https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html

  ...


【hugo】使用 AWS CloudFront(CDN)加速 hugo 博客

Achievement

Step by step guide to deploy your Hugo website to Amazon Web Services using:

  ...


【Linux】命令 - ls

参数

  • -R:是否递归,即如果列出的目录中仍有子目录或者文件,将所有目录下面的文件都显示出来。
  • -l:显示文件的形态、权限、拥有者、文件大小、最后修改时间、文件的完整名称(文件名+扩展名)。显示格式是每一行显示一个文件或者目录。
  • -a: List all files, including hidden files
  • -r: list subdirectories recursively
  ...


【Design Pattern】Microservices - Service Mesh(服务网格)Pattern

Background

Why Service Mesh

People write very sophisticated applications and services using higher level protocols like HTTP without even thinking about how TCP controls the packets on their network. This situation is what we need for microservices, where engineers working on services can focus on their business logic and avoid wasting time in writing their own services infrastructure code or managing libraries and frameworks across the whole fleet.

Service-to-service communication is what makes microservices possible. The logic governing communication can be coded into each service without a service mesh layer—but as communication gets more complex, a service mesh becomes more valuable. For cloud-native apps built in a microservices architecture, a service mesh is a way to comprise a large number of discrete services into a functional application.

  ...