Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

heartbeat forward and import from wakatime doesn't work on raspberry pi 4b #36

Closed
Scallions opened this issue Jun 10, 2021 · 4 comments
Closed
Labels
bug Something isn't working

Comments

@Scallions
Copy link

Scallions commented Jun 10, 2021

Thank you for your excellent work. It works well on my x86 server but get some wrong on my arm device.
It can receive heartbeat from my pc but can't forward to other server.

This is my config

version: "3"
services:
  server:
    container_name: hakatime
    image: mujx/hakatime:v1.4.0-arm
    environment:
      # DB settings.
      HAKA_DB_HOST: haka_db
      HAKA_DB_PORT: 5432
      HAKA_DB_NAME: test
      HAKA_DB_PASS: test
      HAKA_DB_USER: test
      # Server settings.
      # Fill out this field if the api is behind another path (e.g behind a reverse proxy).
      # This will adjust the Set-Cookie path for all the /auth related API calls.
      HAKA_API_PREFIX: ""
      # Update this with the external endpoint that you use to access hakatime.
      HAKA_BADGE_URL: "http://192.168.20.141:9099"
      HAKA_PORT: 9090
      HAKA_SHIELDS_IO_URL: "https://img.shields.io"
      HAKA_ENABLE_REGISTRATION: "true" # Toggle after you've created your account.
      # Number of hours after which inactive browser sessions will expire (login required).
      HAKA_SESSION_EXPIRY: "24"
      HAKA_LOG_LEVEL: "info" # Control the verbosity of the logger.
      HAKA_ENV: "dev" # Use a json logger for production, otherwise key=value pairs.
      HAKA_HTTP_LOG: "true" # If you want to log http requests.
      GITHUB_TOKEN: "*******" # If you want to retrieve time spent per commit. No extra scope is required.
      # Add the following variables if you want to forward any received heartbeats to another
      # Wakatime compatible server.
      HAKA_REMOTE_WRITE_URL: "http://lede.scallions.cn:32772/api/v1/users/current/heartbeats.bulk"
      HAKA_REMOTE_WRITE_TOKEN: "*******"
    ports:
      - "0.0.0.0:9090:9090"
  haka_db:
    container_name: haka_db
    image: postgres:12-alpine
    environment:
      POSTGRES_DB: test
      POSTGRES_PASSWORD: test
      POSTGRES_USER: test
    volumes:
      - deploy_db_data:/var/lib/postgresql/data

volumes:
  deploy_db_data: {}

and the error logs

  • import log:
ts=2021-06-10T15:23:35.447388384Z level=Error host=ab6ff96575c8 msg=failed to execute import request 
ts=2021-06-10T15:23:35.447388384Z level=Error host=ab6ff96575c8 msg=http call to api.wakatime.com failed: InternalException (HandshakeFailed (Error_Protocol ("certificate has unknown CA",True,UnknownCa))) 
  • heartbeat forward log
ts=2021-06-10T15:02:09.242499084Z level=Info host=ab6ff96575c8 msg=received 1 heartbeats 
ts=2021-06-10T15:02:09.242499084Z level=Error host=ab6ff96575c8 msg=Malformed remote write URL was given 
202.114.122.241 - - [10/Jun/2021:15:02:09 +0000] "POST /api/v1/users/current/heartbeats.bulk HTTP/1.1" 200 - "" "wakatime/13.0.7 (macOS-10.16-x86_64-i386-64bit) Python3.8.1.final.0 vscode/1.56.2 vscode-wakatime/12.0.0"
@mujx mujx added the bug Something isn't working label Jun 10, 2021
mujx pushed a commit that referenced this issue Jun 12, 2021
@mujx
Copy link
Owner

mujx commented Jun 12, 2021

Hi @Scallions, thanks for using hakatime and the detailed bug report.

I've pushed a fix for this and verified that it works. You can test it out using the mujx/hakatime:latest-arm image.

@Scallions
Copy link
Author

Hi @Scallions, thanks for using hakatime and the detailed bug report.

I've pushed a fix for this and verified that it works. You can test it out using the mujx/hakatime:latest-arm image.

Thank you for the quick update. The import function works normally after this update. but there is a new bug when i use a hakatime server to forward another hakatime server. This operation is a bit strange. 😅 It seems port recognition is not normal.

  • the config
# Wakatime compatible server.
HAKA_REMOTE_WRITE_URL: "http://lede.scallions.cn:32772/api/v1/users/current/heartbeats.bulk"
HAKA_REMOTE_WRITE_TOKEN: "*******"
  • the log
192.168.20.241 - - [13/Jun/2021:15:58:01 +0000] "POST /api/v1/users/current/heartbeats.bulk HTTP/1.1" 200 - "" "wakatime/13.0.5 (macOS-11.2.2-x86_64-i386-64bit) Python3.8.2.final.0 vim/802 vim-wakatime/8.0.0"
VanillaHttpException (HttpExceptionRequest Request {
  host                 = "lede.scallions.cn"
  port                 = 80
  secure               = False
  requestHeaders       = [("Authorization","<REDACTED>"),("X-Machine-Name","Scallions-MBP.lan"),("Content-Type","application/json; charset=utf-8")]
  path                 = "/api/v1/users/current/heartbeats.bulk"
  queryString          = ""
  method               = "POST"
  proxy                = Nothing
  rawBody              = False
  redirectCount        = 10
  responseTimeout      = ResponseTimeoutDefault
  requestVersion       = HTTP/1.1
}
 ConnectionTimeout)

@mujx
Copy link
Owner

mujx commented Jun 14, 2021

Indeed the port was ignored. I pushed a fix to include the port found in the url.

@Scallions
Copy link
Author

Indeed the port was ignored. I pushed a fix to include the port found in the url.

👍It's now functioning correctly. Thanks very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants