Updated libraries, docker engine version, docker distro version

This also officially publishes the changes from @eels.
Sorry it took so long.
This commit is contained in:
2023-12-23 23:36:18 +11:00
parent 45b9ac1281
commit 99dfaddf04
8 changed files with 1275 additions and 166 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ WEB_PORT=3100
WEB_ORIGIN=http://localhost:3001 WEB_ORIGIN=http://localhost:3001
DB_HOSTNAME=database DB_HOSTNAME=localhost
DB_DATABASE=news DB_DATABASE=news
DB_USERNAME=news DB_USERNAME=news
DB_PASSWORD=venusaur DB_PASSWORD=venusaur
+1 -1
View File
@@ -1,5 +1,5 @@
FROM node:18-bullseye-slim FROM node:21-bookworm-slim
WORKDIR "/app" WORKDIR "/app"
COPY package*.json /app COPY package*.json /app
RUN npm install --production RUN npm install --production
+3 -4
View File
@@ -43,8 +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}:
build: build:
@@ -85,7 +84,7 @@ services:
- ./mysql:/var/lib/mysql - ./mysql:/var/lib/mysql
- ./startup.sql:/docker-entrypoint-initdb.d/startup.sql:ro - ./startup.sql:/docker-entrypoint-initdb.d/startup.sql:ro
traefik_${appName}: traefik_${appName}:
image: "traefik:v2.4" image: "traefik:v2.10"
command: command:
- "--log.level=ERROR" - "--log.level=ERROR"
- "--api.insecure=false" - "--api.insecure=false"
@@ -109,7 +108,7 @@ networks:
`; `;
const dockerfile = ` const dockerfile = `
FROM node:18-bullseye-slim FROM node:21-bookworm-slim
WORKDIR "/app" WORKDIR "/app"
COPY package*.json /app COPY package*.json /app
RUN npm install --production RUN npm install --production
+1264 -97
View File
File diff suppressed because it is too large Load Diff
+6 -9
View File
@@ -1,6 +1,6 @@
{ {
"name": "news-server", "name": "news-server",
"version": "1.6.5", "version": "1.7.0",
"description": "An API centric news server. Uses Sequelize and mariaDB by default.", "description": "An API centric news server. Uses Sequelize and mariaDB by default.",
"main": "server/server.js", "main": "server/server.js",
"scripts": { "scripts": {
@@ -22,15 +22,12 @@
"cors": "^2.8.5", "cors": "^2.8.5",
"dotenv": "^16.3.1", "dotenv": "^16.3.1",
"express": "^4.18.2", "express": "^4.18.2",
"jsonwebtoken": "^9.0.0", "jsonwebtoken": "^9.0.2",
"mariadb": "^3.2.0", "mariadb": "^3.2.3",
"markdown-it": "^13.0.1", "markdown-it": "^13.0.2",
"sequelize": "^6.32.1" "sequelize": "^6.35.2"
}, },
"devDependencies": { "devDependencies": {
"nodemon": "^2.0.22" "nodemon": "^3.0.2"
},
"overrides": {
"semver": "^7.5.2"
} }
} }
-44
View File
@@ -24,48 +24,4 @@ app.get('*', (req, res) => {
server.listen(process.env.WEB_PORT || 3100, async (err) => { server.listen(process.env.WEB_PORT || 3100, async (err) => {
await database.sync(); await database.sync();
console.log(`listening to localhost:${process.env.WEB_PORT || 3100}`); console.log(`listening to localhost:${process.env.WEB_PORT || 3100}`);
//COMPATABILITY: parse the unrendered data from the database
const markdownIt = require('markdown-it')();
const { articles, revisions } = require('./database/models');
const missingArticles = await articles.findAll({
where: {
rendered: ''
}
});
const missingRevisions = await revisions.findAll({
where: {
rendered: ''
}
});
await Promise.all(
missingArticles.map(async ma => {
ma.update({
rendered: markdownIt.render(ma.body)
}, {
where: {
index: ma.index
}
});
})
)
.then(result => {if (result.length > 0) console.log('Rendered articles in HTML'); })
;
await Promise.all(
missingRevisions.map(async mr => {
mr.update({
rendered: markdownIt.render(mr.body)
}, {
where: {
index: mr.index
}
});
})
)
.then(result => {if (result.length > 0) console.log('Rendered revisions in HTML'); })
;
}); });
-6
View File
@@ -1,6 +0,0 @@
use news;
ALTER TABLE revisions CHANGE COLUMN id `index` INTEGER(11) UNIQUE NOT NULL AUTO_INCREMENT;
ALTER TABLE revisions DROP FOREIGN KEY revisions_ibfk_1;
ALTER TABLE revisions CHANGE COLUMN originalIndex originalIndex INTEGER(11);
-4
View File
@@ -1,4 +0,0 @@
ALTER TABLE articles ADD COLUMN rendered TEXT DEFAULT "" AFTER body;
ALTER TABLE revisions ADD COLUMN rendered TEXT DEFAULT "" AFTER body;