2022年10月2日 星期日

Memo of GitLab Backup and Restore

1. Backup

Similar to the reference, first one (origin English) and second one (Chinese working note),

https://pikedom.com/migrate-gitlab-instance-to-new-host/#Backup_GitLab

https://davidlin12tw.wordpress.com/2018/08/07/%E5%B7%A5%E4%BD%9C%E6%97%A5%E8%AA%8C8-6%E4%BA%8C-1gitlab%E5%82%99%E4%BB%BD%E9%82%84%E5%8E%9F/

 

a. Config Backup

Which backup all config setting at "/etc/gitlab" and pack them to one .tar file.


b. Application data backup

Very simple and quick to follow from official GitLab menual as

https://docs.gitlab.com/ee/raketasks/backup_restore.html

Lots of settings you can try and set.


c. Host backup (opt)

This is optional for the hostkey or related stuffs. Usually not in daily / frequently backup.


2. Restore

Stop the GitLab related process is the first step.

Extract and restore application data and config files.

First the application data and then the config files if necessary.

Remember to run the "gitlab:check" to check all stored database / repositories.

 

Ref:

1. https://pikedom.com/migrate-gitlab-instance-to-new-host/#Backup_GitLab

2. https://davidlin12tw.wordpress.com/2018/08/07/%E5%B7%A5%E4%BD%9C%E6%97%A5%E8%AA%8C8-6%E4%BA%8C-1gitlab%E5%82%99%E4%BB%BD%E9%82%84%E5%8E%9F/

3. https://docs.gitlab.com/ee/raketasks/backup_restore.html


Other info:

http://mycodetub.logdown.com/posts/260395-gitlab-backup-restore-settings-notes


2022年7月30日 星期六

Memo of DevOps with GitLab system

 GitLab system composes with GitLab Server and GitLab Runner.

GitLab Server is the source and image repo single site (or other architecture depending).

GitLab Runner is the supporting tool to execute the CI / CD jobs and is able to be installed in lots different systems / environments.

Tips for DevOps with GitLab system:

1. For GitLab server,

If self-managed tier, install with Domain Name and certificate with HTTPS to provide GitLab container registry and well connections to GitLab Runners.


2. For GitLab runner,

An GitLab server can connect to many other GitLab runners with different application situations.

I had tried 3 types of GitLab runner:

- "shell" executor:

This type is the very conventional type to work in an environment with all supporting from bare machine. You have to prepare all necessaries (including git, compiler, builder, ... etc) and apply shell commands to build your application.

- "docker" executor:

This type is the basic docker environment to let your application build / run / deploy in a clean container environment. You are unable to use docker related commands such as: docker info, docker build, docker run to execute a docker. You are only able to use the built container environment as a clean starting point and close at the end.

- "docker" executor with socket binding:

This type is the advanced docker environment which lets you to proceed any docker related commands. It is recommended to apply this type if you want to build an image cleanly and execute during your CI / CD pipeline. This is the preferred method to build and run your applications with docker build and docker run commands.


Note:

a. "docker" executor with dind (docker in docker):

This is another type to execute docker commands in a docker environment. It is very straight forward thinking to execute a docker inside a docker environment. But there are some flaws to use this type from a docker developer view: https://jpetazzo.github.io/2015/09/03/do-not-use-docker-in-docker-for-ci/

This type is like the parent-child relationship. You have one docker running and inside it, you start another docker. So the second docker is the child and the first one is the parent. This could go into nested problem. This type likes the "scale up" case.

b. "docker" executor with socket binding:

This is the recommended way to run docker commands from a docker environment. Though it seems still has some problems?

This type is like the sibling relationship. You have one docker running. Then you ask this docker to help you to create another running docker parallel. So you will see lots docker containers concurrently from the monitor. It likes the "scale out" case.


The debate could be continued.






2019年12月27日 星期五

利用Docker在Synology NAS上安裝Wekan

目的:
由於Trello免費版本開始限制看板上限,只好自己找個Open source的免費版本來玩看看。


