Fix db mariadb
This commit is contained in:
parent
c5ce00efe5
commit
5dd9eca0d9
@ -3,8 +3,8 @@
|
|||||||
"lang": "ts",
|
"lang": "ts",
|
||||||
"author": "Filip Rojek",
|
"author": "Filip Rojek",
|
||||||
"database": {
|
"database": {
|
||||||
"db": "mongodb",
|
"db": "mysql",
|
||||||
"orm": "mongoose"
|
"orm": "sequelize"
|
||||||
},
|
},
|
||||||
"website": "http://filiprojek.cz/",
|
"website": "http://filiprojek.cz/",
|
||||||
"email": "filip@filiprojek.cz",
|
"email": "filip@filiprojek.cz",
|
||||||
|
53
backend/package-lock.json
generated
53
backend/package-lock.json
generated
@ -18,6 +18,7 @@
|
|||||||
"express-validator": "^6.14.2",
|
"express-validator": "^6.14.2",
|
||||||
"fs-extra": "^10.0.0",
|
"fs-extra": "^10.0.0",
|
||||||
"jsonwebtoken": "^9.0.2",
|
"jsonwebtoken": "^9.0.2",
|
||||||
|
"mariadb": "^3.2.3",
|
||||||
"mongoose": "^5.12.3",
|
"mongoose": "^5.12.3",
|
||||||
"pg": "^8.7.1",
|
"pg": "^8.7.1",
|
||||||
"pg-hstore": "^2.3.4",
|
"pg-hstore": "^2.3.4",
|
||||||
@ -1239,6 +1240,11 @@
|
|||||||
"@types/node": "*"
|
"@types/node": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/geojson": {
|
||||||
|
"version": "7946.0.14",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.14.tgz",
|
||||||
|
"integrity": "sha512-WCfD5Ht3ZesJUsONdhvm84dmzWOiOzOAqOncN0++w0lBw1o8OuDNJF2McvvCef/yBqb/HYRahp1BYtODFQ8bRg=="
|
||||||
|
},
|
||||||
"node_modules/@types/glob": {
|
"node_modules/@types/glob": {
|
||||||
"version": "7.2.0",
|
"version": "7.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.2.0.tgz",
|
||||||
@ -4670,6 +4676,53 @@
|
|||||||
"tmpl": "1.0.5"
|
"tmpl": "1.0.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/mariadb": {
|
||||||
|
"version": "3.2.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/mariadb/-/mariadb-3.2.3.tgz",
|
||||||
|
"integrity": "sha512-Hyc1ehdUJwzvvzcLU2juZS528wJ6oE8pUlpgY0BAOdpKWcdN1motuugi5lC3jkpCkFpyNknHG7Yg66KASl3aPg==",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/geojson": "^7946.0.10",
|
||||||
|
"@types/node": "^17.0.45",
|
||||||
|
"denque": "^2.1.0",
|
||||||
|
"iconv-lite": "^0.6.3",
|
||||||
|
"lru-cache": "^10.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/mariadb/node_modules/@types/node": {
|
||||||
|
"version": "17.0.45",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.45.tgz",
|
||||||
|
"integrity": "sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw=="
|
||||||
|
},
|
||||||
|
"node_modules/mariadb/node_modules/denque": {
|
||||||
|
"version": "2.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/denque/-/denque-2.1.0.tgz",
|
||||||
|
"integrity": "sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/mariadb/node_modules/iconv-lite": {
|
||||||
|
"version": "0.6.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
|
||||||
|
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
|
||||||
|
"dependencies": {
|
||||||
|
"safer-buffer": ">= 2.1.2 < 3.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/mariadb/node_modules/lru-cache": {
|
||||||
|
"version": "10.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.0.tgz",
|
||||||
|
"integrity": "sha512-2bIM8x+VAf6JT4bKAljS1qUWgMsqZRPGJS6FSahIMPVvctcNhyVp7AJu7quxOW9jwkryBReKZY5tY5JYv2n/7Q==",
|
||||||
|
"engines": {
|
||||||
|
"node": "14 || >=16.14"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/media-typer": {
|
"node_modules/media-typer": {
|
||||||
"version": "0.3.0",
|
"version": "0.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
"express-validator": "^6.14.2",
|
"express-validator": "^6.14.2",
|
||||||
"fs-extra": "^10.0.0",
|
"fs-extra": "^10.0.0",
|
||||||
"jsonwebtoken": "^9.0.2",
|
"jsonwebtoken": "^9.0.2",
|
||||||
|
"mariadb": "^3.2.3",
|
||||||
"mongoose": "^5.12.3",
|
"mongoose": "^5.12.3",
|
||||||
"pg": "^8.7.1",
|
"pg": "^8.7.1",
|
||||||
"pg-hstore": "^2.3.4",
|
"pg-hstore": "^2.3.4",
|
||||||
|
@ -39,11 +39,6 @@ async function connect() {
|
|||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (env.NORK.database.db.length > 0) {
|
|
||||||
new Err(500, `unsupported database ${env.NORK.database.db}`)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default connect
|
export default connect
|
||||||
|
@ -2,6 +2,7 @@ import path from 'path'
|
|||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
import { Err } from '../services/globalService'
|
import { Err } from '../services/globalService'
|
||||||
import dotenv from 'dotenv'
|
import dotenv from 'dotenv'
|
||||||
|
import { Dialect } from 'sequelize'
|
||||||
const env_path = process.env.NODE_ENV ? `../.env.${process.env.NODE_ENV}` : '../.env'
|
const env_path = process.env.NODE_ENV ? `../.env.${process.env.NODE_ENV}` : '../.env'
|
||||||
|
|
||||||
dotenv.config({ path: path.join(__dirname, env_path) })
|
dotenv.config({ path: path.join(__dirname, env_path) })
|
||||||
@ -43,9 +44,10 @@ export default {
|
|||||||
JWT_SECRET: String(process.env.JWT_SECRET),
|
JWT_SECRET: String(process.env.JWT_SECRET),
|
||||||
// MongoDB
|
// MongoDB
|
||||||
DB_URI: String(process.env.DB_URI),
|
DB_URI: String(process.env.DB_URI),
|
||||||
// PostgreSQL
|
// Sequelize
|
||||||
DB_PORT: Number(process.env.DB_PORT),
|
DB_PORT: Number(process.env.DB_PORT),
|
||||||
DB_HOST: String(process.env.DB_HOST),
|
DB_HOST: String(process.env.DB_HOST),
|
||||||
|
DB_DIALECT: process.env.DB_DIALECT as Dialect,
|
||||||
DB_USERNAME: String(process.env.DB_USERNAME),
|
DB_USERNAME: String(process.env.DB_USERNAME),
|
||||||
DB_PASSWORD: String(process.env.DB_PASSWORD),
|
DB_PASSWORD: String(process.env.DB_PASSWORD),
|
||||||
DB_DATABASE: String(process.env.DB_DATABASE),
|
DB_DATABASE: String(process.env.DB_DATABASE),
|
||||||
|
@ -3,7 +3,7 @@ import env from './environment'
|
|||||||
|
|
||||||
const db = new Sequelize(env.DB_DATABASE, env.DB_USERNAME, env.DB_PASSWORD, {
|
const db = new Sequelize(env.DB_DATABASE, env.DB_USERNAME, env.DB_PASSWORD, {
|
||||||
host: env.DB_HOST,
|
host: env.DB_HOST,
|
||||||
dialect: 'postgres',
|
dialect: env.DB_DIALECT,
|
||||||
logging: false
|
logging: false
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -47,3 +47,28 @@ Date: "2023-07-01 18:30:40" Type: "Err" Code: "500" Message: "unsupported databa
|
|||||||
Date: "2023-07-01 18:31:01" Type: "Err" Code: "500" Message: "unsupported database mongodb"
|
Date: "2023-07-01 18:31:01" Type: "Err" Code: "500" Message: "unsupported database mongodb"
|
||||||
Date: "2023-07-01 18:31:26" Type: "Err" Code: "500" Message: "unsupported database mongodb"
|
Date: "2023-07-01 18:31:26" Type: "Err" Code: "500" Message: "unsupported database mongodb"
|
||||||
Date: "2023-07-01 18:32:01" Type: "Err" Code: "500" Message: "unsupported database mongodb"
|
Date: "2023-07-01 18:32:01" Type: "Err" Code: "500" Message: "unsupported database mongodb"
|
||||||
|
Date: "2024-03-06 14:55:10" Type: "Err" Code: "500" Message: ".env file for environment does not exists"
|
||||||
|
Date: "2024-03-06 14:58:42" Type: "Err" Code: "500" Message: "JWT_SECRET is not set!"
|
||||||
|
Date: "2024-03-06 14:59:11" Type: "Err" Code: "500" Message: "unsupported database mongodb"
|
||||||
|
Date: "2024-03-06 14:59:41" Type: "Err" Code: "500" Message: "{"message":"connect ECONNREFUSED ::1:27017","reason":{"type":"Single","setName":null,"maxSetVersion":null,"maxElectionId":null,"servers":{},"stale":false,"compatible":true,"compatibilityError":null,"logicalSessionTimeoutMinutes":null,"heartbeatFrequencyMS":10000,"localThresholdMS":15,"commonWireVersion":null}}"
|
||||||
|
Date: "2024-03-06 15:12:22" Type: "Err" Code: "500" Message: "unsupported database mongodb"
|
||||||
|
Date: "2024-03-06 15:12:52" Type: "Err" Code: "500" Message: "{"message":"connect ECONNREFUSED ::1:27017","reason":{"type":"Single","setName":null,"maxSetVersion":null,"maxElectionId":null,"servers":{},"stale":false,"compatible":true,"compatibilityError":null,"logicalSessionTimeoutMinutes":null,"heartbeatFrequencyMS":10000,"localThresholdMS":15,"commonWireVersion":null}}"
|
||||||
|
Date: "2024-03-06 15:17:17" Type: "Err" Code: "500" Message: "unsupported database mysql"
|
||||||
|
Date: "2024-03-06 15:17:17" Type: "Err" Code: "500" Message: "Can't connect to db
|
||||||
|
SequelizeConnectionRefusedError: connect ECONNREFUSED 127.0.0.1:5432"
|
||||||
|
Date: "2024-03-06 15:45:46" Type: "Err" Code: "500" Message: "unsupported database mysql"
|
||||||
|
Date: "2024-03-06 15:45:46" Type: "Err" Code: "500" Message: "Can't connect to db
|
||||||
|
SequelizeConnectionRefusedError: connect ECONNREFUSED 127.0.0.1:5432"
|
||||||
|
Date: "2024-03-06 15:46:51" Type: "Err" Code: "500" Message: "unsupported database mysql"
|
||||||
|
Date: "2024-03-06 15:46:51" Type: "Err" Code: "500" Message: "Can't connect to db
|
||||||
|
SequelizeConnectionRefusedError: connect ECONNREFUSED 127.0.0.1:5432"
|
||||||
|
Date: "2024-03-06 16:08:39" Type: "Err" Code: "500" Message: "unsupported database mysql"
|
||||||
|
Date: "2024-03-06 16:08:39" Type: "Err" Code: "500" Message: "Can't connect to db
|
||||||
|
SequelizeConnectionRefusedError: connect ECONNREFUSED 127.0.0.1:3306"
|
||||||
|
Date: "2024-03-06 16:12:55" Type: "Err" Code: "500" Message: "unsupported database mysql"
|
||||||
|
Date: "2024-03-06 16:12:55" Type: "Err" Code: "500" Message: "Can't connect to db
|
||||||
|
SequelizeConnectionRefusedError: connect ECONNREFUSED 127.0.0.1:3306"
|
||||||
|
Date: "2024-03-06 16:13:40" Type: "Err" Code: "500" Message: "unsupported database mysql"
|
||||||
|
Date: "2024-03-06 16:13:40" Type: "Err" Code: "500" Message: "Can't connect to db
|
||||||
|
SequelizeConnectionError: (conn=3, no: 1049, SQLState: 42000) Unknown database 'deguapp'"
|
||||||
|
Date: "2024-03-06 16:15:55" Type: "Err" Code: "500" Message: "unsupported database mysql"
|
||||||
|
@ -14,18 +14,5 @@ export function runServer(): void {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Fix this shit
|
|
||||||
//(async () => {
|
|
||||||
// if (!env.NORK.database) {
|
|
||||||
// runServer()
|
|
||||||
// } else {
|
|
||||||
// const db_connection = await database()
|
|
||||||
// if (db_connection) {
|
|
||||||
// runServer()
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//})()
|
|
||||||
//
|
|
||||||
runServer()
|
runServer()
|
||||||
const db_connection = database()
|
const db_connection = database()
|
||||||
|
@ -5,7 +5,9 @@ services:
|
|||||||
image: mariadb
|
image: mariadb
|
||||||
restart: always
|
restart: always
|
||||||
environment:
|
environment:
|
||||||
MARIADB_ROOT_PASSWORD: 39In1bx7
|
MARIADB_ROOT_PASSWORD: '39In1bx7'
|
||||||
|
ports:
|
||||||
|
- 3306:3306
|
||||||
volumes:
|
volumes:
|
||||||
- ./db_data:/var/lib/mysql
|
- ./db_data:/var/lib/mysql
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user