Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

新增對 arm64 架構的支援 #25

Closed
hoyangtsai opened this issue Jul 10, 2022 · 17 comments
Closed

新增對 arm64 架構的支援 #25

hoyangtsai opened this issue Jul 10, 2022 · 17 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@hoyangtsai
Copy link

我執行首次啟動命令

❯ docker run -it -v /path/to/local:/cookie hyperbola/shopee-coins-bot:1 -u username -p password -c /cookie
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
Start shopee coins bot v1.0.17.
Passing password from command line is considered insecure. Should use environment variable or password file.

❯ docker ps -a
CONTAINER ID   IMAGE                          COMMAND                  CREATED          STATUS                      PORTS                    NAMES
a400a4e93420   hyperbola/shopee-coins-bot:1   "tini -- node index.…"   10 seconds ago   Exited (88) 7 seconds ago                            busy_lalande

之後我加上 --platform 參數

❯ docker run -it -v /path/to/local:/cookie --platform linux/amd64 hyperbola/shopee-coins-bot:1 -u username -p password -c /cookie
Start shopee coins bot v1.0.17.
Passing password from command line is considered insecure. Should use environment variable or password file.

❯ docker ps -a
CONTAINER ID   IMAGE                          COMMAND                  CREATED              STATUS                           PORTS                    NAMES
cac46630e4c7   hyperbola/shopee-coins-bot:1   "tini -- node index.…"   6 seconds ago        Exited (88) 3 seconds ago                                 admiring_swanson

❯ docker logs -f cac46630e4c7
Start shopee coins bot v1.0.17.
Passing password from command line is considered insecure. Should use environment variable or password file.

Environment:
Apple Silicon M1 Max, macOS 12.4
Docker version 20.10.16, build aa7e414

@wdzeng wdzeng self-assigned this Jul 10, 2022
@wdzeng wdzeng added the bug Something isn't working label Jul 10, 2022
@wdzeng
Copy link
Owner

wdzeng commented Jul 13, 2022

Hi,

抱歉最近生病了,可能幾天後才會開始研究。

@ray1025
Copy link

ray1025 commented Jul 15, 2022

好像只能在 amd64 的系統跑,我在樹莓派4上也不能跑,也是出現這個錯誤。

@0penYour1egs
Copy link

Hi,

抱歉最近生病了,可能幾天後才會開始研究。

還請保重龍體,繼續造福台灣人

@wdzeng
Copy link
Owner

wdzeng commented Jul 15, 2022

Hi,

抱歉最近生病了,可能幾天後才會開始研究。

還請保重龍體,繼續造福台灣人

龍體這個詞不是這樣用的 (¯―¯٥)

@wdzeng wdzeng changed the title Unable to bootstrap Failed to run on ARM machine Jul 16, 2022
@wdzeng
Copy link
Owner

wdzeng commented Jul 23, 2022

Hi @hoyangtsai @ray1025 @0penYour1egs @boneyhsu,

抱歉久等了。我已經增加 arm64 的 image,再請各位試試看。如果順利的話我就把 issue 關掉了。

@wdzeng wdzeng added enhancement New feature or request and removed bug Something isn't working labels Jul 23, 2022
@ray1025
Copy link

ray1025 commented Jul 23, 2022

@wdzeng 謝謝

@ray1025
Copy link

ray1025 commented Jul 24, 2022

@wdzeng 我剛剛在樹莓派4 (64-bit OS) 分別測試 1.0.16 和 1.0.18 版本,1.0.18 還是有問題無法執行。

螢幕擷取畫面 (22)剪

@wdzeng
Copy link
Owner

wdzeng commented Jul 24, 2022

1.0.17 開始才有 arm64 版本。1.0.18 的問題我再研究下。

@wdzeng
Copy link
Owner

wdzeng commented Jul 24, 2022

我先撤掉 1.0.17 和 1.0.18 的 arm。應該今晚會弄好。

@wdzeng
Copy link
Owner

wdzeng commented Jul 25, 2022

@ray1025 請試試看 hyperbola/shopee-coins-bot:1.1.0-alpha.1

@ray1025
Copy link

ray1025 commented Jul 26, 2022

@wdzeng 在樹莓派4測試正常,謝謝。
螢幕擷取畫面 (28)剪

@wdzeng wdzeng closed this as completed Jul 26, 2022
@wdzeng
Copy link
Owner

wdzeng commented Jul 26, 2022

Hi @ray1025,

感謝你協助測試,v1.1.0-alpha.1 已經改為正式版 v1.1.0 發布了。

@wdzeng wdzeng added the good first issue Good for newcomers label Jul 26, 2022
@hoyangtsai
Copy link
Author

Apple silicon 運行還是有問題,應該是在container裡面的用戶權限問題,無法保存cookie