必要條件:
1.可以安裝Docker的Synology NAS一台(詳細清單請洽Synology官網)
  或
2.Ubuntu或可安裝Docker的機器一台


概念:
利用MongoDB作為Wekan的data base,連結至Wekan的docker image,啟動Wekan docker image,即可開始使用。


詳細步驟:(以下以使用Docker UI安裝為主,command line當作參考)
1.從套件中心安裝Docker app

2.啟動Docker

3.從倉庫伺服器(Registry)搜尋MongoDB,安裝的版本是mogo:latest
建立新資料夾(如mongodb),用來放db資料,通常建在docker資料夾底下
設定以下參數:
container名稱:Wekan-db
設定儲存空間:掛載路徑 --> docker/mongodb:/data/db

command line:
    docker run -d --name Wekan-db -v /docker/mongodb:/data/db mongo

4.從倉庫伺服器搜尋Wekan,安裝的版本為mquandalle/wekan:latest
設定以下參數:
container名稱:Wekan
連接埠:本機連接埠:容器連接埠 --> 8888:8080:TCP
容器間連結:容器名稱:別名 --> Wekan-db:db
網路:bridge:bridge
環境設定:增加與修改下列參數:
MONGO_URL:mongodb://別名/db掛載路徑 --> mongodb://db/db
ROOT_URL:網站名稱:本機連接埠 --> http://yoursite.com:8888
PORT:更改成容器連接埠 --> 8080

command line:
    docker run -d --name Wekan --link "Wekan-db:db" -e "MONGO_URL=mongodb://db" -e "ROOT_URL=http://yoursite.com:8888" -p 8888:8080 mquandalle/wekan

5.等一到兩分鐘,連線到http://yoursite.com:8888。
開始註冊使用者,第一個新增的使用者為管理員。
記得要開通port 8888或設定的本機連接埠,不然無法從外面連進來。

可以寄E-mail來驗證使用者,但可能需要設定mail server?這部分目前還沒試驗。

6. Have fun !!!


參考資料:
(1) https://pastebin.com/Sx80JSNj
(2) https://medium.com/@jiajunxu/%E7%94%A8-docker-%E8%87%AA%E6%9E%B6%E7%9C%8B%E6%9D%BF%E7%AE%A1%E7%90%86%E5%B7%A5%E5%85%B7-wekan-87ba3108ed4



2019年6月23日 星期日

如何在Windows 10 Update後繼續使用舊注音 (ㄅ半) (2004更新可用)

舊注音只是不顯示,不是消失
舊注音只是不顯示,不是消失
舊注音只是不顯示,不是消失

很重要,說三次

即使之前已設定成功,但是只要經過大版本更新(ex: 1709->1803, 1803->1903)
舊注音就會變回成新注音(很不方便)

以下為重新設置法 (新設定舊注音請從第3步開始):

1. 進到"語言喜好設定" -> "中文" -> "選項"

2. 在"鍵盤"處確認是否有兩個"微軟注音",分別點開確認,其中有一個有選項,另一個沒有選項,把沒有選項的"微軟注音"刪除。
Note: 點開之後有選項的"微軟注音"是新注音,版本更新後預設出現
          點開之後沒有選項的是原先設定的舊注音,請先刪除

3. 下載以下登錄檔,並按右鍵 -> 合併 -> 登錄機器碼
微軟ㄅ半注音


4. 再進到"語言喜好設定" -> "中文" -> "選項" -> "鍵盤" -> "新增鍵盤"
會出現第二個"微軟注音",新增。
再把原先的"微軟注音"刪除,刪除點開之後有選項的那一個。
完成。
Note: 舊注音的圖示為左上角有缺角的ㄅ符號。
         如果刪錯了,再"新增鍵盤"回來,重新刪除一次,即可完成。

更新測試:1803, 1903可成功繼續使用舊注音

