Compare commits
44 Commits
f995b58d0f
...
64aa1d404e
| Author | SHA1 | Date | |
|---|---|---|---|
| 64aa1d404e | |||
| fa69fa9dcd | |||
| 8d92e94bd6 | |||
| 7c1b8669c0 | |||
| 5f996e7007 | |||
| f0df67fb86 | |||
| b63834eb51 | |||
| e9eb2c1163 | |||
| 3e926844b8 | |||
| ba4d810164 | |||
| b6a52822f1 | |||
| b843e3abc0 | |||
| 7a25dbf68c | |||
| 32d6245b5a | |||
| 45644c9695 | |||
| 0622fce790 | |||
| 0de66fe533 | |||
| 0aa03aea19 | |||
| 2ad9e5d86d | |||
| b57a30338e | |||
| eee820b39e | |||
| c25c8498f3 | |||
| 95a9364391 | |||
| 49907da1b1 | |||
| 93be24a8de | |||
| 22fc1f490c | |||
| 0235b56637 | |||
| 7ca8b295db | |||
| abd756462b | |||
| 2939869816 | |||
| 3bd369c9e2 | |||
| 517654bfbf | |||
| 739f67169e | |||
| 2d003a619f | |||
| bb5ade22c6 | |||
| be4e351217 | |||
| 30b49029b2 | |||
| 890380609f | |||
| 2667db5755 | |||
| 021ec3d383 | |||
| 7018c74884 | |||
| 2b2fa7a82b | |||
| fe9f8add88 | |||
| de7b27bd71 |
17
Dockerfile.dev
Normal file
17
Dockerfile.dev
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# --- Build stage ---
|
||||||
|
FROM node:22 AS build
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
ENV ORIGIN=https://tatort-dev.innovation-hub-niedersachsen.de
|
||||||
|
WORKDIR /app
|
||||||
|
COPY package*.json ./
|
||||||
|
RUN npm ci
|
||||||
|
COPY . ./
|
||||||
|
COPY config_dev.json ./config.json
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# --- Production stage ---
|
||||||
|
FROM node:22-alpine3.20
|
||||||
|
COPY --from=build /app .
|
||||||
|
ENV HOST=0.0.0.0
|
||||||
|
EXPOSE 3000
|
||||||
|
CMD ["sh", "-c", "ORIGIN=https://tatort-dev.innovation-hub-niedersachsen.de node build/index.js"]
|
||||||
@@ -6,6 +6,7 @@ WORKDIR /app
|
|||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
RUN npm ci
|
RUN npm ci
|
||||||
COPY . ./
|
COPY . ./
|
||||||
|
COPY config_prod.json ./config.json
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# --- Production stage ---
|
# --- Production stage ---
|
||||||
@@ -14,4 +15,3 @@ COPY --from=build /app .
|
|||||||
ENV HOST=0.0.0.0
|
ENV HOST=0.0.0.0
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
CMD ["sh", "-c", "ORIGIN=https://tatort.innovation-hub-niedersachsen.de node build/index.js"]
|
CMD ["sh", "-c", "ORIGIN=https://tatort.innovation-hub-niedersachsen.de node build/index.js"]
|
||||||
|
|
||||||
80
Jenkinsfile
vendored
80
Jenkinsfile
vendored
@@ -1,3 +1,8 @@
|
|||||||
|
/* groovylint-disable-next-line UnusedVariable */
|
||||||
|
@Library('InnoHub-Library') _
|
||||||
|
|
||||||
|
Boolean didRun = false
|
||||||
|
|
||||||
pipeline {
|
pipeline {
|
||||||
agent any
|
agent any
|
||||||
|
|
||||||
@@ -7,9 +12,13 @@ pipeline {
|
|||||||
|
|
||||||
environment {
|
environment {
|
||||||
REGISTRY = 'https://gitea.innovation-hub-niedersachsen.de/'
|
REGISTRY = 'https://gitea.innovation-hub-niedersachsen.de/'
|
||||||
IMAGE = 'tatort-app'
|
USER = 'jenkins'
|
||||||
USER = 'jared'
|
TOKEN = credentials('JenkinsGitea')
|
||||||
TOKEN = credentials('c661e484bb4f032f8a0a5b02cda6f3344ca584b5')
|
}
|
||||||
|
|
||||||
|
parameters {
|
||||||
|
string(name: 'REPO_NAME', defaultValue: '', description: 'Repo Name')
|
||||||
|
string(name: 'GIT_REF', defaultValue: '', description: 'Git Ref')
|
||||||
}
|
}
|
||||||
|
|
||||||
options {
|
options {
|
||||||
@@ -22,46 +31,73 @@ pipeline {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
|
stage('Validate Repository') {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
checkRepoName(params.REPO_NAME, true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
stage('Install Dependencies') {
|
stage('Install Dependencies') {
|
||||||
steps {
|
steps {
|
||||||
|
script {
|
||||||
|
didRun = true
|
||||||
|
}
|
||||||
sh 'npm ci'
|
sh 'npm ci'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Test & Security Audit') {
|
stage('Test & Security Audit') {
|
||||||
steps {
|
steps {
|
||||||
|
script {
|
||||||
|
didRun = true
|
||||||
|
}
|
||||||
echo 'Start checking security vulnerabilities in npm packages'
|
echo 'Start checking security vulnerabilities in npm packages'
|
||||||
sh 'npm audit'
|
sh 'npm audit --audit-level=moderate'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// stage('Build') {
|
stage('SonarQube Analysis') {
|
||||||
// when {
|
steps {
|
||||||
// branch 'development'
|
withSonarQubeEnv('sonarqube') {
|
||||||
// }
|
sh 'sonar-scanner -Dsonar.projectKey=tatort -Dsonar.sources=src'
|
||||||
// steps {
|
}
|
||||||
// sh 'npm run build'
|
}
|
||||||
// }
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
// stage('Push image in gitea registry') {
|
stage('Push image to gitea registry') {
|
||||||
// steps {
|
when {
|
||||||
// echo 'Start Pushing'
|
branch 'development'
|
||||||
// script {
|
}
|
||||||
// docker.withRegistry('https://gitea.innovation-hub-niedersachsen.de', 'JenkinsGitea') {
|
steps {
|
||||||
// docker.build('innohub/tatort-app').push('latest')
|
script {
|
||||||
// }
|
didRun = true
|
||||||
// }
|
def tag = "innohub/tatort-dev:0.${env.BUILD_ID}"
|
||||||
// }
|
docker.withRegistry('https://gitea.innovation-hub-niedersachsen.de', 'JenkinsGitea') {
|
||||||
// }
|
docker.build(tag, '-f Dockerfile.dev .').push('latest')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
post {
|
post {
|
||||||
success {
|
success {
|
||||||
|
script {
|
||||||
|
if (didRun) {
|
||||||
echo 'Pipeline erfolgreich!'
|
echo 'Pipeline erfolgreich!'
|
||||||
|
discordSend description: "Running ${env.BUILD_ID} on ${env.JENKINS_URL}, ${params.GIT_REF}", footer: 'Pipeline succeeded', link: env.BUILD_URL, result: currentBuild.currentResult, title: env.JOB_NAME, webhookURL: 'https://discordapp.com/api/webhooks/1389470542691831819/NdMO17sLBG2dplp_-oh6Ff0cbPOoADl0QwXKM9UzduxU44av_ZQkQjKTmpdK7YuwcZDc'
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
failure {
|
failure {
|
||||||
|
script {
|
||||||
|
if (didRun) {
|
||||||
echo 'Pipeline fehlgeschlagen!'
|
echo 'Pipeline fehlgeschlagen!'
|
||||||
|
discordSend description: "Running ${env.BUILD_ID} on ${env.JENKINS_URL}, ${params.GIT_REF}", footer: 'Pipeline failed', link: env.BUILD_URL, result: currentBuild.currentResult, title: env.JOB_NAME, webhookURL: 'https://discordapp.com/api/webhooks/1389470542691831819/NdMO17sLBG2dplp_-oh6Ff0cbPOoADl0QwXKM9UzduxU44av_ZQkQjKTmpdK7YuwcZDc'
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
17
config_dev.json
Normal file
17
config_dev.json
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"minio": {
|
||||||
|
"endPoint": "sws3.innovation-hub-niedersachsen.de",
|
||||||
|
"port": 443,
|
||||||
|
"useSSL": true,
|
||||||
|
"accessKey": "wjpKrmaqXra99rX3D61H",
|
||||||
|
"secretKey": "fTPi0u0FR6Lv9Y9IKydWv6WM0EA5XrsK008HCt9u"
|
||||||
|
},
|
||||||
|
"jwt": {
|
||||||
|
"secret": "@S2!q@@wXz$dCQ8JoVsHLpzaJ6JCfB",
|
||||||
|
"expiresIn": 3600
|
||||||
|
},
|
||||||
|
"auth": {
|
||||||
|
"admin": { "password": "A-InnoHUB_2025!", "admin": true },
|
||||||
|
"user": { "password": "U-InnoHUB_2025!", "admin": false }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
},
|
},
|
||||||
"jwt": {
|
"jwt": {
|
||||||
"secret": "@S2!q@@wXz$dCQ8JoVsHLpzaJ6JCfB",
|
"secret": "@S2!q@@wXz$dCQ8JoVsHLpzaJ6JCfB",
|
||||||
"expiresIn": 36000
|
"expiresIn": 3600
|
||||||
},
|
},
|
||||||
"auth": {
|
"auth": {
|
||||||
"admin": { "password": "A-InnoHUB_2025!", "admin": true },
|
"admin": { "password": "A-InnoHUB_2025!", "admin": true },
|
||||||
@@ -44,9 +44,12 @@
|
|||||||
"@sveltejs/adapter-node": "^5.2.12",
|
"@sveltejs/adapter-node": "^5.2.12",
|
||||||
"@tailwindcss/forms": "^0.5.10",
|
"@tailwindcss/forms": "^0.5.10",
|
||||||
"autoprefixer": "^10.4.21",
|
"autoprefixer": "^10.4.21",
|
||||||
|
"crypto": "^1.0.1",
|
||||||
"jsonwebtoken": "^9.0.2",
|
"jsonwebtoken": "^9.0.2",
|
||||||
|
"jssha": "^3.3.1",
|
||||||
"minio": "^8.0.5",
|
"minio": "^8.0.5",
|
||||||
"postcss": "^8.5.4",
|
"postcss": "^8.5.4",
|
||||||
|
"sqlite3": "^5.1.7",
|
||||||
"tailwindcss": "^3.4.17"
|
"tailwindcss": "^3.4.17"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
42
src/init/init_db.js
Normal file
42
src/init/init_db.js
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
import sqlite3 from 'sqlite3';
|
||||||
|
import jsSHA from 'jssha';
|
||||||
|
|
||||||
|
const db = new sqlite3.Database('./src/lib/data/tatort.db');
|
||||||
|
|
||||||
|
db.serialize(() => {
|
||||||
|
// users table
|
||||||
|
|
||||||
|
let create_stmt = `CREATE TABLE IF NOT EXISTS users
|
||||||
|
(id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
name TEXT NOT NULL,
|
||||||
|
pw TEXT NOT NULL)`;
|
||||||
|
db.run(create_stmt);
|
||||||
|
|
||||||
|
// check if there are any users; if not add one default admin one
|
||||||
|
let pw = 'pass-123';
|
||||||
|
let hashed_pw = new jsSHA('SHA-512', 'TEXT').update(pw).getHash('HEX');
|
||||||
|
|
||||||
|
let check_ins_stmt = `INSERT INTO users (name, pw) SELECT 'admin', '${hashed_pw}'
|
||||||
|
WHERE NOT EXISTS (SELECT * FROM users);`;
|
||||||
|
|
||||||
|
db.run(check_ins_stmt);
|
||||||
|
|
||||||
|
let users_stmt = `SELECT * FROM USERS`;
|
||||||
|
db.each(users_stmt, (err, row) => {
|
||||||
|
console.log(`xxx ${row.name} + ${row.pw}`)
|
||||||
|
});
|
||||||
|
|
||||||
|
// cases table
|
||||||
|
|
||||||
|
create_stmt = `CREATE TABLE IF NOT EXISTS cases
|
||||||
|
(id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
token TEXT NOT NULL UNIQUE,
|
||||||
|
name TEXT NOT NULL,
|
||||||
|
pw TEXT NOT NULL,
|
||||||
|
created_by INTEGER NOT NULL,
|
||||||
|
FOREIGN KEY(created_by) REFERENCES users(id))`;
|
||||||
|
|
||||||
|
db.run(create_stmt);
|
||||||
|
});
|
||||||
|
|
||||||
|
db.close();
|
||||||
BIN
src/lib/data/tatort.db
Normal file
BIN
src/lib/data/tatort.db
Normal file
Binary file not shown.
@@ -208,7 +208,7 @@
|
|||||||
url.pathname += `/${filename}`;
|
url.pathname += `/${filename}`;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`api/${url}`, { method: 'DELETE' });
|
const response = await fetch(`/api${url.pathname}`, { method: 'DELETE' });
|
||||||
if (response.status == 204) {
|
if (response.status == 204) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
|
|||||||
Reference in New Issue
Block a user