@@ -0,0 +1,2 @@
+node_modules
+npm-debug.log
@@ -1,7 +1,8 @@
PORT=3000
-REDIS_HOST=localhost
+VOLUME_DIR=./data
+REDIS_HOST=redis
REDIS_PORT=6379
-REDIS_USER=root
+REDIS_USER=redis
REDIS_PASSWORD=s1mpl3
WATCH_USER=4dage
WATCH_PASSWORD=4dage168.
@@ -0,0 +1,11 @@
+FROM node:gallium-alpine3.15
+
+WORKDIR /usr/src/app
+COPY . .
+RUN npm install
+EXPOSE $PORT
+CMD [ "node", "index.js" ]
@@ -25,7 +25,7 @@
// 'http://47.115.43.159:3000'
// var socket = io("http://0.0.0.0:3000");
// const { roomId, userId, sceneNum, isClient, role, userLimitNum, roomType } = user
- var socket = io("http://0.0.0.0:3000", {
+ var socket = io("http://0.0.0.0:8060", {
path: "/test",
query: {
userId: "user_001",
@@ -0,0 +1,30 @@
+version: "3.4"
+services:
+ chat-socket:
+ restart: always
+ build:
+ context: .
+ ports:
+ - 8060:$PORT
+ environment:
+ REDIS_HOST: $REDIS_HOST
+ REDIS_PORT: $REDIS_PORT
+ REDIS_PASSWORD: $REDIS_PASSWORD
+ # volumes:
+ depends_on:
+ - redis
+ networks:
+ - chat-socket
+ redis:
+ image: redis:5-alpine
+ command: redis-server --requirepass ${REDIS_PASSWORD}
+ - 6666:$REDIS_PORT
+ volumes:
+ - ${VOLUME_DIR}/redis:/data
+networks:
@@ -1,6 +1,7 @@
import { createClient } from "redis";
-const pubClient = createClient({ url: "redis://localhost:6379" });
+const url = `redis://:${process.env.REDIS_PASSWORD}@${process.env.REDIS_HOST}:${process.env.REDIS_PORT}`;
+const pubClient = createClient({ url: url });
const subClient = pubClient.duplicate();
export { pubClient, subClient };