Clarence-Bot icon indicating copy to clipboard operation
Clarence-Bot copied to clipboard

/r6stats - Doesnt work on deployed docker

Open Ki-er opened this issue 2 years ago • 27 comments

Ref: https://github.com/hmes98318/r6s-stats-api/issues/1#issuecomment-1234520102

R6 stats api doesnt work within deployed docker

More research needs to be carried out for this

Ki-er avatar Sep 02 '22 18:09 Ki-er

It works for this input waifu_-. pc and null for type

G0maa avatar Oct 15 '22 07:10 G0maa

I think it's more like the user has to be registered here: https://r6.tracker.network/

G0maa avatar Oct 15 '22 07:10 G0maa

Doing the inputs above I get image

It works in my local development of nodejs, it may work for yours due to the dev.docker but im not sure why it doesnt work for the deployed docker

Ki-er avatar Oct 15 '22 08:10 Ki-er

No worries, fix on the way 😬

G0maa avatar Oct 15 '22 08:10 G0maa

Still getting undefined

Ki-er avatar Oct 15 '22 10:10 Ki-er

Huh... how did you test it? i.e. How did you start docker image?

G0maa avatar Oct 15 '22 10:10 G0maa

Here's what I tested: docker compose up This one worked normally.

2nd option: docker build . then:

docker run -d \
--name=clarence \
-p 6002:6002 \
-e DISCORD_TOKEN='INSERT DISCORD TOKEN' \
-e MONGOOSE='INSERT MONGODB URL' \
-e PREFIX='-' \
--restart unless-stopped \
8b020cbc738b (image id)

This also worked normally.

Have you tried rebuilding the image?

G0maa avatar Oct 15 '22 11:10 G0maa

I ran the docker command seen in the README pulling the latest image. Ill try setting it up using the docker compose and giving it ago

Ki-er avatar Oct 15 '22 12:10 Ki-er

Weird... I just tried the one in README it still worked I guess we need some third person to verify.

G0maa avatar Oct 15 '22 12:10 G0maa

@CrimsonTome, we request your assistance 😆

Ki-er avatar Oct 15 '22 12:10 Ki-er

Weird... I just tried the one in README it still worked I guess we need some third person to verify.

What inputs did you try. ill try the same ones

Ki-er avatar Oct 15 '22 12:10 Ki-er

Similar to the one in the docs waifu_-., you can try the bot here: https://discord.gg/BfSVskDN

G0maa avatar Oct 15 '22 12:10 G0maa

@CrimsonTome, we request your assistance 😆

If you don't mind waiting til this evening/tomorrow as I'm out most of today

CrimsonTome avatar Oct 15 '22 12:10 CrimsonTome

It's looking like it doesn't want to work when being ran in Docker in a VM

CrimsonTome avatar Oct 16 '22 00:10 CrimsonTome

correction: doesnt like being ran in a VM at all, node or docker os: Ubuntu 22.04 apologies I have no idea how this would be resolved

CrimsonTome avatar Oct 16 '22 00:10 CrimsonTome

try to install curl in the docker image may can get some help https://github.com/hmes98318/r6s-stats-api/issues/1#issuecomment-1280021572

hmes98318 avatar Oct 16 '22 18:10 hmes98318

Mhm... this might be actually it, because curl doesn't exist on my WSL2 Ubuntu 20.04...

I can't remember if dockerfile can have 2 images i.e. two FROM, but the second option is to have a multi-stage dockerfile.

edit, forgot to link

G0maa avatar Oct 16 '22 21:10 G0maa

https://www.howtogeek.com/devops/what-are-multi-stage-docker-builds/#:~:text=Multi-stage%20Docker%20builds%20let%20you%20write%20Dockerfiles%20with,that%20image%20by%20adding%20commands%20to%20your%20Dockerfile.

Apparently theres multistage

edit: You said that 😆

Ki-er avatar Oct 16 '22 21:10 Ki-er

gg, I'll try to do it soon_ish_.

G0maa avatar Oct 16 '22 21:10 G0maa

Mhm... this might be actually it, because curl doesn't exist on my WSL2 Ubuntu 20.04...

I can't remember if dockerfile can have 2 images i.e. two FROM, but the second option is to have a multi-stage dockerfile.

edit, forgot to link

Add RUN apt-get update -y && apt-get install --no-install-recommends -y curl to your Dockerfile

hmes98318 avatar Oct 17 '22 08:10 hmes98318

Mhm... this might be actually it, because curl doesn't exist on my WSL2 Ubuntu 20.04... I can't remember if dockerfile can have 2 images i.e. two FROM, but the second option is to have a multi-stage dockerfile. edit, forgot to link

Add RUN apt-get update -y && apt-get install --no-install-recommends -y curl to your Dockerfile

This did not fix it

Ki-er avatar Oct 17 '22 08:10 Ki-er

This did not fix it

Where is not solved? I did not understand. 😕

hmes98318 avatar Oct 17 '22 08:10 hmes98318

Doing the inputs above I get image

It outputs the above and in console, nothing appears when doing console.log(profile)

Ki-er avatar Oct 17 '22 09:10 Ki-er

It outputs the above and in console, nothing appears when doing console.log(profile)

umm... Using same Dockerfile to build image is available.

FROM node:16.17.1

WORKDIR /usr/clarence/

COPY --chown=node:node . .

RUN npm --verbose install

RUN apt-get update -y && apt-get install --no-install-recommends -y curl

CMD ["node", "src/index.js"]

image

hmes98318 avatar Oct 17 '22 09:10 hmes98318

this is not a docker issue, this is most likely an issue with it being ran in a VM

CrimsonTome avatar Oct 17 '22 12:10 CrimsonTome

Hmm... 👀

Just use Axios instead of exec in r6stats... this solves basically everything 😬

** If curl is actually the culprit causing this problem **

G0maa avatar Oct 17 '22 14:10 G0maa

Could anyone try r6stats now after this.

G0maa avatar Oct 26 '22 16:10 G0maa