!!!注意!!!
從2004開始,必須要再打開相容性,把舊注音輸入法整合找回來(微軟真是ooxx)
在上述的步驟4前
(1)不需要再把沒有選項的"微軟注音"刪除
(2)開啟相容性,步驟如下:
a.點開有選項的"微軟注音" -> "選項" -> "一般"
b.拉到最底下,看到"相容性","使用舊版的微軟注音",請打開它
會輸入有的沒的問卷調查,隨你高興填寫(可以大力的寫還我舊注音)
c.有缺角的ㄅ符號就回來了(熟悉的ㄅ半最對味?)
   至於有選項的"微軟注音"就看施主高興要不要刪除它

更新:確定Windows 11 可使用此方法繼續使用舊注音

2018年4月14日 星期六

邪惡的春假

是春假不是過年,根本是增肥行程。
話不多說,上圖:
04/04
海棉蛋糕佐乳酪加新鮮草莓

04/05
奶油海棉蛋糕雙莓派對(草莓+藍莓)

04/06
現烤手作起士芋頭對話麵包
04/07
手作土鳳梨酥
04/08
香鬆戚風蛋糕佐新鮮青蔥

手工食物吃飽飽 XD



2016年7月18日 星期一

讓Windows 10 ~ 7變成NTP server

在搜尋程式中打regedit,開啟編輯器
使用RegEdit修改機器碼下列參數:

1. HKLM\SYSTEM\CurrentControlSet\services\W32Time\Parameters
參數 Type,類別 REG_SZ,資料 NTP

2. HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Config\AnnounceFlags
數值設成5

3. HKLM\SYSTEM\CurrentControlSet\services\W32Time\TimeProviders\NtpServer
參數 Enable,類別 REG_DWORD,數值 1 (啟用NTPserver)


回到command line,cmd.exe中輸入:
1. 開機時自動啟動w32time程序
sc config w32time start= auto

2. 更新修改後的機器碼
w32tm /config /update

3. 檢查目前機器碼設定
w32tm /query /configuration


在工作管理員->服務->w32time 啟動

Ref: http://jamyy.us.to/blog/2015/10/7752.html

P.S.: Remember to turn off the firewall to let clients connecting to NTP server. (20190116 updated)

2015年4月18日 星期六

Install Git server on Synology NAS Note / 在Synology NAS上安裝Git Server筆記

文字筆記

1. 使用有管理員權限的帳號登入DSM
2. 控制台 -> 終端機&SNMP -> 終端機 -> 啟動SSH功能 -> 更改連接埠, ex: 5566
3. 套件中心 -> Git Server安裝啟用 -> 選擇可使用的使用者
4. NAS重新啟動
5. 新建Git Repository
    (1)  開新的共用資料夾, e.g.: GitRepo(在儲存空間1下)
    (2)  開在GitRepo中開新資料夾, e.g.: Gittest
    (3)  Git init : 用SSH
           用SSH登入(putty),切換至資料夾位置, e.g.: /volume1/GitRepo/Gittest
           鍵入"git init",產生".git"資料夾。
    (4)  Git init : 用TortoiseGit
           使用區域網路連至NAS中,找到"GitRepo/Gittest"後 ,按右鍵選"Git Create repository here"
           產生".git" 資料夾。
6. Clone資料夾
    (1)  在本機端選取資料夾按右鍵後,在url欄位中輸入:
 ssh :// {帳號} @ {NAS網址或IP} : {SSH port number} / {資料夾位置}
           資料夾位置e.g.: /volume1/GitRepo/Gittest
    (2) 輸入帳號密碼,Clone完成。


-----還未成功-----
7. Push資料夾 (完成1-6後,只能clone T_T)
    (1)  用SSH登入
    (2)  改資料夾權限讓group可以讀寫, e.g.:
              chmod -R 775 Gittest
              chgrp -R users Gittest
    (3)  應該可以Push了,位置同Clone的位置。
    (4)  因為每個資料夾要用SSH設定,且沒有GUI,故關閉Git Server... XD



Ref:
http://moonlightjuice.blogspot.tw/2013/09/git-synology-git-server.html
http://programingman.blogspot.tw/2015/03/synology-nas-git-server.html
http://forum.synology.com/enu/index.php