mirror of
https://github.com/donpat1to/Schichtenplaner.git
synced 2025-12-01 06:55:45 +01:00
Compare commits
14 Commits
dabd2dff3b
...
v0.8.0
| Author | SHA1 | Date | |
|---|---|---|---|
| 478578308d | |||
| 93a52aa196 | |||
|
|
b11c55c1d9 | ||
| 16302f2105 | |||
| 57aff5c858 | |||
| b4abe459c2 | |||
| 06bc27a6ce | |||
| 0aad8f0a56 | |||
| b52e9d57c7 | |||
| 15f3183bc0 | |||
| ca3a5d1c0e | |||
| 6a1509d807 | |||
|
|
308ae74e37 | ||
| e876f5eb02 |
29
.github/workflows/docker.yml
vendored
29
.github/workflows/docker.yml
vendored
@@ -21,15 +21,15 @@ jobs:
|
|||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0 # Fetch all history for tags
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Check if main branch
|
- name: Check if main branch
|
||||||
id: branch_check
|
id: branch_check
|
||||||
run: |
|
run: |
|
||||||
if [[ "${GITHUB_REF}" == "refs/heads/main" || "${GITHUB_REF}" == "refs/heads/master" ]]; then
|
if [[ "${{ github.ref }}" == "refs/heads/main" || "${{ github.ref }}" == "refs/heads/master" ]]; then
|
||||||
echo "is_main_branch=true" >> $GITHUB_OUTPUT
|
echo "is_main=true" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
echo "is_main_branch=false" >> $GITHUB_OUTPUT
|
echo "is_main=false" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Determine next semantic version tag
|
- name: Determine next semantic version tag
|
||||||
@@ -39,24 +39,31 @@ jobs:
|
|||||||
|
|
||||||
# Find latest tag matching vX.Y.Z
|
# Find latest tag matching vX.Y.Z
|
||||||
latest_tag=$(git tag --list 'v*.*.*' --sort=-v:refname | head -n 1)
|
latest_tag=$(git tag --list 'v*.*.*' --sort=-v:refname | head -n 1)
|
||||||
|
echo "Latest tag found: $latest_tag"
|
||||||
|
|
||||||
if [[ -z "$latest_tag" ]]; then
|
if [[ -z "$latest_tag" ]]; then
|
||||||
major=0
|
major=0
|
||||||
minor=0
|
minor=0
|
||||||
patch=0
|
patch=0
|
||||||
|
echo "No existing tags found, starting from v0.0.0"
|
||||||
else
|
else
|
||||||
version="${latest_tag#v}"
|
version="${latest_tag#v}"
|
||||||
IFS='.' read -r major minor patch <<< "$version"
|
IFS='.' read -r major minor patch <<< "$version"
|
||||||
|
echo "Parsed version: major=$major, minor=$minor, patch=$patch"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${GITHUB_REF}" == "refs/heads/main" || "${GITHUB_REF}" == "refs/heads/master" ]]; then
|
if [[ "${{ github.ref }}" == "refs/heads/main" || "${{ github.ref }}" == "refs/heads/master" ]]; then
|
||||||
major=$((major + 1))
|
major=$((major + 1))
|
||||||
minor=0
|
minor=0
|
||||||
patch=0
|
patch=0
|
||||||
elif [[ "${GITHUB_REF}" == "refs/heads/development" ]]; then
|
echo "Main branch - major version bump"
|
||||||
|
elif [[ "${{ github.ref }}" == "refs/heads/development" ]]; then
|
||||||
minor=$((minor + 1))
|
minor=$((minor + 1))
|
||||||
patch=0
|
patch=0
|
||||||
|
echo "Development branch - minor version bump"
|
||||||
else
|
else
|
||||||
patch=$((patch + 1))
|
patch=$((patch + 1))
|
||||||
|
echo "Other branch - patch version bump"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
new_tag="v${major}.${minor}.${patch}"
|
new_tag="v${major}.${minor}.${patch}"
|
||||||
@@ -87,7 +94,6 @@ jobs:
|
|||||||
- name: Run backend tests
|
- name: Run backend tests
|
||||||
working-directory: ./backend
|
working-directory: ./backend
|
||||||
run: |
|
run: |
|
||||||
# Skip tests if jest is not installed
|
|
||||||
if [ -f "node_modules/.bin/jest" ]; then
|
if [ -f "node_modules/.bin/jest" ]; then
|
||||||
npm test
|
npm test
|
||||||
else
|
else
|
||||||
@@ -140,13 +146,8 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||||
tags: |
|
tags: |
|
||||||
type=ref,event=branch
|
type=raw,value=${{ needs.set-tag.outputs.tag_name }}
|
||||||
type=semver,pattern={{version}}
|
type=raw,value=latest,enable=${{ fromJSON(needs.set-tag.outputs.is_main_branch) }}
|
||||||
type=sha
|
|
||||||
# Add the dynamically generated semantic version
|
|
||||||
${{ needs.set-tag.outputs.tag_name }}
|
|
||||||
# Add latest tag for main branch
|
|
||||||
${{ needs.set-tag.outputs.is_main_branch == 'true' && 'latest' }}
|
|
||||||
|
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
|
|||||||
16
Dockerfile
16
Dockerfile
@@ -16,7 +16,7 @@ COPY tsconfig.base.json ./
|
|||||||
COPY ecosystem.config.cjs ./
|
COPY ecosystem.config.cjs ./
|
||||||
|
|
||||||
# Install root dependencies
|
# Install root dependencies
|
||||||
RUN npm install
|
RUN npm install --only=production
|
||||||
|
|
||||||
# Copy workspace files
|
# Copy workspace files
|
||||||
COPY backend/ ./backend/
|
COPY backend/ ./backend/
|
||||||
@@ -27,34 +27,44 @@ RUN npm install --workspace=backend
|
|||||||
RUN npm install --workspace=frontend
|
RUN npm install --workspace=frontend
|
||||||
|
|
||||||
# Build backend first
|
# Build backend first
|
||||||
RUN npm run build --workspace=backend
|
RUN npm run build --only=production --workspace=backend
|
||||||
|
|
||||||
# Build frontend
|
# Build frontend
|
||||||
RUN npm run build --workspace=frontend
|
RUN npm run build --only=production --workspace=frontend
|
||||||
|
|
||||||
# Verify Python and OR-Tools installation
|
# Verify Python and OR-Tools installation
|
||||||
RUN python -c "from ortools.sat.python import cp_model; print('OR-Tools installed successfully')"
|
RUN python -c "from ortools.sat.python import cp_model; print('OR-Tools installed successfully')"
|
||||||
|
|
||||||
# Production stage (same as above)
|
# Production stage (same as above)
|
||||||
FROM node:20-bookworm
|
FROM node:20-bookworm
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
RUN npm install -g pm2
|
RUN npm install -g pm2
|
||||||
RUN mkdir -p /app/data
|
RUN mkdir -p /app/data
|
||||||
|
|
||||||
COPY --from=builder /app/backend/dist/ ./dist/
|
COPY --from=builder /app/backend/dist/ ./dist/
|
||||||
COPY --from=builder /app/backend/package*.json ./
|
COPY --from=builder /app/backend/package*.json ./
|
||||||
|
|
||||||
COPY --from=builder /app/node_modules/ ./node_modules/
|
COPY --from=builder /app/node_modules/ ./node_modules/
|
||||||
COPY --from=builder /app/frontend/dist/ ./frontend-build/
|
COPY --from=builder /app/frontend/dist/ ./frontend-build/
|
||||||
|
|
||||||
COPY --from=builder /app/ecosystem.config.cjs ./
|
COPY --from=builder /app/ecosystem.config.cjs ./
|
||||||
|
|
||||||
COPY --from=builder /app/backend/src/database/ ./dist/database/
|
COPY --from=builder /app/backend/src/database/ ./dist/database/
|
||||||
COPY --from=builder /app/backend/src/database/ ./database/
|
COPY --from=builder /app/backend/src/database/ ./database/
|
||||||
|
|
||||||
RUN groupadd -g 1001 nodejs && \
|
RUN groupadd -g 1001 nodejs && \
|
||||||
useradd -m -u 1001 -s /bin/bash -g nodejs schichtplan && \
|
useradd -m -u 1001 -s /bin/bash -g nodejs schichtplan && \
|
||||||
chown -R schichtplan:nodejs /app && \
|
chown -R schichtplan:nodejs /app && \
|
||||||
chmod 755 /app && \
|
chmod 755 /app && \
|
||||||
chmod 775 /app/data
|
chmod 775 /app/data
|
||||||
|
|
||||||
ENV PM2_HOME=/app/.pm2
|
ENV PM2_HOME=/app/.pm2
|
||||||
USER schichtplan
|
USER schichtplan
|
||||||
EXPOSE 3002
|
EXPOSE 3002
|
||||||
|
|
||||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
|
||||||
CMD wget --no-verbose --tries=1 --spider http://localhost:3002/api/health || exit 1
|
CMD wget --no-verbose --tries=1 --spider http://localhost:3002/api/health || exit 1
|
||||||
|
|
||||||
CMD ["pm2-runtime", "ecosystem.config.cjs"]
|
CMD ["pm2-runtime", "ecosystem.config.cjs"]
|
||||||
@@ -15,7 +15,7 @@ This software, "Schichtenplaner", is offered under a dual licensing model.
|
|||||||
- Integration into commercial software or distributions
|
- Integration into commercial software or distributions
|
||||||
|
|
||||||
To obtain a commercial license, please contact:
|
To obtain a commercial license, please contact:
|
||||||
📧 patrick@mahnke-hartmann.dev
|
📧 dev.patrick@mahnke-hartmann.de
|
||||||
or open an inquiry via GitHub: https://github.com/donpat1to/Schichtenplaner
|
or open an inquiry via GitHub: https://github.com/donpat1to/Schichtenplaner
|
||||||
|
|
||||||
Without a valid commercial license, all commercial rights are reserved.
|
Without a valid commercial license, all commercial rights are reserved.
|
||||||
|
|||||||
@@ -39,26 +39,55 @@ app.get('/api/health', (req: any, res: any) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// 🆕 STATIC FILE SERVING FÜR FRONTEND
|
// 🆕 FIXED STATIC FILE SERVING
|
||||||
const frontendBuildPath = process.env.FRONTEND_BUILD_PATH || '../frontend-build';
|
// Use absolute path that matches Docker container structure
|
||||||
|
const frontendBuildPathEnv = process.env.FRONTEND_BUILD_PATH;
|
||||||
|
console.log('📁 Frontend build path from the env', frontendBuildPathEnv);
|
||||||
|
const frontendBuildPath = path.resolve('/app/frontend-build');
|
||||||
console.log('📁 Frontend build path:', frontendBuildPath);
|
console.log('📁 Frontend build path:', frontendBuildPath);
|
||||||
|
console.log('📁 Current __dirname:', __dirname);
|
||||||
|
|
||||||
// Überprüfe ob das Verzeichnis existiert
|
// Check multiple possible locations for frontend build
|
||||||
if (fs.existsSync(frontendBuildPath)) {
|
const possiblePaths = [
|
||||||
console.log('✅ Frontend build directory exists');
|
'/app/frontend-build', // Docker production path
|
||||||
const files = fs.readdirSync(frontendBuildPath);
|
path.join(__dirname, '../../frontend-build'), // Relative from dist
|
||||||
console.log('📄 Files in frontend-build:', files);
|
path.join(process.cwd(), 'frontend-build'), // From current working directory
|
||||||
|
];
|
||||||
|
|
||||||
|
let actualFrontendPath = null;
|
||||||
|
for (const testPath of possiblePaths) {
|
||||||
|
if (fs.existsSync(testPath)) {
|
||||||
|
actualFrontendPath = testPath;
|
||||||
|
console.log('✅ Found frontend build at:', testPath);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (actualFrontendPath) {
|
||||||
// Serviere statische Dateien
|
// Serviere statische Dateien
|
||||||
app.use(express.static(frontendBuildPath));
|
app.use(express.static(actualFrontendPath));
|
||||||
|
|
||||||
|
// List files for debugging
|
||||||
|
try {
|
||||||
|
const files = fs.readdirSync(actualFrontendPath);
|
||||||
|
console.log('📄 Files in frontend-build:', files);
|
||||||
|
} catch (err) {
|
||||||
|
console.log('❌ Could not read frontend-build directory:', err);
|
||||||
|
}
|
||||||
|
|
||||||
console.log('✅ Static file serving configured');
|
console.log('✅ Static file serving configured');
|
||||||
} else {
|
} else {
|
||||||
console.log('❌ Frontend build directory NOT FOUND:', frontendBuildPath);
|
console.log('❌ Frontend build directory NOT FOUND in any location');
|
||||||
|
console.log('❌ Checked paths:', possiblePaths);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Root route
|
||||||
app.get('/', (req, res) => {
|
app.get('/', (req, res) => {
|
||||||
const indexPath = path.join(frontendBuildPath, 'index.html');
|
if (!actualFrontendPath) {
|
||||||
|
return res.status(500).send('Frontend build not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
const indexPath = path.join(actualFrontendPath, 'index.html');
|
||||||
console.log('📄 Serving index.html from:', indexPath);
|
console.log('📄 Serving index.html from:', indexPath);
|
||||||
|
|
||||||
if (fs.existsSync(indexPath)) {
|
if (fs.existsSync(indexPath)) {
|
||||||
@@ -69,19 +98,30 @@ app.get('/', (req, res) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Client-side routing fallback
|
||||||
app.get('*', (req, res) => {
|
app.get('*', (req, res) => {
|
||||||
// Ignoriere API Routes
|
// Ignoriere API Routes
|
||||||
if (req.path.startsWith('/api/')) {
|
if (req.path.startsWith('/api/')) {
|
||||||
return res.status(404).json({ error: 'API endpoint not found' });
|
return res.status(404).json({ error: 'API endpoint not found' });
|
||||||
}
|
}
|
||||||
|
|
||||||
const indexPath = path.join(frontendBuildPath, 'index.html');
|
if (!actualFrontendPath) {
|
||||||
console.log('🔄 Client-side routing for:', req.path, '-> index.html');
|
return res.status(500).json({ error: 'Frontend application not available' });
|
||||||
|
}
|
||||||
|
|
||||||
|
const indexPath = path.join(actualFrontendPath, 'index.html');
|
||||||
|
console.log('🔄 Client-side routing for:', req.path, '->', indexPath);
|
||||||
|
|
||||||
if (fs.existsSync(indexPath)) {
|
if (fs.existsSync(indexPath)) {
|
||||||
res.sendFile(indexPath);
|
// Use absolute path with res.sendFile
|
||||||
|
res.sendFile(indexPath, (err) => {
|
||||||
|
if (err) {
|
||||||
|
console.error('Error sending index.html:', err);
|
||||||
|
res.status(500).send('Error loading application');
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
console.error('❌ index.html not found for client-side routing');
|
console.error('❌ index.html not found for client-side routing at:', indexPath);
|
||||||
res.status(404).json({ error: 'Frontend application not found' });
|
res.status(404).json({ error: 'Frontend application not found' });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,26 +1,14 @@
|
|||||||
version: '3.8'
|
version: '3.8'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
schichtplan:
|
schichtplaner:
|
||||||
build:
|
container_name: schichtplaner
|
||||||
context: .
|
image: ghcr.io/donpat1to/schichtenplaner:v1.0.0
|
||||||
dockerfile: backend/Dockerfile
|
|
||||||
ports:
|
ports:
|
||||||
- "3001:3001"
|
- "3002:3002"
|
||||||
- "3000:3000"
|
|
||||||
environment:
|
|
||||||
- NODE_ENV=production
|
|
||||||
- DATABASE_URL=file:./prod.db
|
|
||||||
- JWT_SECRET=your-production-secret-key-change-this
|
|
||||||
- PYTHON_PATH=/usr/bin/python3
|
|
||||||
volumes:
|
volumes:
|
||||||
- app_data:/app/data
|
- app_data:/app/data
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "curl", "-f", "http://localhost:3001/health"]
|
|
||||||
interval: 30s
|
|
||||||
timeout: 10s
|
|
||||||
retries: 3
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
app_data:
|
app_data:
|
||||||
@@ -15,7 +15,8 @@
|
|||||||
"@types/react-router-dom": "^5.3.3",
|
"@types/react-router-dom": "^5.3.3",
|
||||||
"@vitejs/plugin-react": "^4.3.3",
|
"@vitejs/plugin-react": "^4.3.3",
|
||||||
"typescript": "^5.7.3",
|
"typescript": "^5.7.3",
|
||||||
"vite": "^6.0.7"
|
"vite": "^6.0.7",
|
||||||
|
"esbuild": "^0.21.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@@ -10,12 +10,12 @@ const Footer: React.FC = () => {
|
|||||||
borderTop: '1px solid rgba(251, 250, 246, 0.1)',
|
borderTop: '1px solid rgba(251, 250, 246, 0.1)',
|
||||||
},
|
},
|
||||||
footerContent: {
|
footerContent: {
|
||||||
maxWidth: '1200px',
|
maxWidth: '1500px',
|
||||||
margin: '0 auto',
|
margin: '0 auto',
|
||||||
padding: '3rem 2rem 2rem',
|
padding: '3rem 2rem 2rem',
|
||||||
display: 'grid',
|
display: 'grid',
|
||||||
gridTemplateColumns: 'repeat(auto-fit, minmax(250px, 1fr))',
|
gridTemplateColumns: 'repeat(auto-fit, minmax(100px, 1fr))',
|
||||||
gap: '3rem',
|
gap: '1rem',
|
||||||
},
|
},
|
||||||
footerSection: {
|
footerSection: {
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ const FAQ: React.FC = () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
question: "Wie lange dauert die Planungserstellung?",
|
question: "Wie lange dauert die Planungserstellung?",
|
||||||
answer: "Typischerweise 30-105 Sekunden, abhängig von der Anzahl der Mitarbeiter und Schichten."
|
answer: "Typischerweise maximal 105 Sekunden, abhängig von der Anzahl der Mitarbeiter und Schichten."
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ const Features: React.FC = () => {
|
|||||||
{
|
{
|
||||||
icon: "⚡",
|
icon: "⚡",
|
||||||
title: "Schnelle Berechnung",
|
title: "Schnelle Berechnung",
|
||||||
description: "Google OR-Tools CP-SAT Solver findet Lösungen in 30-105 Sekunden"
|
description: "Google OR-Tools CP-SAT Solver findet Lösungen in maximal 105 Sekunden"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: "👥",
|
icon: "👥",
|
||||||
|
|||||||
@@ -151,7 +151,7 @@
|
|||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
padding: 2rem 20px;
|
padding: 2rem 20px;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
|
||||||
gap: 2rem;
|
gap: 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ const Login: React.FC = () => {
|
|||||||
onChange={(e) => setEmail(e.target.value)}
|
onChange={(e) => setEmail(e.target.value)}
|
||||||
required
|
required
|
||||||
style={{
|
style={{
|
||||||
width: '94.5%',
|
width: '100%',
|
||||||
padding: '10px',
|
padding: '10px',
|
||||||
border: '1px solid #ddd',
|
border: '1px solid #ddd',
|
||||||
borderRadius: '4px',
|
borderRadius: '4px',
|
||||||
@@ -151,7 +151,7 @@ const Login: React.FC = () => {
|
|||||||
onChange={(e) => setPassword(e.target.value)}
|
onChange={(e) => setPassword(e.target.value)}
|
||||||
required
|
required
|
||||||
style={{
|
style={{
|
||||||
width: '94.5%',
|
width: '100%',
|
||||||
padding: '10px',
|
padding: '10px',
|
||||||
paddingRight: '10px',
|
paddingRight: '10px',
|
||||||
border: '1px solid #ddd',
|
border: '1px solid #ddd',
|
||||||
|
|||||||
1077
package-lock.json
generated
1077
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
2
premium
2
premium
Submodule premium updated: ce4b3fd6e0...c65016aaab
Reference in New Issue
Block a user