Compare commits
1 Commits
920042acac
...
agent/dex/
| Author | SHA1 | Date | |
|---|---|---|---|
| f5313b3362 |
7
.gitignore
vendored
7
.gitignore
vendored
@@ -2,9 +2,4 @@ bin/
|
|||||||
obj/
|
obj/
|
||||||
*.user
|
*.user
|
||||||
*.suo
|
*.suo
|
||||||
.vs/
|
.vs/
|
||||||
|
|
||||||
# Frontend build artifacts
|
|
||||||
frontend/dist/
|
|
||||||
frontend/node_modules/
|
|
||||||
frontend/.angular/
|
|
||||||
@@ -27,8 +27,4 @@ COPY --from=build /app/publish .
|
|||||||
# ASP.NET Core listens on 8080 by default in .NET 8+
|
# ASP.NET Core listens on 8080 by default in .NET 8+
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
# Health check against /health endpoint
|
|
||||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
|
||||||
CMD curl --fail http://localhost:8080/health || exit 1
|
|
||||||
|
|
||||||
ENTRYPOINT ["dotnet", "Extrudex.dll"]
|
ENTRYPOINT ["dotnet", "Extrudex.dll"]
|
||||||
@@ -9,7 +9,6 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AspNetCore.HealthChecks.NpgSql" Version="9.0.0" />
|
|
||||||
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="12.1.1" />
|
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="12.1.1" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.3" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.3" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.3" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.3" />
|
||||||
|
|||||||
@@ -69,10 +69,6 @@ builder.Services.AddCors(options =>
|
|||||||
// ── SignalR (real-time printer updates) ────────────────────
|
// ── SignalR (real-time printer updates) ────────────────────
|
||||||
builder.Services.AddSignalR();
|
builder.Services.AddSignalR();
|
||||||
|
|
||||||
// ── Health Checks ───────────────────────────────────────────
|
|
||||||
builder.Services.AddHealthChecks()
|
|
||||||
.AddNpgSql(connectionString);
|
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
// ── Middleware ──────────────────────────────────────────────
|
// ── Middleware ──────────────────────────────────────────────
|
||||||
@@ -89,9 +85,6 @@ app.MapControllers();
|
|||||||
// ── Hub Endpoints ───────────────────────────────────────────
|
// ── Hub Endpoints ───────────────────────────────────────────
|
||||||
app.MapHub<PrinterHub>("/hubs/printer");
|
app.MapHub<PrinterHub>("/hubs/printer");
|
||||||
|
|
||||||
// ── Health Check Endpoint ──────────────────────────────────
|
|
||||||
app.MapHealthChecks("/health");
|
|
||||||
|
|
||||||
app.Run();
|
app.Run();
|
||||||
|
|
||||||
// Helper: builds a connection string from individual env vars.
|
// Helper: builds a connection string from individual env vars.
|
||||||
|
|||||||
33
deploy.sh
33
deploy.sh
@@ -1,33 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
echo "🔧 Deploying Extrudex Docker runtime..."
|
|
||||||
|
|
||||||
# Check if Docker Compose is available
|
|
||||||
if ! command -v docker-compose &> /dev/null && ! docker compose version &> /dev/null; then
|
|
||||||
echo "❌ Docker Compose is not installed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
COMPOSE_CMD="docker compose"
|
|
||||||
if command -v docker-compose &> /dev/null; then
|
|
||||||
COMPOSE_CMD="docker-compose"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "📦 Building and starting services..."
|
|
||||||
$COMPOSE_CMD -f docker-compose.dev.yml up -d --build
|
|
||||||
|
|
||||||
echo "⏳ Waiting for services to become healthy..."
|
|
||||||
sleep 10
|
|
||||||
|
|
||||||
echo "✅ Deployment complete!"
|
|
||||||
echo ""
|
|
||||||
echo "Services running:"
|
|
||||||
echo " • Extrudex API: http://localhost:5080"
|
|
||||||
echo " • Control Center Web: http://localhost:5081"
|
|
||||||
echo ""
|
|
||||||
echo "To view logs:"
|
|
||||||
echo " $COMPOSE_CMD -f docker-compose.dev.yml logs -f"
|
|
||||||
echo ""
|
|
||||||
echo "To stop:"
|
|
||||||
echo " $COMPOSE_CMD -f docker-compose.dev.yml down"
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
version: '3.8'
|
|
||||||
|
|
||||||
services:
|
|
||||||
extrudex-api:
|
|
||||||
build:
|
|
||||||
context: ./backend
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
container_name: extrudex-api
|
|
||||||
ports:
|
|
||||||
- "5080:8080"
|
|
||||||
environment:
|
|
||||||
- ASPNETCORE_ENVIRONMENT=Development
|
|
||||||
- ASPNETCORE_URLS=http://+:8080
|
|
||||||
restart: unless-stopped
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
|
|
||||||
interval: 30s
|
|
||||||
timeout: 10s
|
|
||||||
retries: 3
|
|
||||||
start_period: 40s
|
|
||||||
networks:
|
|
||||||
- extrudex-network
|
|
||||||
|
|
||||||
control-center-web:
|
|
||||||
build:
|
|
||||||
context: ../Control-Center/frontend
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
container_name: control-center-web
|
|
||||||
ports:
|
|
||||||
- "5081:80"
|
|
||||||
depends_on:
|
|
||||||
extrudex-api:
|
|
||||||
condition: service_healthy
|
|
||||||
restart: unless-stopped
|
|
||||||
networks:
|
|
||||||
- extrudex-network
|
|
||||||
|
|
||||||
networks:
|
|
||||||
extrudex-network:
|
|
||||||
driver: bridge
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
node_modules
|
|
||||||
dist
|
|
||||||
.git
|
|
||||||
.gitignore
|
|
||||||
.angular
|
|
||||||
.vscode
|
|
||||||
*.md
|
|
||||||
.editorconfig
|
|
||||||
.prettierrc
|
|
||||||
src/test.ts
|
|
||||||
**/*.spec.ts
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
# Stage 1: Build the Angular application
|
|
||||||
FROM node:22-alpine AS build
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# Copy package files first for better layer caching
|
|
||||||
COPY package.json package-lock.json ./
|
|
||||||
RUN npm ci
|
|
||||||
|
|
||||||
# Copy source and build
|
|
||||||
COPY . .
|
|
||||||
RUN npx ng build --configuration production
|
|
||||||
|
|
||||||
# Stage 2: Serve static files with nginx
|
|
||||||
FROM nginx:alpine
|
|
||||||
|
|
||||||
# Remove default nginx config
|
|
||||||
RUN rm /etc/nginx/conf.d/default.conf
|
|
||||||
|
|
||||||
# Copy custom nginx config
|
|
||||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
||||||
|
|
||||||
# Copy built Angular artifacts from build stage
|
|
||||||
COPY --from=build /app/dist/frontend/browser /usr/share/nginx/html
|
|
||||||
|
|
||||||
EXPOSE 80
|
|
||||||
|
|
||||||
CMD ["nginx", "-g", "daemon off;"]
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
server {
|
|
||||||
listen 80;
|
|
||||||
server_name _;
|
|
||||||
root /usr/share/nginx/html;
|
|
||||||
index index.html;
|
|
||||||
|
|
||||||
# Gzip compression
|
|
||||||
gzip on;
|
|
||||||
gzip_types text/plain text/css application/json application/javascript text/xml application/xml text/javascript;
|
|
||||||
gzip_min_length 256;
|
|
||||||
|
|
||||||
# Angular SPA — fallback to index.html for client-side routing
|
|
||||||
location / {
|
|
||||||
try_files $uri $uri/ /index.html;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Cache static assets aggressively
|
|
||||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2?|ttf|eot)$ {
|
|
||||||
expires 1y;
|
|
||||||
add_header Cache-Control "public, immutable";
|
|
||||||
}
|
|
||||||
|
|
||||||
# Proxy API requests to backend
|
|
||||||
# Uses resolver so nginx doesn't crash if backend isn't available at startup
|
|
||||||
resolver 127.0.0.11 valid=30s ipv6=off;
|
|
||||||
set $backend "extrudex-api:8080";
|
|
||||||
|
|
||||||
location /api/ {
|
|
||||||
proxy_pass http://$backend;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Health check endpoint
|
|
||||||
location /health {
|
|
||||||
access_log off;
|
|
||||||
return 200 "ok";
|
|
||||||
add_header Content-Type text/plain;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user