星期日, 12月 23, 2018

Nextcloud with openSUSE Leap 15 同步設置小記

Nextcloud with openSUSE Leap 15 同步設置小記


OS: openSUSE Leap 15


這篇是回憶文, 因為相關機制已經運作一段時間, 目前也日趨穩定
所以就寫這篇來紀錄一下


左邊是我的 Desktop, 中間是 Raspberry Pi 3 + HD




Raspberry Pi 端:


目前使用 Raspberry Pi 3 加上 container 來運作 nextcloud 日後取代 Dropbox


使用 Docker 運作 nextcloud / owncloud


使用雙層硬碟座來連接硬碟
  • 使用 2 顆 2TB 硬碟來存放資料
    • /mnt/usb
      • 主要存放資料的地方
        • nextcloud 如上述放在指定的目錄然後讓 docker run -v 掛載目錄
        • 其他的資料透過 ssh, 讓 Client 使用 filezilla 來存取
    • /mnt/backup
      • 備份資料使用, 使用 crontab 來處理, 如果主要硬碟死掉, 還有一份
        • # crontab -l
        • 0 4 * * * rsync -a --delete /mnt/usb/* /mnt/backup/

PC 端:


安裝 nextcloud client 程式來進行同步 PC端到 Raspberry Pi 上的資料夾
  • 有建立一個 Dropbox 目錄在 Nextcloud 目錄內
  • 透過 rsync 將 Dropbox 目錄同步到 nextcloud 上面的 Dropbox 資料夾
    • > crontab -l
    • 0 22 * * * rsync -a --delete /Dropbox/sakana/Dropbox/*  /home/sakana/Nextcloud/Dropbox/


其他資料透過 filezilla 來存取


簡單來說就是
  • Dropbox 資料夾有異動, 每天晚上10點會同步到 Nextcloud 目錄下的 Dropbox 資料夾
  • PC 端的 NextCloud 下的資料夾有異動就會同步到 Raspberry Pi 上面的目錄, 然後 Raspberry Pi 上面每天早上 4點會抄寫到另外一顆硬碟


找個時間來想想 Google Drive 的同步吧


~ enjoy it


Reference:

星期六, 12月 22, 2018

方便的 my.vmware.com 下載工具 - vmw-cli 測試小記

方便的 my.vmware.com 下載工具 - vmw-cli 測試小記

OS: openSUSE Leap 15 in Azure

之前看到一個工具 vmw-cli 可以用 command line 方式下載 VMware 產品 ISO
  • vmw-cli is a CLI client used to login and interact with my.vmware.com. It provides an interface for programmatic query and download of VMware product binaries.

今天有點時間, 來嘗試一下

# zypper  install  npm8
Building repository 'openSUSE-Leap-15.0-Non-Oss' cache ...................[done]
Building repository 'openSUSE-Leap-15.0-Oss' cache .......................[done]
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following 4 NEW packages are going to be installed:
 nodejs-common nodejs8 nodejs8-devel npm8

The following recommended package was automatically selected:
 npm8

4 new packages to install.
Overall download size: 8.7 MiB. Already cached: 0 B. After the operation,
additional 34.7 MiB will be used.
Continue? [y/n/...? shows all options] (y): Y


使用 npm 安裝 vmw-cli

# npm  install  vmw-cli  --global

/usr/local/bin/vmw-cli -> /usr/local/lib/node_modules/vmw-cli/lib/vmw-cli.js
+ vmw-cli@1.1.13
added 82 packages in 8.946s

還沒有定義帳號密碼前先觀察資訊, 使用 vmw-cli  list 可以列出產品

# vmw-cli  list
vmware-workstation-pro
vmware-workstation-player
vmware-workspace
vmware-workspace-one
vmware-vsphere
vmware-vsphere-with-operations-management
vmware-vsphere-storage-appliance
vmware-vsphere-integrated-containers
vmware-vsphere-hypervisor-esxi
vmware-vsphere-data-protection-advanced
vmware-vsan
...


但是要進行其他相關指令會被提示要有帳號以及密碼

# vmw-cli   index vmware-vsphere

Updating [fileIndex.json] for all permitted downloads in [vmware-vsphere] ...
[ERROR]: environment variables $VMWUSER and $VMWPASS not set! Please configure

接下來嘗試 export 帳密
#export  VMWUSER='<userid>'
#export  VMWPASS='<password>'

嘗試 inex 但是這個過程會很久, 然後會產生 fileIndex.json
# vmw-cli  index vmware-vsphere

觀察相關資訊

# ls  /usr/local/lib/node_modules/vmw-cli/lib
cookies.json  extract-files.js  get-file.js get-product.js   group.vmware-vsphere.json index.json.session  utils.js vmw-cli.js xtable.js
examples      fileIndex.json    get-index.js  get-solution.js  index.json          mainIndex.json vmw-api.js  xcell.js

接下來嘗試 vmw-cli  find 指令
這邊是找出檔案名稱內有 vcsa 字元的

# vmw-cli   find  fileName:vcsa

Loading available solutions in [fileIndex.json] ...

solution                                   productGroup productType version fileName                                                      fileDate fileSize fileType download  
-----------------------------------------  ------------ ---------------- --------- ------------------------------------------------------------  ---------- -------- -------- --------
vmware-workspace-one                       VC67U1 Product Binaries  6.7.0U1 VMware-VCSA-all-6.7.0-10244745.iso                            2018-10-16 3.95 GB iso yes
vmware-workspace-one                       VC60U2M Product Binaries  6.0U2M VMware-VCSA-all-6.0.0-4191361.iso                             2016-09-15 2.605 GB iso yes
vmware-vsphere                             VC67U1 Product Binaries 6.7.0U1 VMware-VCSA-all-6.7.0-10244745.iso                            2018-10-16 3.95 GB iso yes
vmware-vsphere                             VC65U2C Product Binaries 6.5.0 U2c VMware-VCSA-all-6.5.0-9451637.iso                             2018-08-14 3.27 GB iso yes
vmware-vsphere                             VC65U1G_OSS Open Source 6.5.0U1g open-source-license-VMware-vCenter-Server-VCSA-65U1-g-GA.txt  2018-03-20 4.59 MB txt yes
vmware-vsphere                             VC60U3H Product Binaries 6.0 U3h VMware-VCSA-all-6.0.0-9451619.iso                             2018-08-14 3.09 GB iso yes
vmware-vsphere                             VC60U2M Product Binaries 6.0U2M VMware-VCSA-all-6.0.0-4191361.iso                             2016-09-15 2.605 GB iso yes
vmware-vsphere-with-operations-management  VC67U1        Product Binaries  6.7.0U1 VMware-VCSA-all-6.7.0-10244745.iso                            2018-10-16 3.95 GB iso yes
vmware-vsphere-with-operations-management  VC60U3H       Product Binaries  6.0 U3h VMware-VCSA-all-6.0.0-9451619.iso                             2018-08-14 3.09 GB iso yes
vmware-vsphere-with-operations-management  VC60U2M       Product Binaries  6.0U2M VMware-VCSA-all-6.0.0-4191361.iso                             2016-09-15 2.605 GB iso yes
vmware-vsphere-with-operations-management  VC65U2C       Product Binaries  6.5.0 U2c VMware-VCSA-all-6.5.0-9451637.iso                             2018-08-14 3.27 GB iso yes
vmware-vsphere-with-operations-management  VC65U1G_OSS   Open Source    6.5.0U1g open-source-license-VMware-vCenter-Server-VCSA-65U1-g-GA.txt  2018-03-20 4.59 MB txt yes
vmware-vsan                                VC67U1 Product Binaries 6.7.0U1 VMware-VCSA-all-6.7.0-10244745.iso                            2018-10-16 3.95 GB iso yes
vmware-vsan                                VC65U2C Product Binaries 6.5.0 U2c VMware-VCSA-all-6.5.0-9451637.iso                             2018-08-14 3.27 GB iso yes
vmware-vsan                                VC65U1G_OSS Open Source 6.5.0U1g open-source-license-VMware-vCenter-Server-VCSA-65U1-g-GA.txt  2018-03-20 4.59 MB txt yes
vmware-vsan                                VC60U3H Product Binaries 6.0 U3h VMware-VCSA-all-6.0.0-9451619.iso                             2018-08-14 3.09 GB iso yes
vmware-vsan                                VC60U2M Product Binaries 6.0U2M VMware-VCSA-all-6.0.0-4191361.iso                             2016-09-15 2.605 GB iso yes
vmware-vcloud-suite                        VC67U1        Product Binaries  6.7.0U1 VMware-VCSA-all-6.7.0-10244745.iso                            2018-10-16 3.95 GB iso yes
vmware-vcloud-suite                        VC60U2M Product Binaries  6.0U2M VMware-VCSA-all-6.0.0-4191361.iso                             2016-09-15 2.605 GB iso yes
vmware-vcloud-nfv                          VC65U1G_OSS Open Source 6.5.0U1g open-source-license-VMware-vCenter-Server-VCSA-65U1-g-GA.txt  2018-03-20 4.59 MB txt yes
vmware-horizon                             VC67U1        Product Binaries  6.7.0U1 VMware-VCSA-all-6.7.0-10244745.iso                            2018-10-16 3.95 GB iso yes
vmware-horizon                             VC60U2M Product Binaries  6.0U2M VMware-VCSA-all-6.0.0-4191361.iso                             2016-09-15 2.605 GB iso yes
vmware-horizon                             VC65U1G_OSS Open Source   6.5.0U1g open-source-license-VMware-vCenter-Server-VCSA-65U1-g-GA.txt  2018-03-20 4.59 MB txt yes
vmware-horizon-apps                        VC67U1 Product Binaries 6.7.0U1 VMware-VCSA-all-6.7.0-10244745.iso                            2018-10-16 3.95 GB iso yes
[ 24/25310 ] entries - filter [ fileName:vcsa ]

從 fileIndex.json 內找出 24 筆
從上面的的輸出可以看到有不同的產品(solution), 不同檔案類型(fileType) 的產品

所以再加上過濾條件
# vmw-cli  find  fileName:vcsa,fileType:txt

Loading available solutions in [fileIndex.json] ...
solution                                   productGroup productType version fileName                                                      fileDate fileSize fileType download
-----------------------------------------  ------------ ----------- -------- ------------------------------------------------------------  ---------- -------- -------- --------
vmware-vsphere                             VC65U1G_OSS Open Source 6.5.0U1g open-source-license-VMware-vCenter-Server-VCSA-65U1-g-GA.txt  2018-03-20  4.59 MB txt       yes
vmware-vsphere-with-operations-management  VC65U1G_OSS Open Source 6.5.0U1g open-source-license-VMware-vCenter-Server-VCSA-65U1-g-GA.txt  2018-03-20 4.59 MB txt yes
vmware-vsan                                VC65U1G_OSS Open Source 6.5.0U1g open-source-license-VMware-vCenter-Server-VCSA-65U1-g-GA.txt  2018-03-20 4.59 MB txt yes
vmware-vcloud-nfv                          VC65U1G_OSS Open Source 6.5.0U1g open-source-license-VMware-vCenter-Server-VCSA-65U1-g-GA.txt  2018-03-20 4.59 MB txt yes
vmware-horizon                             VC65U1G_OSS Open Source 6.5.0U1g open-source-license-VMware-vCenter-Server-VCSA-65U1-g-GA.txt  2018-03-20 4.59 MB txt yes
[ 5/25310 ] entries - filter [ fileName:vcsa,fileType:txt ]


嘗試下載檔案, 因為是 Lab, 所以下載 .txt 檔案測試, 檔案名稱由上面的 find 取得

# vmw-cli  get  open-source-license-VMware-vCenter-Server-VCSA-65U1-g-GA.txt

Loading available solutions in [fileIndex.json] ...
Session file[/usr/local/lib/node_modules/vmw-cli/lib/index.json] [922] older than [600] seconds...
Synching delicious cookies from [https://my.vmware.com]
Offering up afforementioned snacks as a sacrifice to [https://my.vmware.com/oam/server/auth_cred_submit]
Pulling landing index.json [https://my.vmware.com/group/vmware/downloads]
{
"name": "Open Source License file for vCenter 6.5.0U1g",
"fileName": "open-source-license-VMware-vCenter-Server-VCSA-65U1-g-GA.txt",
"fileDate": "2018-03-20",
"fileSize": "4.59 MB",
"fileType": "txt",
"md5sum": "06a3fab64c7a8ae2f962cf0b1576e95a",
"sha1sum": "229ad762dc69314c8c9bbefa2133b35cf1c2a800",
"sha256sum": "f38b53198fdc99bc2fed1b5d5b56c0967246103bd26af04c98c96abd97119e90",
"download": {
"downloadGroupCode": "VC65U1G_OSS",
"downloadFileId": "06a3fab64c7a8ae2f962cf0b1576e95a",
"vmware": "downloadBinary",
"baseStr": "",
"hashKey": "",
"tagId": "",
"productId": "",
"uuId": "53a9a37c-a7d3-47fc-aec8-c37834bcfe20"
}
}
[open-source-license-VMware-vCenter-Server-VCSA-65U1-g-GA.txt] downloading... [=================================================>] 100% 0.0s 2789 KB/s 04.81/04.81 MB
MD5 MATCH: local[ 06a3fab64c7a8ae2f962cf0b1576e95a ] remote [ 06a3fab64c7a8ae2f962cf0b1576e95a ]


觀察相關資訊

# ls

.bash_history  .config .gnupg  .npm .viminfo bin  open-source-license-VMware-vCenter-Server-VCSA-65U1-g-GA.txt

下載完成
vmw-cli 也有容器化的版本, 因為大同小異, 所以就沒有再次測試

也算是多一個方便下載 my.vmware.com的工具吧



~ enjoy it

Reference: