diff --git a/deploy.sh b/deploy.sh index 01aa465..9d9c24a 100755 --- a/deploy.sh +++ b/deploy.sh @@ -243,26 +243,21 @@ docker compose -f docker-compose.yml -f docker-compose.prod.yml \ # ───────────────────────────────────────────────────────────────────────────── info "Step 10: Configuring Apache..." -APACHE_CONF_SRC="$SCRIPT_DIR/apache/deckforge.conf" -APACHE_CONF_DST="/etc/apache2/sites-available/deckforge.conf" +# DeckForge rules are merged into optical-dev.oliver.solutions.conf (managed by OliVAS team). +# We only need to ensure deckforge.conf is disabled (if it still exists from a prior deploy) +# and reload Apache. -# Substitute actual ports into the template -sed \ - -e "s/API_PORT/${API_PORT}/g" \ - -e "s/WEB_PORT/${WEB_PORT}/g" \ - "$APACHE_CONF_SRC" | sudo tee "$APACHE_CONF_DST" > /dev/null +if [[ -L /etc/apache2/sites-enabled/deckforge.conf ]]; then + sudo a2dissite deckforge.conf -q || true + info " Disabled legacy deckforge.conf" +fi -info " Written $APACHE_CONF_DST" - -# Disable default site on first install +# Disable default site if present if [[ -L /etc/apache2/sites-enabled/000-default.conf ]]; then sudo a2dissite 000-default.conf -q || true info " Disabled 000-default.conf" fi -sudo a2ensite deckforge.conf -q -info " Enabled deckforge.conf" - # Health check page — Google LB requires GET / to return 200 sudo mkdir -p /var/www/html sudo tee /var/www/html/index.html > /dev/null << 'EOF' @@ -277,7 +272,7 @@ if sudo apache2ctl configtest 2>&1 | grep -q "Syntax OK"; then sudo systemctl reload apache2 info " Apache reloaded" else - error "Apache config test failed — check $APACHE_CONF_DST" + error "Apache config test failed" sudo apache2ctl configtest exit 1 fi diff --git a/frontend/components/AuthGuard.tsx b/frontend/components/AuthGuard.tsx index 4907012..6b4fddb 100644 --- a/frontend/components/AuthGuard.tsx +++ b/frontend/components/AuthGuard.tsx @@ -4,7 +4,7 @@ import { useEffect } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { fetchCurrentUser, checkDevMode } from '@/store/slices/authSlice'; import { RootState, AppDispatch } from '@/store/store'; -import { usePathname } from 'next/navigation'; +import { usePathname, useRouter } from 'next/navigation'; const PUBLIC_PATHS = ['/login']; @@ -14,6 +14,7 @@ export function AuthGuard({ children }: { children: React.ReactNode }) { (state: RootState) => state.auth ); const pathname = usePathname(); + const router = useRouter(); useEffect(() => { dispatch(fetchCurrentUser()); @@ -53,9 +54,7 @@ export function AuthGuard({ children }: { children: React.ReactNode }) { } if (!isAuthenticated) { - if (typeof window !== 'undefined') { - window.location.href = '/login'; - } + router.push('/login'); return null; } diff --git a/frontend/next.config.mjs b/frontend/next.config.mjs index c4643ef..43edf4b 100644 --- a/frontend/next.config.mjs +++ b/frontend/next.config.mjs @@ -2,6 +2,8 @@ const API_URL = process.env.API_INTERNAL_URL || 'http://localhost:8000'; const nextConfig = { + basePath: "/ppt-tool", + assetPrefix: "/ppt-tool", reactStrictMode: false, distDir: ".next-build",