❯ docker run -it -v /path/to/local/shopee-checkin:/cookie hyperbola/shopee-coins-bot:latest -u USER -p PASS -c /cookie
Unable to find image 'hyperbola/shopee-coins-bot:latest' locally
latest: Pulling from hyperbola/shopee-coins-bot
Digest: sha256:b1a607bfcaf8a5763f9244b2f3b3bf9226948ce4102a78efae031fa87fb7f845
Status: Downloaded newer image for hyperbola/shopee-coins-bot:latest
Start shopee coins bot v1.1.0-alpha.1.
Passing password from command line is considered insecure. Should use environment variable or password file.
Start to load cookies.
Failed to load cookies: EISDIR: illegal operation on a directory, read
Start to login shopee.
Try to login by username and password.
Login form submitted. Waiting for redirect.
Login failed: please login via SMS.
An SMS message is sent to your mobile. Once you click the link I will keep going. I will wait for you and please complete it in 10 minutes.
Login permitted.
Start to save cookie.
Failed to save cookie: EISDIR: illegal operation on a directory, open '/cookie'
Coin already received.

@wdzeng
Copy link
Owner

wdzeng commented Jul 27, 2022

Apple silicon 運行還是有問題,應該是在container裡面的用戶權限問題,無法保存cookie

❯ docker run -it -v /path/to/local/shopee-checkin:/cookie hyperbola/shopee-coins-bot:latest -u USER -p PASS -c /cookie
Unable to find image 'hyperbola/shopee-coins-bot:latest' locally
latest: Pulling from hyperbola/shopee-coins-bot
Digest: sha256:b1a607bfcaf8a5763f9244b2f3b3bf9226948ce4102a78efae031fa87fb7f845
Status: Downloaded newer image for hyperbola/shopee-coins-bot:latest
Start shopee coins bot v1.1.0-alpha.1.
Passing password from command line is considered insecure. Should use environment variable or password file.
Start to load cookies.
Failed to load cookies: EISDIR: illegal operation on a directory, read
Start to login shopee.
Try to login by username and password.
Login form submitted. Waiting for redirect.
Login failed: please login via SMS.
An SMS message is sent to your mobile. Once you click the link I will keep going. I will wait for you and please complete it in 10 minutes.
Login permitted.
Start to save cookie.
Failed to save cookie: EISDIR: illegal operation on a directory, open '/cookie'
Coin already received.

Hi,

Cookie 必須要是檔案,不是資料夾。請再確認一下。

@hoyangtsai
Copy link
Author

我試圖本地用 DevContainer debug,但也無法在 Apple silicon 上執行

[2022-07-27T03:22:43.987Z] [+] Building 30.8s (12/16)                                                      
 => [internal] load build definition from Dockerfile-with-features         0.0s
 => => transferring dockerfile: 1.83kB                                     0.0s
 => [internal] load .dockerignore                                          0.0s
 => => transferring context: 2B                                            0.0s
 => resolve image config for docker.io/docker/dockerfile:1.4               3.0s
 => CACHED docker-image://docker.io/docker/dockerfile:1.4@sha256:443aab4c  0.0s
 => [internal] load .dockerignore                                          0.0s
 => [internal] load build definition from Dockerfile-with-features         0.0s
 => [internal] load metadata for mcr.microsoft.com/vscode/devcontainers/b  0.5s
 => [context dev_containers_feature_content_s
[2022-07-27T03:22:43.988Z] ource] load .dockerignore     0.0s
 => => transferring dev_containers_feature_content_source: 2B              0.0s
 => [dev_container_auto_added_stage_label 1/5] FROM mcr.microsoft.com/vsc  0.0s
 => [context dev_containers_feature_content_source] load from client       0.0s
 => => transferring dev_containers_feature_content_source: 3.55kB          0.0s
 => CACHED [dev_container_auto_added_stage_label 2/5] RUN apt-get update   0.0s
 => ERROR [dev_container_auto_added_stage_label 3/5] RUN wget -qO /tmp/c  27.1s
                                                                                
------
 > [dev_container_auto_added_stage_label 3/5] RUN wget -qO /tmp/chrome.deb https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_98.0.4758.102-1_amd64.deb     && apt-get install -yqq /tmp/chrome.deb     && rm /tmp/chrome.deb:
