Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 416ab2f3f9 | |||
| 1b5cbaea17 | |||
| 0f2b8d3f52 | |||
| 88c2239fdb | |||
| b5f9d0a7fc | |||
| 1ec29e4519 | |||
| a15c43b3d0 | |||
| 9bc96bdb5f | |||
| 4bdcee11ea | |||
| e1cd1ec001 | |||
| e8a9a79687 | |||
| 7d628be826 | |||
| 7a42ab3108 | |||
| ec573e1074 | |||
| 9c5033daea | |||
| fb4d857224 | |||
| e0d6260d1a | |||
| 53ea726c89 | |||
| c44ed79e6d | |||
| 518f5dbee7 | |||
| be57dbe51c | |||
| 8309c3b832 |
@@ -1,6 +1,8 @@
|
|||||||
WEB_PORT=3300
|
WEB_PORT=3300
|
||||||
|
|
||||||
DB_HOSTNAME=database
|
WEB_ORIGIN=http://localhost:3001
|
||||||
|
|
||||||
|
DB_HOSTNAME=localhost
|
||||||
DB_DATABASE=chat
|
DB_DATABASE=chat
|
||||||
DB_USERNAME=chat
|
DB_USERNAME=chat
|
||||||
DB_PASSWORD=blastoise
|
DB_PASSWORD=blastoise
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
# These are supported funding model platforms
|
||||||
|
|
||||||
|
patreon: krgamestudios
|
||||||
|
ko_fi: krgamestudios
|
||||||
|
custom: ["https://www.paypal.com/donate/?hosted_button_id=73Q82T2ZHV8AA"]
|
||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
FROM node:16
|
FROM node:21-bookworm-slim
|
||||||
WORKDIR "/app"
|
WORKDIR "/app"
|
||||||
COPY package*.json ./
|
COPY package*.json /app
|
||||||
RUN npm install --production
|
RUN npm install --production
|
||||||
COPY . /app
|
COPY . /app
|
||||||
EXPOSE 3300
|
EXPOSE 3300
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2021 Kayne Ruse, KR Game Studios
|
Copyright (c) 2021-2023 Kayne Ruse, KR Game Studios
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
|
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ POST https://dev-auth.krgamestudios.com/auth/login HTTP/1.1
|
|||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
|
|
||||||
{
|
{
|
||||||
"email": "kayneruse@gmail.com",
|
"email": "example@example.com",
|
||||||
"password": "helloworld"
|
"password": "helloworld"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|||||||
+5
-3
@@ -30,6 +30,7 @@ const question = (prompt, def = null) => {
|
|||||||
//project configuration
|
//project configuration
|
||||||
const appName = await question('App Name', 'chat');
|
const appName = await question('App Name', 'chat');
|
||||||
const appWebAddress = await question('Web Addr', `${appName}.example.com`);
|
const appWebAddress = await question('Web Addr', `${appName}.example.com`);
|
||||||
|
const appWebOrigin = await question('Web Origin', `https://example.com`); //TODO: clean these up properly
|
||||||
const appPort = await question('App Port', '3300');
|
const appPort = await question('App Port', '3300');
|
||||||
|
|
||||||
const appDBUser = await question('DB User', appName);
|
const appDBUser = await question('DB User', appName);
|
||||||
@@ -42,7 +43,7 @@ const question = (prompt, def = null) => {
|
|||||||
|
|
||||||
//generate the files
|
//generate the files
|
||||||
const ymlfile = `
|
const ymlfile = `
|
||||||
version: '3'
|
version: '3.8'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
${appName}:
|
${appName}:
|
||||||
@@ -59,6 +60,7 @@ services:
|
|||||||
- "traefik.http.services.${appName}service.loadbalancer.server.port=${appPort}"
|
- "traefik.http.services.${appName}service.loadbalancer.server.port=${appPort}"
|
||||||
environment:
|
environment:
|
||||||
- WEB_PORT=${appPort}
|
- WEB_PORT=${appPort}
|
||||||
|
- WEB_ORIGIN=${appWebOrigin}
|
||||||
- DB_HOSTNAME=database
|
- DB_HOSTNAME=database
|
||||||
- DB_DATABASE=${appName}
|
- DB_DATABASE=${appName}
|
||||||
- DB_USERNAME=${appDBUser}
|
- DB_USERNAME=${appDBUser}
|
||||||
@@ -83,7 +85,7 @@ services:
|
|||||||
- ./startup.sql:/docker-entrypoint-initdb.d/startup.sql:ro
|
- ./startup.sql:/docker-entrypoint-initdb.d/startup.sql:ro
|
||||||
traefik_${appName}:
|
traefik_${appName}:
|
||||||
container_name: ${appName}_traefik
|
container_name: ${appName}_traefik
|
||||||
image: "traefik:v2.4"
|
image: "traefik:v2.10"
|
||||||
container_name: "traefik"
|
container_name: "traefik"
|
||||||
command:
|
command:
|
||||||
- "--log.level=ERROR"
|
- "--log.level=ERROR"
|
||||||
@@ -108,7 +110,7 @@ networks:
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
const dockerfile = `
|
const dockerfile = `
|
||||||
FROM node:16
|
FROM node:21-bookworm-slim
|
||||||
WORKDIR "/app"
|
WORKDIR "/app"
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
RUN npm install --production
|
RUN npm install --production
|
||||||
|
|||||||
Generated
+564
-2966
File diff suppressed because it is too large
Load Diff
+8
-8
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "chat-server",
|
"name": "chat-server",
|
||||||
"version": "1.2.5",
|
"version": "1.5.0",
|
||||||
"description": "An API centric chat server. Uses Sequelize and mariaDB by default.",
|
"description": "An API centric chat server. Uses Sequelize and mariaDB by default.",
|
||||||
"main": "server/server.js",
|
"main": "server/server.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -20,14 +20,14 @@
|
|||||||
"homepage": "https://github.com/krgamestudios/chat-server#readme",
|
"homepage": "https://github.com/krgamestudios/chat-server#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"dotenv": "^8.6.0",
|
"dotenv": "^16.3.1",
|
||||||
"express": "^4.17.1",
|
"express": "^4.18.2",
|
||||||
"jsonwebtoken": "^8.5.1",
|
"jsonwebtoken": "^9.0.2",
|
||||||
"mariadb": "^2.5.4",
|
"mariadb": "^3.2.3",
|
||||||
"sequelize": "^6.6.5",
|
"sequelize": "^6.35.2",
|
||||||
"socket.io": "^4.1.3"
|
"socket.io": "^4.7.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"nodemon": "^2.0.12"
|
"nodemon": "^3.0.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-2
@@ -7,14 +7,19 @@ const app = express();
|
|||||||
const server = require('http').Server(app);
|
const server = require('http').Server(app);
|
||||||
const io = require('socket.io')(server, {
|
const io = require('socket.io')(server, {
|
||||||
cors: {
|
cors: {
|
||||||
origin: '*'
|
origin: process.env.WEB_ORIGIN
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const cors = require('cors');
|
const cors = require('cors');
|
||||||
|
|
||||||
//config
|
//config
|
||||||
app.use(express.json());
|
app.use(express.json());
|
||||||
app.use(cors());
|
app.use(cors({
|
||||||
|
credentials: true,
|
||||||
|
origin: [`${process.env.WEB_ORIGIN}`], //because auth-server
|
||||||
|
allowedHeaders: ['Origin', 'X-Requested-With', 'Content-Type', 'Accept', 'Authorization', 'Set-Cookie'],
|
||||||
|
exposedHeaders: ['Origin', 'X-Requested-With', 'Content-Type', 'Accept', 'Authorization', 'Set-Cookie'],
|
||||||
|
}));
|
||||||
|
|
||||||
//database connection
|
//database connection
|
||||||
const database = require('./database');
|
const database = require('./database');
|
||||||
|
|||||||
Reference in New Issue
Block a user