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

Support for Raspberry pi 4 #17

Open
adremides opened this issue Jun 7, 2022 · 2 comments
Open

Support for Raspberry pi 4 #17

adremides opened this issue Jun 7, 2022 · 2 comments

Comments

@adremides
Copy link

Seems like @discordjs/opus doesn't have the binary pre compiled to work with arm64v8.

Some changes in Dockerfile do the magic but image grows a lot due to the need of building tools.

Made an issue in the repo of discordjs/opus: Support for Raspberry pi 4

Dockerfile

FROM arm64v8/node:16-alpine

# Install python/pip
ENV PYTHONUNBUFFERED=1
RUN apk add --update --no-cache python3 && ln -sf python3 /usr/bin/python
RUN python3 -m ensurepip
RUN pip3 install --no-cache --upgrade pip setuptools
RUN apk add --update --no-cache make gcc g++

ENV NODE_ENV production

WORKDIR /home/node

COPY --chown=node:node . .

RUN npm i @discordjs/opus

USER node

RUN npm i

CMD ["npm", "run", "bot"];

docker-compose.yml

version: '3'

services:
  redis:
    container_name: youtube-bot-redis
    image: arm64v8/redis
    sysctls:
      - net.core.somaxconn=1024
    restart: always

  bot:
    image: youtube-bot:latest
    container_name: youtube-bot
    depends_on:
      - redis
    build: .
    restart: always

I'm not very good at Docker or Nodejs, so any improvment in this solution is very welcome!

@adremides
Copy link
Author

adremides commented Jun 7, 2022

Bot seems to load well after the corrections but I got an error when I send the /play command. Bot answers "There was a critical error whilst handling your request. Please report this to your admin.".
In the console this error appears:

ReplyError: ERR unknown command 'JSON.SET', with args beginning with: 'discord-youtube-bot:global:cache:youtubevideo:WKWiBr7m_7k' '.' '{"page":"watch","player_response":{"responseContext":{"serviceTr' 
    at parseError (/home/node/node_modules/redis-parser/lib/parser.js:179:12)
    at parseType (/home/node/node_modules/redis-parser/lib/parser.js:302:14)
DiscordAPIError: Invalid Form Body
embeds[0].thumbnail.url: Scheme "no url" is not supported. Scheme must be one of ('http', 'https').
    at RequestHandler.execute (/home/node/node_modules/discord.js/src/rest/RequestHandler.js:350:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async RequestHandler.push (/home/node/node_modules/discord.js/src/rest/RequestHandler.js:51:14)
    at async InteractionWebhook.editMessage (/home/node/node_modules/discord.js/src/structures/Webhook.js:326:15)
    at async CommandInteraction.editReply (/home/node/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:143:21)
    at async MediaControls.start (/home/node/src/classes/modules/MediaControls.ts:93:19)
    at async Function.generateControls (/home/node/src/commands/modules/Controls.ts:77:3)
    at async Object.runner (/home/node/src/commands/modules/Play.ts:38:5)
    at async Play.descriptor.value (/home/node/src/commands/decorators/command.ts:48:5) {
  method: 'patch',
  path: '/webhooks/[hidden]/aW50Z...RDdmT1BnVjZv/messages/@original',
  code: 50035,
  httpStatus: 400,
  requestData: {
    json: {
      content: undefined,
      tts: false,
      nonce: undefined,
      embeds: [Array],
      components: [Array],
      username: undefined,
      avatar_url: undefined,
      allowed_mentions: undefined,
      flags: undefined,
      message_reference: undefined,
      attachments: undefined,
      sticker_ids: undefined
    },
    files: []
  }
}

EDIT: Problem seems to be the use of rejson module instead simple redis (used in the arm64v8 image). This is the error showed if redislabs/rejson image is used instead arm64v8:

Error: getaddrinfo ENOTFOUND redis
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:71:26) {
  errno: -3008,
  code: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'redis'
}

And that error is because Redis container is not running properly. This is the error, typical of a bad architecture image:

exec /usr/local/bin/docker-entrypoint.sh: exec format error

@adremides
Copy link
Author

adremides commented Jun 7, 2022

Solved redis problem... now I have this at play moment:

/home/node/src/classes/modules/YouTubeInterface.ts:197
                                                throw Error('Bad audio resource, cannot continue.');
            ^
Error: Bad audio resource, cannot continue.
    at H.<anonymous> (/home/node/src/classes/modules/YouTubeInterface.ts:197:13)
    at Object.onceWrapper (node:events:642:26)
    at H.emit (node:events:527:28)
    at H.emit (node:domain:475:12)
    at Encoder.t (/home/node/node_modules/@discordjs/voice/src/audio/AudioPlayer.ts:367:10)
    at Object.onceWrapper (node:events:642:26)
    at Encoder.emit (node:events:539:35)
    at Encoder.emit (node:domain:475:12)
    at emitErrorNT (node:internal/streams/destroy:157:8)
    at emitErrorCloseNT (node:internal/streams/destroy:122:3)

EDIT: Now this error solves by install pulseaudio. By the way, I'm using Ubuntu Server in a Raspberry pi 4.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant