From ae1b5526a7f7226f90d06acee5204edc3af0260d Mon Sep 17 00:00:00 2001 From: Eric Chang Date: Thu, 15 Nov 2018 18:14:04 +0800 Subject: [PATCH] remove useless files --- .../articles/enable-synology-public-ssh.md | 123 ------------------ themes/content/gallery/sammy93.md | 12 -- themes/content/post/bookstack-docker.md | 105 --------------- .../change-preferred-language-in-firefox.md | 86 ------------ themes/content/post/copy_role_in_pgsql.md | 37 ------ .../content/post/nice-du-report-tool-durep.md | 73 ----------- .../post/weird-client-server-connection.md | 105 --------------- 7 files changed, 541 deletions(-) delete mode 100644 themes/content/articles/enable-synology-public-ssh.md delete mode 100644 themes/content/gallery/sammy93.md delete mode 100644 themes/content/post/bookstack-docker.md delete mode 100644 themes/content/post/change-preferred-language-in-firefox.md delete mode 100644 themes/content/post/copy_role_in_pgsql.md delete mode 100644 themes/content/post/nice-du-report-tool-durep.md delete mode 100644 themes/content/post/weird-client-server-connection.md diff --git a/themes/content/articles/enable-synology-public-ssh.md b/themes/content/articles/enable-synology-public-ssh.md deleted file mode 100644 index c4190a9c..00000000 --- a/themes/content/articles/enable-synology-public-ssh.md +++ /dev/null @@ -1,123 +0,0 @@ ---- -title: "筆記- 啟用群暉NAS (Synology NAS)的SSH Server 透過Publickey 認證免密碼登入" -date: 2018-11-05T14:16:54+08:00 - -featuredImage: "https://i.imgur.com/jcDQmI1.png" -noSummary: false -categories: ['筆記'] -tags: ['筆記','synology','NAS','SSH'] -author: "Eric Chang" ---- - -公司內有幾台NAS,其中有一台用來放開發人員的postgresql dump file -之前都是主要的開發人員上傳到google drive,分享出來 ,然後其他人去抓回來 - -這樣子有個問題是,當server要存取這些檔案時,就沒辦法了,除非透過一些 3rd party的軟體 -像是這篇 - -https://www.omgubuntu.co.uk/2017/04/mount-google-drive-ocamlfuse-linux - -或者是這篇 - -https://www.maketecheasier.com/mount-google-drive-ubuntu/ - -但是手邊的伺服器,原則上除非有必要,不然都沒有開放internet -所以導致明明檔案就在那邊,但是要取得就是很麻煩 - - - -Dev_A upload to google drive ---> Dev_B Download from google drive ---> Dev_B scp download file to me ---> I upload to server. - -有沒有?是不是很stupid (講話一定要烙英文) - -既然有現成的NAS在那邊,幹嘛不用呢?(攤手) - -聽說之前的人一直沒成功弄出來,讓Server可以直接去NAS存取檔案的方式,我記得這個不是很難啊 -就順手整理一下 - -### 新增使用者帳號/ 確認家目錄存在 - -在NAS 的管理界面上新增一個帳號,假設叫 eric 好了 - -~~建立時,注意一下要指定家目錄路徑~~ - -更正: 群暉的界面好像不能指定家目錄 - -預設的路徑如下 -``` -eric:x:1071:100::/var/services/homes/eric:/sbin/nologin -``` - -不過我覺得怪怪的,因為在我手邊的幾台NAS底下 /var/services/homes 都切不過去 -確認一下路徑,發現那個 ```@fake_home_link``` 根本就不存在啊! - -``` -admin@storage:/volume1$ ls -lart /var/services/homes -lrwxrwxrwx 1 root root 24 May 23 14:14 /var/services/homes -> /volume1/@fake_home_link -admin@storage:/volume1$ -``` - -我在想是不是之前的人有改過什麼.. -anyway ,反正先不管這邊,直接修改 /etc/passwd檔案 -``` -sudo vim /etc/passwd -``` -修正到正確的路徑,順便把shell 也改掉,不然不能登入 - -``` -eric:x:1071:100::/volume1/homes/eric:/bin/sh -``` - -### 修改 /etc/ssh/sshd_config - -再來修正預設沒有啟用 Publickey 驗證的 ssh - -``` -sudo vim /etc/ssh/sshd_config -``` -確認底下三行存在 - -``` -RSAAuthentication yes -PubkeyAuthentication yes -AuthorizedKeysFile .ssh/authorized_keys -``` -### 將KEY傳到 NAS上 - -先建立相關目錄,順便修正一下目錄權限 - -``` -chmod 755 /volume1/homes/eric -mkdir -p /volume1/homes/eric/.ssh -chmod 700 /volume1/homes/eric/.ssh -``` - -再來把Publickey 傳到NAS,複製貼上也好,ssh-copy-id也可以,同時修正權限 -``` -vim /volume1/homes/eric/.ssh/authorized_keys -chmod 0600 /volume1/eric/.ssh/authorized_keys -``` - -### 重啟SSH - -本來這個步驟應該可以用 -``` -synoservicectl --restart sshd -``` -來解決 -但是實際上這個指令只會把你踢出 SSH session ....( WTF!!! ) - -所以還是要去NAS的管理界面,去關閉再打開SSH (有點蠢..) -![Synology WEB UI](https://i.imgur.com/jcDQmI1.png) - -然後就可以測試用Publickey 來登入NAS了 - -``` -2018-11-05 14:47:12 [mini@s009 ansiblecontrol]$ ssh admin@storage -admin@storage:~$ -``` -確認免密碼登入無誤了! - - - - diff --git a/themes/content/gallery/sammy93.md b/themes/content/gallery/sammy93.md deleted file mode 100644 index 0e17dc4c..00000000 --- a/themes/content/gallery/sammy93.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: "Sammy93" -date: 2018-11-05T07:46:53+08:00 - -imageSlider: false #set to false if you don't want to use the imageSlider but a featuredImage - -categories: [PS] -tags: ['ps','短今'] -author: "Eric Chang" ---- -![](http://i.imgur.com/Odp4mfD.png) -![](http://i.imgur.com/yyiEHjb.png) diff --git a/themes/content/post/bookstack-docker.md b/themes/content/post/bookstack-docker.md deleted file mode 100644 index 641e3106..00000000 --- a/themes/content/post/bookstack-docker.md +++ /dev/null @@ -1,105 +0,0 @@ ---- -title: "Bookstack Docker" -date: 2018-11-06T14:57:14+08:00 - -noSummary: false -featuredImage: "https://h.cowbay.org/images/post-default-12.jpg" -categories: ['筆記'] -tags: ['docker','Bookstack'] -author: "Eric Chang" ---- - -Bookstack 是一套非常好用的線上"筆記"系統 - -他用圖書館/書本的概念,讓使用者可以建立自己的"圖書館" - -同時在圖書館內建立不同的"書籍" - -而且支援 Markdown 語法 - -其他的方式像是在nextcloud上編輯 md檔案(字體太小) - -或者是boostnote(只能在本機) - -都或多或少有點小缺點 - -Bookstack則是沒有這些問題,不過就是系統「大」了點... - -不過還好有人做成docker的方式來啟動,大大的降低了建置的難度(其實也沒有很難啦,只是要裝個PHP、弄個DB而已) - - - - -這個是專案的名稱 -#### solidnerd/docker-bookstack - -gihub上的連結 - -https://github.com/solidnerd/docker-bookstack - - -因為都轉成docker了,所以安裝很簡單 -先git clone回來 -``` -git clone https://github.com/solidnerd/docker-bookstack -``` -然後依照他的說明,建立一個docker-compose.yml檔案,再視情況修改 - -底下是我的docker-compose.yml內容 - -``` - version: '2' - services: - mysql: - image: mysql:5.7.21 - environment: - - MYSQL_ROOT_PASSWORD=secret - - MYSQL_DATABASE=bookstack - - MYSQL_USER=bookstack - - MYSQL_PASSWORD=secret - volumes: - - mysql-data:/var/lib/mysql - - bookstack: - image: solidnerd/bookstack:0.24.1 - depends_on: - - mysql - environment: - - DB_HOST=mysql:3306 - - DB_DATABASE=bookstack - - DB_USERNAME=bookstack - - DB_PASSWORD=secret - volumes: - - uploads:/var/www/bookstack/public/uploads - - storage-uploads:/var/www/bookstack/public/storage - ports: - - "0.0.0.0:8003:80" - - volumes: - mysql-data: - uploads: - storage-uploads: -``` - -原則上我沒有修改什麼設定,先確認一下現在的bookstack版本 0.24.1 是目前最新的了 - -然後把 port 改成8003 ,避免去強碰 80 port - -如果前面搭配 caddy 之類的反向代理,那不用去記 port 也沒關係。 - -好了之後,就執行 docker-compose up -d - -然後 docker ps -a 看一下執行狀況 -``` -CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES -6b3333eabf30 solidnerd/bookstack:0.24.1 "/docker-entrypoint.…" 4 hours ago Exited (0) About an hour ago docker-bookstack_bookstack_1 -b8d74048eba1 mysql:5.7.21 "docker-entrypoint.s…" 4 hours ago Exited (0) About an hour ago docker-bookstack_mysql_1 -``` -應該可以順利跑起來 - -![bookstack運作畫面](http://i.imgur.com/NIUCJhN.png) - -沒啥難度,簡單作一下紀錄 - -後面再來看看能不能在一個地方新增 md 檔案,然後可以自動傳到 hexo/hugo/ghost 的目錄,接著自動生成靜態檔案出來... - diff --git a/themes/content/post/change-preferred-language-in-firefox.md b/themes/content/post/change-preferred-language-in-firefox.md deleted file mode 100644 index 2a674ef0..00000000 --- a/themes/content/post/change-preferred-language-in-firefox.md +++ /dev/null @@ -1,86 +0,0 @@ ---- -title: "[筆記] 為了metabase 修改 firefox 開啟網頁時使用的預設語言 change the preferred language in firefox for metabase" -date: 2018-11-15T11:06:28+08:00 - -noSummary: false -featuredImage: "https://h.cowbay.org/images/post-default-9.jpg" -categories: ['筆記'] -tags: ['筆記','firefox','metabase'] -author: "Eric Chang" ---- - -最近在測試metabase,記得幾個月前就有測試過 - -但是當時的界面和現在的樣子差很多,看樣子改版還滿勤勞的 - -所以這次改用docker來建立,根本五分鐘不到就建好了(挖鼻孔) - -不過呢,很討厭的是,一進去就發現語系採用的是簡體中文 - - - - -來看看這張圖 -![metabase的簡體中文界面](http://i.imgur.com/oK6WmtJ.png) - -WHAT THE FUCK !!! - -這是哪一國的翻譯??我相信對岸人才濟濟,絕對不至於翻譯出這種結果來.. - -想當然爾,我認為這個問題可以暫時不管,反正進入系統後,再去使用者界面設定就好 - -BUT .. (對,又是這個他X的BUT) - -使用者設置裡面根本沒什麼可以改! - -![metabase超陽春的使用者設置](http://i.imgur.com/DBRE5J6.png) - -對,沒錯,就只有這樣!! 請容許我再罵一次 WHAT THE FUCK !!! - -* * * - -好吧,罵完就算了,還是要想辦法解決,於是切到管理界面,的確是有語言設置 - -然後,我要再罵第三次 WHAT THE FUCK !!! - -![metabase管理界面](http://i.imgur.com/HCSf8Ba.png) - -``` -The default language for this Metabase instance.This only applies to emails, Pulses, etc. Users' browsers will specify the language used in the user interface. -``` - -簡單說,這邊的語言設定「不影響」使用者界面,界面使用的語系,由各個瀏覽器決定! - -好,那我去修改firefox 的語言看看 - -開啟 firefox ,點選右上角的三橫槓,找到語言選項 - -我一開始改成這樣 - -![firefox settings](http://i.imgur.com/630BBJF.png) - -結果不管重開幾次,開啟metabase還是那個殘體中文字 - -後來想說,啊,會不會是「英語」「美語」的差異? - -所以我把順序改成 - -![firefox language settings for metabase](http://i.imgur.com/pfdSWaC.png) - -然後再開 metabase ,結果就如我所願的,改成英文界面了 - -![metabase in English](http://i.imgur.com/rc6SLSC.png) - -真的是比殘體中文好太多了.. - -另外,關於繁體中文的部份,也到metabase的官方論壇去留言了 - -就看看官方要不要處理這個問題... - - - - - - - - diff --git a/themes/content/post/copy_role_in_pgsql.md b/themes/content/post/copy_role_in_pgsql.md deleted file mode 100644 index 57c75c00..00000000 --- a/themes/content/post/copy_role_in_pgsql.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -title: "PostgreSQL 直接從已經存在的使用者複製權限到另一個使用者" -date: 2018-11-12T09:48:12+08:00 - -noSummary: false -featuredImage: "https://h.cowbay.org/images/post-default-7.jpg" -categories: ['筆記'] -tags: ['psql','筆記'] -author: "Eric Chang" ---- - -因為工作上的需求,有個資料庫需要開放給不同team的人去存取 - -雖然都是在同一台機器上的同一個資料庫 - -但是希望能夠不同team的人用不同的資料庫使用者 - -這樣萬一出事,會比較好抓兇手?? - - - -總之呢,這個需求一直反覆出現 - -每次開發不同的AP,就要求一個不同的代號,實在有點煩 - -之前都是用pgadmin來處理,現在就改用psql來弄 - -其實也很簡單 - -``` -CREATE ROLE b LOGIN; -GRANT a TO b; -``` - -可以帶入script ,用script 或者用ansible去跑就好了 - -省得每次都要在那邊手動改來改去.. diff --git a/themes/content/post/nice-du-report-tool-durep.md b/themes/content/post/nice-du-report-tool-durep.md deleted file mode 100644 index 8fb7d431..00000000 --- a/themes/content/post/nice-du-report-tool-durep.md +++ /dev/null @@ -1,73 +0,0 @@ ---- -title: "Nice Du Report Tool Durep" -date: 2018-11-06T15:24:29+08:00 - -noSummary: false -featuredImage: "https://h.cowbay.org/images/post-default-9.jpg" -categories: ['筆記'] -tags: ['linux','du'] -author: "Eric Chang" ---- -最近在重新規劃前人留下的backup爛攤子 -各個伺服器統一備份到一台backup storage -想說如果每天能夠看到backup storage的磁碟用量的話 -就可以抓出備份空間成長速度、推估需要多大的磁碟空間 -找了一些工具,結果發現 durep 這個 ubuntu 內建的工具 -基本上可以滿足我的需求 - - -我的需求其實很簡單 - -1. 可以指定目錄"深度" -2. 可以用圖表的方式顯示目前用量 -3. 每天寄出報表 - -來看一下 durep 執行的狀況 -**如果只指定一層,那就是顯示該目錄底下的使用狀況** - -``` -2018-10-29 15:50:21 [minion@tps006 ~]$ sudo durep -td 1 -sd /file -[ /file 259.0G (0 files, 3 dirs) ] - 259.0G [############################# ] 100.00% Oct 25 2017 team/ - 1.7M [ ] 0.00% Oct 23 14:04 html/ - 741.1K [ ] 0.00% Jul 11 2016 team_commons/ -2018-10-29 15:50:26 [minion@tps006 ~]$ sudo durep -td 1 -sd /file -``` -如果指定兩層 -就顯示包含下一層目錄的磁碟使用量 *好像廢話* - - -``` -2018-10-29 16:14:23 [mini@s006 ~]$ sudo durep -td 2 -sd /file -[ /file 259.0G (0 files, 3 dirs) ] - 259.0G [############################# ] 100.00% Oct 25 2017 team/ - 259.0G [##############################] 100.00% Oct 3 15:08 tp/ - 0b [ ] 0.00% Jul 11 2016 temporary/ - 1.7M [ ] 0.00% Oct 23 14:04 html/ - 748.5K [############ ] 43.04% Jun 22 2016 font-awesome/ - 282.2K [#### ] 16.23% Jun 22 2016 css/ - 241.0K [#### ] 13.86% Jun 22 2016 js/ - 222.9K [### ] 12.82% Jun 22 2016 img/ - 210.7K [### ] 12.11% Jun 22 2016 fonts/ - 18.6K [ ] 1.07% Oct 23 14:04 index.html - 8.5K [ ] 0.49% Jun 22 2016 less/ - 2.2K [ ] 0.12% Jun 22 2016 Gruntfile.js - 1.7K [ ] 0.10% Jun 22 2016 README.md - 1.2K [ ] 0.07% Jun 22 2016 mail/ - 1.1K [ ] 0.06% Jun 22 2016 LICENSE - 652b [ ] 0.04% Jun 22 2016 package.json - 12b [ ] 0.00% Jun 22 2016 .gitignore - 741.1K [ ] 0.00% Jul 11 2016 team_commons/ - 709.6K [############################ ] 95.75% Oct 23 14:05 tp/ - 31.5K [# ] 4.25% Oct 23 14:05 temporary/ -2018-10-29 16:14:36 [mini@s006 ~]$ -``` - -搭配mail 使用,有點可惜的是在郵件內顯示,格式稍微有點跑掉 -不過至少需要看到的目錄總使用量(左上角),還有各個子目錄的用量都可以清楚的看到 -如果能夠有縮排就更好了! - -![http://i.imgur.com/ySNJJWx.png](http://i.imgur.com/ySNJJWx.png) - - - diff --git a/themes/content/post/weird-client-server-connection.md b/themes/content/post/weird-client-server-connection.md deleted file mode 100644 index ae7134aa..00000000 --- a/themes/content/post/weird-client-server-connection.md +++ /dev/null @@ -1,105 +0,0 @@ ---- -title: "[筆記] 詭異的client&server間連線的問題,或許跟KVM有關係?" -date: 2018-11-08T18:01:23+08:00 - -noSummary: false -featuredImage: "https://h.cowbay.org/images/post-default-4.jpg" -categories: ['筆記'] -tags: ['ubuntu','筆記'] -author: "Eric Chang" ---- - -這是發生在一個夜黑風高的寂寥深夜..... ( What The FXXX ... ) - -來到這個環境之後,有一個很詭異的狀況一直困擾著我 - -在每個分公司,都會有一台伺服器作為KVM Host - -上面跑兩台VM,一台作為ansible controller (目前沒作用) - -另一台作為這邊所謂的 "Build Server" - -用途包含了DHCP Server / Proxy Server (squid3) / APT Proxy (squid-deb-proxy) - -問題就發生在這台 Build Server 上... - - - -有陣子花了點時間去檢查各個分公司的網路環境,確保每一台Build Server都能夠連接Internet - -然後找了一個離總部最近的據點,把這些電腦連接Internet 的方式改為用 proxy 來控制 - -在proxy內加入了 allowhost 的設定,然後把user電腦上的瀏覽器都代入 proxy server (firefox/chrome 的設定方式不同) - -``` -acl localnet src 192.168.28.0/24 -acl allowhost src "/etc/squid3/allowhost.txt" -acl localdomain dstdomain "/etc/squid3/localdomain.txt" -acl SSL_ports port 443 -acl Safe_ports port 80 # http -acl Safe_ports port 21 # ftp -acl Safe_ports port 443 # https -acl Safe_ports port 70 # gopher -acl Safe_ports port 210 # wais -acl Safe_ports port 1025-65535 # unregistered ports -acl Safe_ports port 280 # http-mgmt -acl Safe_ports port 488 # gss-http -acl Safe_ports port 591 # filemaker -acl Safe_ports port 777 # multiling http -acl CONNECT method CONNECT -``` - -一開始這樣作還相安無事,但是呢,慢慢的時不時會有USER反應說無法連接 Internet - -照理來說,因為都是透過proxy上網,所以如果是proxy server出問題,那其他電腦應該也不行上Internet - -但如果這樣的話,那就一點也不詭異了呀(攤手) - -實際上的狀況是,只有反應的USER的電腦無法連接Internet - -然後真的詭異的來了 - -用USER電腦去 ping proxy server ,有時候會通,有時候不通.. - -從Proxy Server去 ping USER電腦,也是類似的狀況 - -可是我卻可以透過IPSEC VPN,分別SSH連接到這兩台機器上 - -這代表兩台的網路都OK呀.. - -正當我百思不得其解的時候,突然 USER電腦那邊的 ping 有反應了 - -變成可以 ping proxy Server 了! (What the FXXX !!!!) - -我什麼都沒改呀... - -
- -反正呢... - -這種狀況三不五時就會出現一次,會出現在哪一台電腦也不一定 - -不過,依照觀察到的狀況來說,似乎都是發生在很少開機的電腦上 - -然後呢,因為底層是 KVM - -我也嘗試過用virsh 去restart VM 或者是 restart network - -有時候可以解決,有時候又還是不能連接 - -於是另外測試安裝了 proxmox VE 的虛擬平台 - -在上面起一台新的Server,再用 ansible 做成 build server的角色 - -這樣子作的機器,就不會發生這種狀況 - -所以我在猜是不是跟底層是KVM有關係.. - -不過要動這個的話,工程有點大,手邊也沒那麼多機器可以替換(很慘) - -暫時先保留這個作法,等到下次再發生這狀況 - -再來找老闆看這情形,然後來討論要不要換掉各分公司的VM Host... - - -