Category: golang

20190628 Chatbots Meetup 10

Evan Lin 邀請,6/28 參與演講了 Chatbots Meetup 10 的第二場,分享如何在 Google Cloud Run 上部署 LINE Bot 的經驗談。(好像拖稿很久了)

因為時間的關係,到天瓏書局時已經開場講到一半啦。就錯過了 Evan LinWrite Image Proxy Server for LINE Bot in Go。就座的時候,LINE API ExpertCaesar Chi 正在介紹 LINE@ 2.0 offline to online ,分享如何透過 LIFF + Push 機制,讓廠商能更有效率的省錢轉換,並且也跟會眾們分享在官方帳號 2.0 轉換後的衍生想法。

接著就是我上台分享 LINE Bot on Cloud Run: 使用 line/line-bot-sdk-go ,本來是想介紹 LINE Bot on GKE ,不過準備的時候發現會需要花點時間講 K8S ,就不好講 LINE Bot 開發了,所以選了一個我也沒用過的 Cloud Run 來試看看。詳情就直接看投影片吧,然後順便把 source code 整理一下放上來

最後閃電講,直接貼共筆的圖好了 :Q 我覺得 Evan Lin講解比較詳細,哈哈,偷懶一下。

[docker] Multi-stage builds

Consider the following scenario: you are going to rolling update your cluster, and it turns out your network bandwidth is limited for some reason and size of built docker image is not small enough. What’s worse, every instance of cluster will need to pull the docker image before start-up… Read more →

Developing with consul on Macbook

For development use, we need to have consul running on localhost. When using a Macbook (Air), we need to specify the “-bind=” and “-client=” in order to have programs (tests) access to the consul agent in the container:  Read more →

Install docker on Centos 7

Perform a yum search docker, we can see two docker available:

docker.x86_64 : Automates deployment of containerized applications
docker-io.x86_64 : Automates deployment of containerized applications

Well, at least for today, the docker.x86_64, which is mentioned in , is still 0.11. So please install the docker-io.x86_64, which is 1.0.0-1.el7.

Updated 20140829: there’s more up-to-date repo for docker.

Updated 20150111: it seems the repo is out of managed now. And official repo is upgraded to 1.3.2. Thus the official repo is recommended now.

% # just use original one
% # curl -O
% # sudo mv goldmann-docker-io-epel-7.repo
% # yum update
% # yum install docker-io
% sudo service docker start
Redirecting to /bin/systemctl start docker.service

Crop image in golang

In python, for cropping  image I use PIL. However the dependencies of PIL is huge, also need to install some lib*-dev packages.

So I choose go to crop images:


% go run crop.go large.jpeg thumbna