儲存 sensitive 資料的一些基本作法
### 大原則: 1. sensitive 資料加密儲存 2. Web server 只放加密用的金鑰,不放可以解密的金鑰 實際做起來就是:把需要解密的金鑰放到 worker 的 server,worker server 不接受來自外面的流量、且只能透過公司的 VP...
Heoku pipeline stateless builds
Heroku pipeline 從 staging promot 到 production 的時候會把 compile 過的 file 一起 copy 過去,所以如果用到 Node + Webpack 讀取環境變數再 compile 成 js 的 file 就會吃到 st...
Ansible + rails + letsencrypt
First, install nginx roles/nginx/tasks/main.yml ```yml - name: Install nginx apt: name: nginx state: latest - name: Disable ...
explain https again
CA 憑證方發憑證,所謂的憑證就是包含 1. 公鑰 2. 用 CA 方的私鑰加密過的 Hash ## 具體步驟是: 1. client端發起Https request 2. Server端返回CA發的憑證 3. Client端收到憑證,並驗證憑證是否可信,如果可...
使用 Vagrant 練習 chef-solo deployment
每次都自己調 server 太煩了,用 chef-solo 調一次以後一直套用比較方便,可以用 Vagrant 練習會快一點 先安裝 VirtualBox 和 Vagrant https://www.virtualbox.org/wiki/Downloads https...
Rails deployment 如何避免 downtime?
有哪些造成 downtime 的可能性? 1. Code 有問題 2. Migration 跑完後 Web Server 還沒 restart 3. Deploy 完後需要重啟 Server 4. Request 沒有被 queue 起來 可能的解決方式: ...
deploy rails 前如何在 production 環境設好 redis
幾個重點 1. 安裝 redis 2. 根據官方建議做好設定 https://redis.io/topics/quickstart 3. 設防火牆 4. 確定sidekiq 是用你剛剛設定的 port 5. 確定 sidekiq 是用 redis https://gith...
Capistrano forward agent
Capistrano forward agent 可以讓我們不用把 server 上的key 加到 github 也能拉 private repo 今天遇到 permission deny 的問題,結果是因為 mac 重開機就清空了 ssh agents ,導致沒有 ...
在 Linode 跑 lending bot
Ubuntu 16.04 LTS 先參考裝機筆記 https://everyday1percent.blogspot.hk/2017/10/blog-post.html 把基本的機器安全設定設好 把機器加到github https://help.github.com/...
Host key verification failed.
問題: ``` @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@...
Server 安裝 zsh
不能 autocomplete 太痛苦了 ``` apt-get install zsh curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh ``` 然後默...
deploy nodejs to server using capistrano and nvm and pm2
這給了大概流程 http://jameshuynh.com/nextjs/react/capistrano/nvm/pm2/2017/10/07/deploy-nextjs-app-with-capistrano-3-nvm-and-pm2/
裝機筆記
## 裝機器 https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-16-04 * Ubuntu 16.04LTS Local ``` ssh root@...
用 nvm 裝 nodejs
裝 nvm ``` curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.5/install.sh | bash nvm install v8.7.0 npm install pm2 -g `...
reddit 上的 rails performance 總結
The Complete Guide to Rails Performance 這本書 https://www.railsspeed.com/ 的總結: * Measure. If you have a serious project a cost of NewRelic...
docker
* 看 images ``` docker images ``` * remove images ``` docker rmi <IMAGE_ID> ``` * 建立 image ``` docker build -t <your username>/node...
k8s + docker + google cloud
### Docker ``` docker build -t wayne5540/poloniex-toy . docker run -p 49160:3000 -d wayne5540/poloniex-toy ``` Go to `http://localhost...