#0 27.05 E: Unable to correct problems, you have held broken packages.
--
[2022-07-27T03:22:43.992Z] ----
error: failed to solve: executor failed running [/bin/sh -c wget -qO /tmp/chrome.deb https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}-1_amd64.deb     && apt-get install -yqq /tmp/chrome.deb     && rm /tmp/chrome.deb]: exit code: 100
[2022-07-27T03:22:44.003Z] Stop (31303 ms): Run: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /var/folders/_2/1f6nrt1d7_131trtqhmzzyt80000gn/T/vsch/container-features/0.241.3-1658892132681/Dockerfile-with-features -t vsc-shopee-coins-bot-7d3a6abf7f010a0a938b735567e7ba90 --build-arg VARIANT=bionic --build-context dev_containers_feature_content_source=/var/folders/_2/1f6nrt1d7_131trtqhmzzyt80000gn/T/vsch/container-features/0.241.3-1658892132681 --build-arg _DEV_CONTAINERS_BASE_IMAGE=dev_container_auto_added_stage_label --build-arg _DEV_CONTAINERS_IMAGE_USER=root --build-arg _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp /Users/hoyang/code/shopee-coins-bot/.devcontainer
[2022-07-27T03:22:44.011Z] Error: Command failed: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /var/folders/_2/1f6nrt1d7_131trtqhmzzyt80000gn/T/vsch/container-features/0.241.3-1658892132681/Dockerfile-with-features -t vsc-shopee-coins-bot-7d3a6abf7f010a0a938b735567e7ba90 --build-arg VARIANT=bionic --build-context dev_containers_feature_content_source=/var/folders/_2/1f6nrt1d7_131trtqhmzzyt80000gn/T/vsch/container-features/0.241.3-1658892132681 --build-arg _DEV_CONTAINERS_BASE_IMAGE=dev_container_auto_added_stage_label --build-arg _DEV_CONTAINERS_IMAGE_USER=root --build-arg _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp /Users/hoyang/code/shopee-coins-bot/.devcontainer
[2022-07-27T03:22:44.011Z]     at GR (/Users/hoyang/.vscode/extensions/ms-vscode-remote.remote-containers-0.241.3/dist/spec-node/devContainersSpecCLI.js:240:1436)
[2022-07-27T03:22:44.011Z]     at processTicksAndRejections (node:internal/process/task_queues:96:5)
[2022-07-27T03:22:44.011Z]     at async Hu (/Users/hoyang/.vscode/extensions/ms-vscode-remote.remote-containers-0.241.3/dist/spec-node/devContainersSpecCLI.js:239:2796)
[2022-07-27T03:22:44.012Z]     at async tb (/Users/hoyang/.vscode/extensions/ms-vscode-remote.remote-containers-0.241.3/dist/spec-node/devContainersSpecCLI.js:239:1779)
[2022-07-27T03:22:44.012Z]     at async QR (/Users/hoyang/.vscode/extensions/ms-vscode-remote.remote-containers-0.241.3/dist/spec-node/devContainersSpecCLI.js:245:2006)
[2022-07-27T03:22:44.012Z]     at async cb (/Users/hoyang/.vscode/extensions/ms-vscode-remote.remote-containers-0.241.3/dist/spec-node/devContainersSpecCLI.js:245:3110)
[2022-07-27T03:22:44.013Z]     at async i_ (/Users/hoyang/.vscode/extensions/ms-vscode-remote.remote-containers-0.241.3/dist/spec-node/devContainersSpecCLI.js:245:13194)
[2022-07-27T03:22:44.013Z]     at async n_ (/Users/hoyang/.vscode/extensions/ms-vscode-remote.remote-containers-0.241.3/dist/spec-node/devContainersSpecCLI.js:245:12950)
[2022-07-27T03:22:44.014Z] Stop (31746 ms): Run: /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper /Users/hoyang/.vscode/extensions/ms-vscode-remote.remote-containers-0.241.3/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /Users/hoyang/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --workspace-folder /Users/hoyang/code/shopee-coins-bot --workspace-mount-consistency cached --id-label devcontainer.local_folder=/Users/hoyang/code/shopee-coins-bot --log-level debug --log-format json --config /Users/hoyang/code/shopee-coins-bot/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true
[2022-07-27T03:22:44.014Z] Exit code 1
[2022-07-27T03:22:44.016Z] Command failed: /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper /Users/hoyang/.vscode/extensions/ms-vscode-remote.remote-containers-0.241.3/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /Users/hoyang/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --workspace-folder /Users/hoyang/code/shopee-coins-bot --workspace-mount-consistency cached --id-label devcontainer.local_folder=/Users/hoyang/code/shopee-coins-bot --log-level debug --log-format json --config /Users/hoyang/code/shopee-coins-bot/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true
[2022-07-27T03:22:44.016Z] Exit code 1

@ray1025
Copy link

ray1025 commented Jul 27, 2022

❯ docker run -it -v /path/to/local/shopee-checkin:/cookie hyperbola/shopee-coins-bot:latest -u USER -p PASS -c /cookie

你的 shopee-checkin 這個必需是一個檔案,而且要給 docker 完整讀寫的權限,如果是在 Linux 系統下,那就是給 666 權限比較快解決。

@wdzeng wdzeng changed the title Failed to run on ARM machine 新增對 arm64 平台的支援 Jul 28, 2022
@wdzeng wdzeng changed the title 新增對 arm64 平台的支援 新增對 arm64 架構的支援 Jul 28, 2022
@wdzeng
Copy link
Owner

wdzeng commented Jul 31, 2022

你的 shopee-checkin 這個必需是一個檔案,而且要給 docker 完整讀寫的權限,如果是在 Linux 系統下,那就是給 666 權限比較快解決。

小提醒,因為 cookie 是非常敏感的資訊,給 666 權限我覺得是不太好的;應該要設 600。如果擔心 docker 無法讀取檔案,可以試著使用 docker 的 --user 參數,見 #21

我試圖本地用 DevContainer debug,但也無法在 Apple silicon 上執行

這跟那個沒關係。根本問題是你使用 -c 參數的方式不對。cookie 是檔案,不是資料夾。

devcontainer 的問題我不清楚,他在我這邊沒出問題。那只是方便我開發測試用的環境,並不適合在正式場合拿來跑機器人。

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants