diff --git a/apps/excalidraw/docker-compose.yml b/apps/excalidraw/docker-compose.yml index 9d8becb..bf9f9f8 100644 --- a/apps/excalidraw/docker-compose.yml +++ b/apps/excalidraw/docker-compose.yml @@ -9,10 +9,14 @@ services: - proxy-net labels: - "traefik.enable=true" - - "traefik.http.routers.excalidraw.rule=Host(`excalidraw.arch-services.mywire.org`) || Host(`excalidraw.localhost`)" - + - "traefik.http.routers.excalidraw.rule=Host(`excalidraw.arch-services.mywire.org`)" - "traefik.http.routers.excalidraw.entrypoints=websecure" - "traefik.http.routers.excalidraw.tls.certresolver=myresolver" + - "traefik.http.routers.excalidraw-red.rule=Host(`excalidraw.arch-services.mywire.org`)" + - "traefik.http.routers.excalidraw-red.entrypoints=web" + - "traefik.http.routers.excalidraw-red.middlewares=https-redirect@docker" + - "traefik.http.routers.excalidraw-local.rule=Host(`excalidraw.localhost`)" + - "traefik.http.routers.excalidraw-local.entrypoints=web" - "traefik.http.services.excalidraw.loadbalancer.server.port=80" excalidraw-room: @@ -22,10 +26,14 @@ services: - proxy-net labels: - "traefik.enable=true" - - "traefik.http.routers.excalidraw-room.rule=(Host(`excalidraw.arch-services.mywire.org`) || Host(`excalidraw.localhost`)) && PathPrefix(`/socket.io`)" - + - "traefik.http.routers.excalidraw-room.rule=Host(`excalidraw.arch-services.mywire.org`) && PathPrefix(`/socket.io`)" - "traefik.http.routers.excalidraw-room.entrypoints=websecure" - "traefik.http.routers.excalidraw-room.tls.certresolver=myresolver" + - "traefik.http.routers.excalidraw-room-red.rule=Host(`excalidraw.arch-services.mywire.org`) && PathPrefix(`/socket.io`)" + - "traefik.http.routers.excalidraw-room-red.entrypoints=web" + - "traefik.http.routers.excalidraw-room-red.middlewares=https-redirect@docker" + - "traefik.http.routers.excalidraw-room-local.rule=Host(`excalidraw.localhost`) && PathPrefix(`/socket.io`)" + - "traefik.http.routers.excalidraw-room-local.entrypoints=web" - "traefik.http.services.excalidraw-room.loadbalancer.server.port=8080" networks: diff --git a/apps/gitea/docker-compose.yml b/apps/gitea/docker-compose.yml index aa79a13..8105c1a 100644 --- a/apps/gitea/docker-compose.yml +++ b/apps/gitea/docker-compose.yml @@ -13,11 +13,15 @@ services: - proxy-net labels: - "traefik.enable=true" - - "traefik.http.routers.gitea.rule=Host(`gitea.arch-services.mywire.org`) || Host(`gitea.localhost`)" - + - "traefik.http.routers.gitea.rule=Host(`gitea.arch-services.mywire.org`)" - "traefik.http.routers.gitea.entrypoints=websecure" - "traefik.http.routers.gitea.tls.certresolver=myresolver" - "traefik.http.routers.gitea.middlewares=authelia-auth@docker" + - "traefik.http.routers.gitea-red.rule=Host(`gitea.arch-services.mywire.org`)" + - "traefik.http.routers.gitea-red.entrypoints=web" + - "traefik.http.routers.gitea-red.middlewares=https-redirect@docker" + - "traefik.http.routers.gitea-local.rule=Host(`gitea.localhost`)" + - "traefik.http.routers.gitea-local.entrypoints=web" - "traefik.http.services.gitea.loadbalancer.server.port=3000" networks: diff --git a/apps/homepage/config/custom.css b/apps/homepage/config/custom.css index e69de29..826bac0 100644 --- a/apps/homepage/config/custom.css +++ b/apps/homepage/config/custom.css @@ -0,0 +1,93 @@ +.hp-kanban-board { + display: flex; + gap: 20px; + margin: 10px 0 30px 0; + width: 100%; +} + +.hp-kanban-col { + flex: 1; + background: rgba(15, 23, 42, 0.4); + border: 1px solid rgba(51, 65, 85, 0.3); + border-radius: 12px; + padding: 15px; + min-height: 220px; + backdrop-filter: blur(4px); +} + +.hp-kanban-col h3 { + font-size: 0.7rem; + margin: 0 0 12px 0; + text-transform: uppercase; + color: #94a3b8; + text-align: center; + letter-spacing: 0.1em; + font-weight: 800; + opacity: 0.8; +} + +.hp-kanban-list { + display: flex; + flex-direction: column; + gap: 10px; + min-height: 150px; +} + +.hp-kanban-card { + background: rgba(30, 41, 59, 0.8); + border: 1px solid rgba(51, 65, 85, 0.5); + border-radius: 8px; + padding: 12px; + cursor: grab; + transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); +} + +.hp-kanban-card:hover { + border-color: #3b82f6; + transform: translateY(-2px); + background: #1e293b; + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); +} + +.hp-kanban-card-title { + font-size: 0.85rem; + font-weight: 700; + margin-bottom: 4px; + color: #f8fafc; +} + +.hp-kanban-card-desc { + font-size: 0.75rem; + color: #94a3b8; + margin-bottom: 10px; + line-height: 1.3; +} + +.hp-kanban-card-links { + display: flex; + gap: 12px; + border-top: 1px solid rgba(51, 65, 85, 0.3); + padding-top: 8px; + font-size: 0.7rem; +} + +.hp-kanban-card-links a { + color: #60a5fa; + text-decoration: none; + font-weight: 600; +} + +.hp-kanban-card-links a:hover { + text-decoration: underline; +} + +.hp-kanban-card.dragging { + opacity: 0.1; + transform: scale(0.9); +} + +/* Hide the placeholder card that we use to spawn the section */ +section h2[title="Learning Hub"] + ul, +section h2[title="Learning Hub"] + .grid { + display: none !important; +} diff --git a/apps/homepage/config/custom.js b/apps/homepage/config/custom.js index e69de29..96094cf 100644 --- a/apps/homepage/config/custom.js +++ b/apps/homepage/config/custom.js @@ -0,0 +1,141 @@ +/** + * Learning Kanban Native Integration for Homepage + */ + +function getApiBase() { + const host = window.location.hostname; + if (host === 'localhost' || host.endsWith('.localhost')) { + return `http://learning.localhost`; + } + return `https://learning.arch-services.mywire.org`; +} + +const API_BASE = getApiBase(); + +async function fetchCourses() { + try { + const response = await fetch(`${API_BASE}/api/courses`); + if (!response.ok) return []; + return await response.json(); + } catch (e) { + console.error("Failed to fetch courses", e); + return []; + } +} + +async function updateCourseStatus(courseId, newStatus) { + try { + const res = await fetch(`${API_BASE}/api/courses`); + const courses = await res.json(); + const course = courses.find(c => c.id == courseId); + if (!course) return; + + course.status = newStatus; + + await fetch(`${API_BASE}/api/courses/${courseId}`, { + method: 'PUT', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify(course) + }); + } catch (e) { + console.error("Failed to update course", e); + } +} + +function createKanbanCard(course) { + return ` +
+
${course.title}
+
${course.description || ''}
+ +
+ `; +} + +async function renderKanban() { + // Find the section by its title + const sections = document.querySelectorAll('section'); + let container = null; + for (const section of sections) { + const h2 = section.querySelector('h2'); + // Match the group name from services.yaml + if (h2 && h2.textContent.trim() === 'Learning Hub') { + container = section; + break; + } + } + + if (!container) return; + + // Target the list area (usually follows the h2) + const listArea = container.querySelector('ul') || container.querySelector('.grid') || container.lastElementChild; + if (!listArea) return; + + // Replace the entire list area with our board + listArea.outerHTML = ` +
+
+

🚀 In Progress

+
+
+
+

📅 Planning

+
+
+
+

📦 Archive

+
+
+
+ `; + + const courses = await fetchCourses(); + const board = container.querySelector('.hp-kanban-board'); + + courses.forEach(course => { + const col = board.querySelector(`.hp-kanban-col[data-status="${course.status}"] .hp-kanban-list`); + if (col) { + col.innerHTML += createKanbanCard(course); + } + }); + + // Add Drag & Drop Listeners + const cards = board.querySelectorAll('.hp-kanban-card'); + cards.forEach(card => { + card.addEventListener('dragstart', (e) => { + e.dataTransfer.setData('text/plain', card.dataset.id); + card.classList.add('dragging'); + }); + card.addEventListener('dragend', () => card.classList.remove('dragging')); + }); + + const cols = board.querySelectorAll('.hp-kanban-col'); + cols.forEach(col => { + col.addEventListener('dragover', (e) => e.preventDefault()); + col.addEventListener('drop', async (e) => { + e.preventDefault(); + const id = e.dataTransfer.getData('text/plain'); + const status = col.dataset.status; + await updateCourseStatus(id, status); + renderKanban(); // Re-render + }); + }); +} + +// Initial detection and observer for React re-renders +let debounceTimer; +const observer = new MutationObserver(() => { + clearTimeout(debounceTimer); + debounceTimer = setTimeout(() => { + const target = document.querySelector('h2'); + if (target && !document.querySelector('.hp-kanban-board')) { + renderKanban(); + } + }, 200); +}); + +observer.observe(document.body, { childList: true, subtree: true }); +renderKanban(); diff --git a/apps/homepage/config/services.yaml b/apps/homepage/config/services.yaml index 2506fa9..8d207c9 100644 --- a/apps/homepage/config/services.yaml +++ b/apps/homepage/config/services.yaml @@ -52,3 +52,10 @@ description: Diagramming Tool server: my-docker container: mermaid-live-editor + +# # Kanban Board Anchor +# - Learning Hub: +# - Placeholder: +# icon: bookshelf.png +# href: # +# description: "This will be replaced by the Kanban board" diff --git a/apps/homepage/docker-compose.yml b/apps/homepage/docker-compose.yml index 5ee3744..4f5dbc8 100644 --- a/apps/homepage/docker-compose.yml +++ b/apps/homepage/docker-compose.yml @@ -12,11 +12,25 @@ services: - socket-net labels: - "traefik.enable=true" - - "traefik.http.routers.homepage.rule=Host(`arch-services.mywire.org`) || Host(`homepage.localhost`)" + # Public (HTTPS) + - "traefik.http.routers.homepage.rule=Host(`arch-services.mywire.org`)" - "traefik.http.routers.homepage.entrypoints=websecure" - "traefik.http.routers.homepage.tls.certresolver=myresolver" + + # Public (Redirect) + - "traefik.http.routers.homepage-red.rule=Host(`arch-services.mywire.org`)" + - "traefik.http.routers.homepage-red.entrypoints=web" + - "traefik.http.routers.homepage-red.middlewares=https-redirect@docker" + + # Local (HTTP) + - "traefik.http.routers.homepage-local.rule=Host(`homepage.localhost`) || Host(`dashboard.localhost`) || Host(`localhost`)" + + + - "traefik.http.routers.homepage-local.entrypoints=web" + - "traefik.http.services.homepage.loadbalancer.server.port=3000" + networks: proxy-net: external: true diff --git a/apps/learning/app/database.py b/apps/learning/app/database.py new file mode 100644 index 0000000..90381c8 --- /dev/null +++ b/apps/learning/app/database.py @@ -0,0 +1,12 @@ +from sqlalchemy import create_engine +from sqlalchemy.ext.declarative import declarative_base +from sqlalchemy.orm import sessionmaker + +SQLALCHEMY_DATABASE_URL = "sqlite:///./learning.db" + +engine = create_engine( + SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False} +) +SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine) + +Base = declarative_base() diff --git a/apps/learning/app/main.py b/apps/learning/app/main.py new file mode 100644 index 0000000..932eb81 --- /dev/null +++ b/apps/learning/app/main.py @@ -0,0 +1,116 @@ +from fastapi import FastAPI, Depends, HTTPException +from fastapi.staticfiles import StaticFiles +from fastapi.middleware.cors import CORSMiddleware +from fastapi.responses import FileResponse +from sqlalchemy.orm import Session +from typing import List, Optional +from pydantic import BaseModel +import uvicorn +import os + +from . import models, database + +# Create tables +models.Base.metadata.create_all(bind=database.engine) + +app = FastAPI(title="Learning Hub API") + +app.add_middleware( + CORSMiddleware, + allow_origins=["*"], + allow_credentials=True, + allow_methods=["*"], + allow_headers=["*"], +) + +# Dependency +def get_db(): + db = database.SessionLocal() + try: + yield db + finally: + db.close() + +class CourseBase(BaseModel): + title: str + description: Optional[str] = None + main_link: str + last_link: Optional[str] = None + status: str = "Planning" + +class CourseCreate(CourseBase): + pass + +class Course(CourseBase): + id: int + class Config: + from_attributes = True + +@app.get("/api/courses", response_model=List[Course]) +def read_courses(db: Session = Depends(get_db)): + return db.query(models.Course).all() + +@app.post("/api/courses", response_model=Course) +def create_course(course: CourseCreate, db: Session = Depends(get_db)): + db_course = models.Course(**course.dict()) + db.add(db_course) + db.commit() + db.refresh(db_course) + return db_course + +@app.put("/api/courses/{course_id}", response_model=Course) +def update_course(course_id: int, course: CourseCreate, db: Session = Depends(get_db)): + db_course = db.query(models.Course).filter(models.Course.id == course_id).first() + if not db_course: + raise HTTPException(status_code=404, detail="Course not found") + + for key, value in course.dict().items(): + setattr(db_course, key, value) + + db.commit() + db.refresh(db_course) + return db_course + +@app.delete("/api/courses/{course_id}") +def delete_course(course_id: int, db: Session = Depends(get_db)): + db_course = db.query(models.Course).filter(models.Course.id == course_id).first() + if not db_course: + raise HTTPException(status_code=404, detail="Course not found") + db.delete(db_course) + db.commit() + return {"message": "Course deleted"} + +# Seed initial data if empty +@app.on_event("startup") +def startup_event(): + db = database.SessionLocal() + if db.query(models.Course).count() == 0: + initial_courses = [ + models.Course( + title="Desarrollo Backend con Python", + description="Platzi Learning Path", + main_link="https://platzi.com/mis-rutas/16609931/", + status="WIP" + ), + models.Course( + title="Amazon Junior Software Developer", + description="Coursera Professional Certificate", + main_link="https://www.coursera.org/professional-certificates/amazon-junior-software-developer", + status="WIP" + ), + models.Course( + title="Software Design and Architecture", + description="Coursera Specialization", + main_link="https://www.coursera.org/specializations/software-design-architecture", + status="WIP" + ) + ] + db.add_all(initial_courses) + db.commit() + db.close() + +# Serves CSS/JS and index +app.mount("/", StaticFiles(directory="app/static", html=True), name="static") + +if __name__ == "__main__": + uvicorn.run(app, host="0.0.0.0", port=8000) diff --git a/apps/learning/app/models.py b/apps/learning/app/models.py new file mode 100644 index 0000000..ea6af72 --- /dev/null +++ b/apps/learning/app/models.py @@ -0,0 +1,12 @@ +from sqlalchemy import Column, Integer, String +from .database import Base + +class Course(Base): + __tablename__ = "courses" + + id = Column(Integer, primary_key=True, index=True) + title = Column(String) + description = Column(String, nullable=True) + main_link = Column(String) + last_link = Column(String, nullable=True) + status = Column(String, default="Planning") # WIP, Planning, Archive diff --git a/apps/learning/app/static/index.html b/apps/learning/app/static/index.html new file mode 100644 index 0000000..bfb4a50 --- /dev/null +++ b/apps/learning/app/static/index.html @@ -0,0 +1,70 @@ + + + + + + Learning Kanban Board + + + +
+

🎓 Learning Hub

+ +
+ +
+
+

🚀 WIP

+
+
+
+

📅 Planning

+
+
+
+

📦 Archive

+
+
+
+ + + + + + + diff --git a/apps/learning/app/static/script.js b/apps/learning/app/static/script.js new file mode 100644 index 0000000..4729397 --- /dev/null +++ b/apps/learning/app/static/script.js @@ -0,0 +1,148 @@ +let courses = []; + +async function fetchCourses() { + const response = await fetch('/api/courses'); + courses = await response.json(); + renderBoard(); +} + +function renderBoard() { + const columns = ['WIP', 'Planning', 'Archive']; + columns.forEach(status => { + const list = document.getElementById(`list-${status}`); + list.innerHTML = ''; + const filtered = courses.filter(c => c.status === status); + filtered.forEach(course => { + const card = createCard(course); + list.appendChild(card); + }); + }); +} + +function createCard(course) { + const card = document.createElement('div'); + card.className = 'course-card'; + card.draggable = true; + card.id = `course-${course.id}`; + card.innerHTML = ` +
+ + +
+

${course.title}

+

${course.description || ''}

+ + `; + + card.addEventListener('dragstart', (e) => { + e.dataTransfer.setData('text/plain', course.id); + card.classList.add('dragging'); + }); + + card.addEventListener('dragend', () => { + card.classList.remove('dragging'); + }); + + return card; +} + +function allowDrop(e) { + e.preventDefault(); +} + +async function drop(e) { + e.preventDefault(); + const courseId = e.dataTransfer.getData('text/plain'); + const newStatus = e.currentTarget.id; // The column ID + + const course = courses.find(c => c.id == courseId); + if (course && course.status !== newStatus) { + course.status = newStatus; + await updateCourseOnServer(course); + renderBoard(); + } +} + +async function updateCourseOnServer(course) { + await fetch(`/api/courses/${course.id}`, { + method: 'PUT', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify(course) + }); +} + +async function deleteCourse(id) { + if (confirm('Are you sure?')) { + await fetch(`/api/courses/${id}`, { method: 'DELETE' }); + await fetchCourses(); + } +} + +// Modal Logic +const modal = document.getElementById('course-modal'); +const form = document.getElementById('course-form'); + +function showModal(id = null) { + modal.style.display = 'block'; + if (id) { + const course = courses.find(c => c.id == id); + document.getElementById('modal-title').innerText = 'Edit Course'; + document.getElementById('course-id').value = course.id; + document.getElementById('title').value = course.title; + document.getElementById('description').value = course.description || ''; + document.getElementById('main_link').value = course.main_link; + document.getElementById('last_link').value = course.last_link || ''; + document.getElementById('status').value = course.status; + } else { + document.getElementById('modal-title').innerText = 'Add New Course'; + form.reset(); + document.getElementById('course-id').value = ''; + } +} + +function closeModal() { + modal.style.display = 'none'; +} + +form.onsubmit = async (e) => { + e.preventDefault(); + const id = document.getElementById('course-id').value; + const courseData = { + title: document.getElementById('title').value, + description: document.getElementById('description').value, + main_link: document.getElementById('main_link').value, + last_link: document.getElementById('last_link').value, + status: document.getElementById('status').value + }; + + if (id) { + await fetch(`/api/courses/${id}`, { + method: 'PUT', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify(courseData) + }); + } else { + await fetch('/api/courses', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify(courseData) + }); + } + + closeModal(); + await fetchCourses(); +}; + +window.onclick = (e) => { + if (e.target == modal) closeModal(); +}; + +function editCourse(id) { + showModal(id); +} + +// Initial fetch +fetchCourses(); diff --git a/apps/learning/app/static/style.css b/apps/learning/app/static/style.css new file mode 100644 index 0000000..c7dc8c7 --- /dev/null +++ b/apps/learning/app/static/style.css @@ -0,0 +1,175 @@ +:root { + --bg: #f3f4f6; + --column-bg: #e5e7eb; + --card-bg: #ffffff; + --primary: #2563eb; + --text: #1f2937; + --border: #d1d5db; +} + +body { + font-family: -apple-system, sans-serif; + background: var(--bg); + color: var(--text); + margin: 0; + padding: 20px; +} + +header { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 2rem; +} + +h1 { margin: 0; } + +#add-course-btn { + background: var(--primary); + color: white; + border: none; + padding: 10px 20px; + border-radius: 6px; + cursor: pointer; + font-weight: bold; +} + +.kanban-board { + display: flex; + gap: 20px; + align-items: flex-start; +} + +.column { + background: var(--column-bg); + border-radius: 8px; + width: 300px; + min-height: 500px; + padding: 15px; + flex-shrink: 0; +} + +.column h2 { + font-size: 1.1rem; + margin-top: 0; + margin-bottom: 1rem; + color: #4b5563; + text-transform: uppercase; + letter-spacing: 0.05em; +} + +.course-list { + min-height: 400px; +} + +.course-card { + background: var(--card-bg); + border-radius: 6px; + padding: 15px; + margin-bottom: 12px; + box-shadow: 0 1px 3px rgba(0,0,0,0.1); + cursor: grab; + position: relative; + border: 1px solid transparent; +} + +.course-card:hover { + border-color: var(--primary); +} + +.course-card.dragging { + opacity: 0.5; +} + +.course-card h3 { + margin: 0 0 8px 0; + font-size: 1rem; +} + +.course-card p { + font-size: 0.85rem; + color: #6b7280; + margin: 0 0 12px 0; +} + +.card-links { + display: flex; + gap: 10px; + font-size: 0.8rem; +} + +.card-links a { + color: var(--primary); + text-decoration: none; +} + +.card-actions { + position: absolute; + top: 10px; + right: 10px; + display: flex; + gap: 5px; +} + +.card-actions button { + background: none; + border: none; + color: #9ca3af; + cursor: pointer; + padding: 2px; +} + +.card-actions button:hover { + color: var(--text); +} + +/* Modal Styles */ +.modal { + display: none; + position: fixed; + z-index: 100; + left: 0; + top: 0; + width: 100%; + height: 100%; + background: rgba(0,0,0,0.5); +} + +.modal-content { + background: white; + margin: 10% auto; + padding: 2rem; + width: 400px; + border-radius: 8px; +} + +.form-group { + margin-bottom: 1rem; +} + +.form-group label { + display: block; + margin-bottom: 5px; + font-size: 0.9rem; +} + +.form-group input, .form-group textarea, .form-group select { + width: 100%; + padding: 8px; + border: 1px solid var(--border); + border-radius: 4px; + box-sizing: border-box; +} + +.modal-actions { + display: flex; + justify-content: flex-end; + gap: 10px; + margin-top: 1.5rem; +} + +.modal-actions button { + padding: 8px 16px; + border-radius: 4px; + cursor: pointer; +} diff --git a/apps/learning/docker-compose.yml b/apps/learning/docker-compose.yml new file mode 100644 index 0000000..552f678 --- /dev/null +++ b/apps/learning/docker-compose.yml @@ -0,0 +1,33 @@ +services: + learning-hub: + image: python:3.11-slim + container_name: learning-hub + working_dir: /app + volumes: + - .:/app + command: > + sh -c "pip install fastapi uvicorn sqlalchemy && python -m app.main" + networks: + - proxy-net + labels: + - "traefik.enable=true" + # Public (HTTPS) + - "traefik.http.routers.learning.rule=Host(`learning.arch-services.mywire.org`)" + - "traefik.http.routers.learning.entrypoints=websecure" + - "traefik.http.routers.learning.tls.certresolver=myresolver" + - "traefik.http.routers.learning.middlewares=authelia-auth@docker" + + # Public (Redirect) + - "traefik.http.routers.learning-red.rule=Host(`learning.arch-services.mywire.org`)" + - "traefik.http.routers.learning-red.entrypoints=web" + - "traefik.http.routers.learning-red.middlewares=https-redirect@docker" + + # Local (HTTP) + - "traefik.http.routers.learning-local.rule=Host(`learning.localhost`)" + - "traefik.http.routers.learning-local.entrypoints=web" + + - "traefik.http.services.learning.loadbalancer.server.port=8000" + +networks: + proxy-net: + external: true diff --git a/apps/learning/learning.db b/apps/learning/learning.db new file mode 100644 index 0000000..55a1577 Binary files /dev/null and b/apps/learning/learning.db differ diff --git a/apps/mermaid/docker-compose.yml b/apps/mermaid/docker-compose.yml index fa2b4fd..fd43649 100644 --- a/apps/mermaid/docker-compose.yml +++ b/apps/mermaid/docker-compose.yml @@ -7,10 +7,14 @@ services: - proxy-net labels: - "traefik.enable=true" - - "traefik.http.routers.mermaid.rule=Host(`mermaid.arch-services.mywire.org`) || Host(`mermaid.localhost`)" - + - "traefik.http.routers.mermaid.rule=Host(`mermaid.arch-services.mywire.org`)" - "traefik.http.routers.mermaid.entrypoints=websecure" - "traefik.http.routers.mermaid.tls.certresolver=myresolver" + - "traefik.http.routers.mermaid-red.rule=Host(`mermaid.arch-services.mywire.org`)" + - "traefik.http.routers.mermaid-red.entrypoints=web" + - "traefik.http.routers.mermaid-red.middlewares=https-redirect@docker" + - "traefik.http.routers.mermaid-local.rule=Host(`mermaid.localhost`)" + - "traefik.http.routers.mermaid-local.entrypoints=web" - "traefik.http.services.mermaid.loadbalancer.server.port=8080" networks: diff --git a/apps/ollama/docker-compose.yml b/apps/ollama/docker-compose.yml index d1e880e..3657dca 100644 --- a/apps/ollama/docker-compose.yml +++ b/apps/ollama/docker-compose.yml @@ -17,21 +17,40 @@ services: labels: - "traefik.enable=true" # Router 1: API/Automation (Token-based) - - "traefik.http.routers.ollama-api.rule=(Host(`ollama.arch-services.mywire.org`) || Host(`ollama.localhost`)) && Header(`X-Ollama-Key`, `sk-ollama-hardened-hub-2026`)" + - "traefik.http.routers.ollama-api.rule=Host(`ollama.arch-services.mywire.org`) && Header(`X-Ollama-Key`, `sk-ollama-hardened-hub-2026`)" - "traefik.http.routers.ollama-api.entrypoints=websecure" - "traefik.http.routers.ollama-api.tls.certresolver=myresolver" - "traefik.http.routers.ollama-api.priority=100" - "traefik.http.routers.ollama-api.service=ollama-svc" - # Router 2: Browser/Standard (Authelia Protected) - - "traefik.http.routers.ollama-browser.rule=Host(`ollama.arch-services.mywire.org`) || Host(`ollama.localhost`)" + - "traefik.http.routers.ollama-api-red.rule=Host(`ollama.arch-services.mywire.org`) && Header(`X-Ollama-Key`, `sk-ollama-hardened-hub-2026`)" + - "traefik.http.routers.ollama-api-red.entrypoints=web" + - "traefik.http.routers.ollama-api-red.middlewares=https-redirect@docker" + - "traefik.http.routers.ollama-api-red.priority=100" + - "traefik.http.routers.ollama-api-local.rule=Host(`ollama.localhost`) && Header(`X-Ollama-Key`, `sk-ollama-hardened-hub-2026`)" + - "traefik.http.routers.ollama-api-local.entrypoints=web" + - "traefik.http.routers.ollama-api-local.priority=100" + - "traefik.http.routers.ollama-api-local.service=ollama-svc" + + # Router 2: Browser/Standard (Authelia Protected) + - "traefik.http.routers.ollama-browser.rule=Host(`ollama.arch-services.mywire.org`)" - "traefik.http.routers.ollama-browser.entrypoints=websecure" - "traefik.http.routers.ollama-browser.tls.certresolver=myresolver" - "traefik.http.routers.ollama-browser.middlewares=authelia-auth@docker" - "traefik.http.routers.ollama-browser.priority=50" - "traefik.http.routers.ollama-browser.service=ollama-svc" + - "traefik.http.routers.ollama-browser-red.rule=Host(`ollama.arch-services.mywire.org`)" + - "traefik.http.routers.ollama-browser-red.entrypoints=web" + - "traefik.http.routers.ollama-browser-red.middlewares=https-redirect@docker" + - "traefik.http.routers.ollama-browser-red.priority=50" + + - "traefik.http.routers.ollama-browser-local.rule=Host(`ollama.localhost`)" + - "traefik.http.routers.ollama-browser-local.entrypoints=web" + - "traefik.http.routers.ollama-browser-local.priority=50" + - "traefik.http.routers.ollama-browser-local.service=ollama-svc" + # Shared Service - "traefik.http.services.ollama-svc.loadbalancer.server.port=11434" - "traefik.http.services.ollama-svc.loadbalancer.healthcheck.path=/api/tags" diff --git a/docs/architecture.html b/docs/architecture.html index e38e950..3a70f6f 100644 --- a/docs/architecture.html +++ b/docs/architecture.html @@ -69,12 +69,14 @@
+

4. Networking Model

Traffic flow is segmented to minimize the blast radius of a potential breach.

diff --git a/infra/authelia/docker-compose.yml b/infra/authelia/docker-compose.yml index bcbdf78..8a2a136 100644 --- a/infra/authelia/docker-compose.yml +++ b/infra/authelia/docker-compose.yml @@ -9,15 +9,26 @@ services: - proxy-net labels: - "traefik.enable=true" - - "traefik.http.routers.authelia.rule=Host(`auth.arch-services.mywire.org`) || Host(`auth.localhost`)" - + # Public (HTTPS) + - "traefik.http.routers.authelia.rule=Host(`auth.arch-services.mywire.org`)" - "traefik.http.routers.authelia.entrypoints=websecure" - "traefik.http.routers.authelia.tls.certresolver=myresolver" - # This label defines the middleware that other services will use + + # Public (Redirect) + - "traefik.http.routers.authelia-red.rule=Host(`auth.arch-services.mywire.org`)" + - "traefik.http.routers.authelia-red.entrypoints=web" + - "traefik.http.routers.authelia-red.middlewares=https-redirect@docker" + + # Local (HTTP) + - "traefik.http.routers.authelia-local.rule=Host(`auth.localhost`)" + - "traefik.http.routers.authelia-local.entrypoints=web" + + # Middleware definition (shared) - "traefik.http.middlewares.authelia-auth.forwardauth.address=http://authelia:9091/api/verify?rd=https://auth.arch-services.mywire.org/" - "traefik.http.middlewares.authelia-auth.forwardauth.trustForwardHeader=true" - "traefik.http.middlewares.authelia-auth.forwardauth.authResponseHeaders=Remote-User,Remote-Groups,Remote-Name,Remote-Email" + networks: proxy-net: external: true diff --git a/infra/core/docker-compose.yml b/infra/core/docker-compose.yml index cf50f15..5dec524 100644 --- a/infra/core/docker-compose.yml +++ b/infra/core/docker-compose.yml @@ -50,8 +50,6 @@ services: - "--providers.docker.endpoint=tcp://socket-proxy:2375" - "--providers.docker.exposedByDefault=false" - "--entrypoints.web.address=:80" - - "--entrypoints.web.http.redirections.entryPoint.to=websecure" - - "--entrypoints.web.http.redirections.entryPoint.scheme=https" - "--entrypoints.websecure.address=:443" # SSL Setup - "--certificatesresolvers.myresolver.acme.dnschallenge=true" @@ -65,17 +63,29 @@ services: - proxy-net labels: - "traefik.enable=true" - # Authelia Middleware - - "traefik.http.middlewares.authelia-auth.forwardauth.address=http://authelia:9091/api/verify?rd=https://auth.arch-services.mywire.org/" - - "traefik.http.middlewares.authelia-auth.forwardauth.trustForwardHeader=true" - - "traefik.http.middlewares.authelia-auth.forwardauth.authResponseHeaders=Remote-User,Remote-Groups,Remote-Name,Remote-Email" - # Dashboard - - "traefik.http.routers.traefik-dash.rule=Host(`traefik.arch-services.mywire.org`) || Host(`traefik.localhost`)" + + # Middleware: Redirect to HTTPS + - "traefik.http.middlewares.https-redirect.redirectscheme.scheme=https" + - "traefik.http.middlewares.https-redirect.redirectscheme.permanent=true" + # Dashboard - Public (HTTPS) + - "traefik.http.routers.traefik-dash.rule=Host(`traefik.arch-services.mywire.org`)" - "traefik.http.routers.traefik-dash.entrypoints=websecure" - "traefik.http.routers.traefik-dash.tls.certresolver=myresolver" - "traefik.http.routers.traefik-dash.service=api@internal" - - "traefik.http.routers.traefik-dash.middlewares=authelia-auth" + - "traefik.http.routers.traefik-dash.middlewares=authelia-auth@docker" + + # Dashboard - Public (Redirect) + - "traefik.http.routers.traefik-dash-red.rule=Host(`traefik.arch-services.mywire.org`)" + - "traefik.http.routers.traefik-dash-red.entrypoints=web" + - "traefik.http.routers.traefik-dash-red.middlewares=https-redirect@docker" + + # Dashboard - Local (HTTP) + - "traefik.http.routers.traefik-dash-local.rule=Host(`traefik.localhost`)" + - "traefik.http.routers.traefik-dash-local.entrypoints=web" + - "traefik.http.routers.traefik-dash-local.service=api@internal" + + logging: driver: "json-file" options: diff --git a/infra/dozzle/docker-compose.yml b/infra/dozzle/docker-compose.yml index 5a1b49e..4a6c720 100644 --- a/infra/dozzle/docker-compose.yml +++ b/infra/dozzle/docker-compose.yml @@ -10,11 +10,15 @@ services: - socket-net labels: - "traefik.enable=true" - - "traefik.http.routers.logs.rule=Host(`logs.arch-services.mywire.org`) || Host(`logs.localhost`)" - + - "traefik.http.routers.logs.rule=Host(`logs.arch-services.mywire.org`)" - "traefik.http.routers.logs.entrypoints=websecure" - "traefik.http.routers.logs.tls.certresolver=myresolver" - "traefik.http.routers.logs.middlewares=authelia-auth@docker" + - "traefik.http.routers.logs-red.rule=Host(`logs.arch-services.mywire.org`)" + - "traefik.http.routers.logs-red.entrypoints=web" + - "traefik.http.routers.logs-red.middlewares=https-redirect@docker" + - "traefik.http.routers.logs-local.rule=Host(`logs.localhost`)" + - "traefik.http.routers.logs-local.entrypoints=web" networks: proxy-net: diff --git a/infra/portainer/docker-compose.yml b/infra/portainer/docker-compose.yml index 9c6ba44..de3be49 100644 --- a/infra/portainer/docker-compose.yml +++ b/infra/portainer/docker-compose.yml @@ -11,10 +11,14 @@ services: - proxy-net labels: - "traefik.enable=true" - - "traefik.http.routers.portainer.rule=Host(`portainer.arch-services.mywire.org`) || Host(`portainer.localhost`)" - + - "traefik.http.routers.portainer.rule=Host(`portainer.arch-services.mywire.org`)" - "traefik.http.routers.portainer.entrypoints=websecure" - "traefik.http.routers.portainer.tls.certresolver=myresolver" + - "traefik.http.routers.portainer-red.rule=Host(`portainer.arch-services.mywire.org`)" + - "traefik.http.routers.portainer-red.entrypoints=web" + - "traefik.http.routers.portainer-red.middlewares=https-redirect@docker" + - "traefik.http.routers.portainer-local.rule=Host(`portainer.localhost`)" + - "traefik.http.routers.portainer-local.entrypoints=web" - "traefik.http.services.portainer.loadbalancer.server.port=9000" networks: