fix(bigbot): Fix docker rabbitmq (#4066)

This commit is contained in:
Fleny
2024-12-30 18:10:06 +01:00
committed by GitHub
parent a043ffbf41
commit 8aea9e3d58
11 changed files with 1046 additions and 845 deletions
+11 -11
View File
@@ -4,7 +4,7 @@ ARG NODE_VERSION=20
################################################################################
FROM node:${NODE_VERSION}-alpine as base
FROM node:${NODE_VERSION}-alpine AS base
# Set working directory for all build stages.
WORKDIR /usr/src/app
@@ -26,50 +26,50 @@ COPY . .
RUN yarn build
# Use production node environment by default.
ENV NODE_ENV production
ENV NODE_ENV=production
# Run the application as a non-root user.
USER node
################################################################################
FROM base as rest
FROM base AS rest
# Expose the port that the application listens on.
EXPOSE 8000
# Run the application.
CMD node dist/rest/index.js
CMD ["node", "dist/rest/index.js"]
################################################################################
FROM base as gateway
FROM base AS gateway
# Expose the port that the application listens on.
EXPOSE 8080
# Run the application.
CMD node dist/gateway/index.js
CMD ["node", "dist/gateway/index.js"]
################################################################################
FROM base as bot
FROM base AS bot
# Expose the port that the application listens on.
EXPOSE 8081
# Run the application.
CMD node dist/bot/index.js
CMD ["node", "dist/bot/index.js"]
################################################################################
FROM rabbitmq:3.12-management-alpine as rabbitmq
FROM rabbitmq:4.0-management-alpine AS rabbitmq
# Copy the rabbitmq plugins
COPY rabbitmq/plugins/** plugins
HEALTHCHECK CMD [ "rabbitmq-diagnostics", "-q", "status" ] \
--interval=30s --timeout=30s --start-period=30s --retries=5
HEALTHCHECK --interval=30s --timeout=30s --start-period=30s --retries=5 \
CMD rabbitmq-diagnostics -q ping || exit 1
# Enable the required plugins
RUN rabbitmq-plugins enable rabbitmq_message_deduplication
+5 -5
View File
@@ -60,12 +60,12 @@ You can check the REST process fetch analytics (methods, status...) in influxdb'
> [!NOTE]
> This template has been tested with the following versions:
>
> - NodeJS: v18.20.3, v20.14.0 and v22.2.0
> - NodeJS: v18.20.3, v20.18.1 and v22.2.0
> - Any NodeJS version between v18.20.3 and v22.2.0 should work, anything below v18 will not run correctly, anything above v22 should work
> - RabbitMQ: v3.12.14 with:
> - Erlang: v26.2.5
> - [RabbitMQ Message Deduplication Plugin](https://github.com/noxdafox/rabbitmq-message-deduplication): v0.6.2
> - InfluxDB: v2.7.6
> - RabbitMQ: v4.0.5 with:
> - Erlang: v27.2
> - [RabbitMQ Message Deduplication Plugin](https://github.com/noxdafox/rabbitmq-message-deduplication): v0.6.4
> - InfluxDB: v2.7.11
You will need to start a few processes.
+1 -1
View File
@@ -1,6 +1,6 @@
services:
influxdb:
image: influxdb:2.7.6-alpine
image: influxdb:2.7-alpine
ports:
- 127.0.0.1:8086:8086
env_file:
+11 -11
View File
@@ -19,20 +19,20 @@
"setup-dd": ""
},
"dependencies": {
"@discordeno/bot": "20.0.0",
"@discordeno/bot": "21.0.0",
"@fastify/multipart": "^9.0.1",
"@influxdata/influxdb-client": "^1.33.2",
"amqplib": "^0.10.4",
"chalk": "^5.3.0",
"@influxdata/influxdb-client": "^1.35.0",
"amqplib": "^0.10.5",
"chalk": "^5.4.1",
"dotenv": "^16.4.7",
"fastify": "^5.1.0"
"fastify": "^5.2.0"
},
"devDependencies": {
"@swc/cli": "^0.5.0",
"@swc/core": "^1.9.2",
"@types/amqplib": "^0.10.5",
"@types/node": "^22.9.0",
"chokidar": "^4.0.3",
"typescript": "^5.6.3"
"@swc/cli": "^0.5.2",
"@swc/core": "^1.10.4",
"@types/amqplib": "^0.10.6",
"@types/node": "^22.10.2",
"chokidar": "^3.6.0",
"typescript": "^5.7.2"
}
}
+2 -2
View File
@@ -5,7 +5,7 @@ import 'dotenv/config'
// General Configurations
export const DEVELOPMENT = process.env.DEVELOPMENT ?? false
export const DEVELOPMENT = process.env.DEVELOPMENT === 'true'
export const DEV_SERVER_ID = process.env.DEV_SERVER_ID
export const DISCORD_TOKEN = assertEnv('DISCORD_TOKEN')
@@ -36,7 +36,7 @@ export const GATEWAY_PORT = parseNumber(assertEnv('GATEWAY_PORT'), 'GATEWAY_PORT
// Message queue (RabbitMQ configuration)
export const MESSAGEQUEUE_ENABLE = process.env.MESSAGEQUEUE_ENABLE === "true"
export const MESSAGEQUEUE_ENABLE = process.env.MESSAGEQUEUE_ENABLE === 'true'
export const MESSAGEQUEUE_URL = process.env.MESSAGEQUEUE_URL
export const MESSAGEQUEUE_USERNAME = process.env.MESSAGEQUEUE_USERNAME
@@ -37,7 +37,7 @@ export function createWorker(workerId: number): Worker {
},
workerId,
messageQueue: {
enabled: MESSAGEQUEUE_ENABLE === 'true',
enabled: MESSAGEQUEUE_ENABLE,
username: MESSAGEQUEUE_USERNAME,
password: MESSAGEQUEUE_PASSWORD,
url: MESSAGEQUEUE_URL,
+1015 -814
View File
File diff suppressed because it is too large Load Diff