mujx / hakatime

Wakatime server implementation & analytics dashboard
https://hakatime.mtx-dev.xyz
The Unlicense
610 stars 45 forks source link

Is HAKA_PORT a port in container or in host? #66

Closed winkee01 closed 1 year ago

winkee01 commented 1 year ago

Hi, I have a question, I want the serving port on my local host machine to be 8282, should I set HAKA_PORT to 8282? Is it a port in the container or in the host? Thank you.

Also, nothing of my activity is shown in the dashboard after loading up the docker container. Can the container read my local config file ~/.wakatime.cfg?

CleanShot 2022-10-13 at 10 53 48@2x
mujx commented 1 year ago

What you need to do if to forward the port specified on HAKA_PORT to your host port. See this question https://stackoverflow.com/questions/35429837/docker-compose-port-mapping and the docker-compose docs for more info.

The container won't ready your config file. Your wakatime client reads that file. Check out this section (https://github.com/mujx/hakatime#client-setup) on how to update it for your hakatime instance.

winkee01 commented 1 year ago

@mujx I have already setup api_key & api_url. I think port mapping is not what you mean in HAKA_PORT, port mapping in docker is in ports field, its format is host_port:container_port, and it has nothing to do with an environment variable like HAKA_PORT, this environment variable has meaning only in your context. And I tested it, it is actually a port on the host.

So my question is that I already set up everything correctly (api_key, api_url) in my host's ~/.wakatime.cfg, why there is still no information shown in the web page?

mujx commented 1 year ago

The port defined in HAKA_PORT is the container_port which can be mapped to any port you want in host_port. You need to define the host_port on your ~/.wakatime.cfg file so the client can send the data.

winkee01 commented 1 year ago

hi, I have already set my port mapping to be 8282:8080,and host_port = 8282 in ~/.wakatime.cfg, I still can't see any information in the web page. What could be the problem?

mujx commented 1 year ago

Show me your ~/.wakatime.cfg to understand better the problem.

winkee01 commented 1 year ago
[settings]
debug = false
hidefilenames = false
ignore =
    COMMIT_EDITMSG$
    PULLREQ_EDITMSG$
    MERGE_MSG$
    TAG_EDITMSG$
api_url = http://10.10.0.3:8282/api
api_key=b5b89b1e-ef81-4d94-973f-78dad2edbd35
mujx commented 1 year ago

The api_url should be the following according to the README:

api_url = http://10.10.0.3:8282/api/v1/users/current/heartbeats.bulk
winkee01 commented 1 year ago

@mujx Thank you, you have been so helpful, it seems to work now.