Update
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
PORTAINER_URL=your_portainer_url_here
|
||||
PORTAINER_API_KEY=your_api_key_here
|
||||
PORTAINER_ENDPOINT_ID=Enpoint_ID_from_Portainer
|
||||
|
||||
PORTAINER_URL=Your_Portainer_Server_Adress
|
||||
PORTAINER_API_KEY=Your_Portainer_API_Key
|
||||
PORTAINER_ENDPOINT_ID=Your_Portainer_Endpoint_ID
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
version: '3.8'
|
||||
services:
|
||||
app:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- "4001:4001" # Host 5173 → Container 5173
|
||||
environment:
|
||||
PORTAINER_URL: "https://10.10.10.21:9443/"
|
||||
PORTAINER_API_KEY: "ptr_ce3Wufxf+EKpqxc5ebcQjBkUMUoJmMpY3wGIvkgdxV0="
|
||||
ENDPOINT_ID: "1"
|
||||
restart: unless-stopped
|
||||
+4
-4
@@ -5,9 +5,9 @@ services:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- "4000:4000"
|
||||
- "4001:4001"
|
||||
environment:
|
||||
PORT: 4000
|
||||
PORTAINER_URL: "https://your-portainer.example.com"
|
||||
PORTAINER_API_KEY: "your_api_key_here"
|
||||
PORTAINER_URL: "Your_Portainer_Server_Address"
|
||||
PORTAINER_API_KEY: "Your_Portainer_API_Key"
|
||||
PORTAINER_ENDPOINT_ID: "Your_Portainer_Endpoint_ID"
|
||||
restart: unless-stopped
|
||||
|
||||
@@ -1,112 +0,0 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import axios from "axios";
|
||||
import { io } from "socket.io-client";
|
||||
|
||||
export default function Stacks() {
|
||||
const [stacks, setStacks] = useState([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState("");
|
||||
|
||||
// Socket.IO initialisieren (Proxy leitet /socket.io an Backend)
|
||||
useEffect(() => {
|
||||
const socket = io("/", { transports: ["websocket"] });
|
||||
console.log("🔌 Socket connected");
|
||||
|
||||
socket.on("redeployStatus", ({ stackId, status }) => {
|
||||
console.log(`🔄 Stack ${stackId} Redeploy Status: ${status ? "running" : "finished"}`);
|
||||
setStacks(prevStacks =>
|
||||
prevStacks.map(stack =>
|
||||
stack.Id === stackId
|
||||
? { ...stack, redeploying: status, updateStatus: status ? stack.updateStatus : "✅" }
|
||||
: stack
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
return () => socket.disconnect();
|
||||
}, []);
|
||||
|
||||
// Stacks initial laden
|
||||
const fetchStacks = async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const res = await axios.get("/api/stacks");
|
||||
setStacks(
|
||||
res.data
|
||||
.sort((a, b) => a.Name.localeCompare(b.Name))
|
||||
.map(stack => ({ ...stack, redeploying: stack.redeploying || false }))
|
||||
);
|
||||
} catch (err) {
|
||||
console.error("❌ Fehler beim Abrufen der Stacks:", err);
|
||||
setError("Fehler beim Laden der Stacks");
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
fetchStacks();
|
||||
}, []);
|
||||
|
||||
// Redeploy starten
|
||||
const handleRedeploy = async (stackId) => {
|
||||
// Sofort UI auf redeploying setzen
|
||||
setStacks(prev =>
|
||||
prev.map(stack => stack.Id === stackId ? { ...stack, redeploying: true } : stack)
|
||||
);
|
||||
|
||||
try {
|
||||
await axios.put(`/api/stacks/${stackId}/redeploy`);
|
||||
// Backend sendet Socket-Event → UI aktualisiert automatisch
|
||||
} catch (err) {
|
||||
console.error("❌ Fehler beim Redeploy:", err);
|
||||
setStacks(prev =>
|
||||
prev.map(stack => stack.Id === stackId ? { ...stack, redeploying: false } : stack)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
if (loading) return <p className="text-gray-400">Lade Stacks...</p>;
|
||||
if (error) return <p className="text-red-400">{error}</p>;
|
||||
|
||||
return (
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-6 p-6">
|
||||
{stacks.map(stack => {
|
||||
const isRedeploying = stack.redeploying;
|
||||
|
||||
return (
|
||||
<div
|
||||
key={stack.Id}
|
||||
className={`flex justify-between items-center p-5 rounded-xl shadow-lg transition
|
||||
${isRedeploying ? "bg-gray-700 cursor-not-allowed" : "bg-gray-800 hover:bg-gray-700"}`}
|
||||
>
|
||||
<div className="flex items-center space-x-4">
|
||||
{/* Status Indicator */}
|
||||
<div className={`w-12 h-12 flex items-center justify-center rounded-full
|
||||
${stack.updateStatus === "✅" ? "bg-green-500" :
|
||||
stack.updateStatus === "⚠️" ? "bg-yellow-500" :
|
||||
"bg-red-500"}`}
|
||||
/>
|
||||
<div>
|
||||
<p className="text-lg font-semibold text-white">{stack.Name}</p>
|
||||
<p className="text-sm text-gray-400">ID: {stack.Id}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Redeploy Button */}
|
||||
<button
|
||||
onClick={() => handleRedeploy(stack.Id)}
|
||||
disabled={isRedeploying}
|
||||
className={`px-5 py-2 rounded-lg font-medium transition
|
||||
${isRedeploying ? "bg-orange-500 cursor-not-allowed" :
|
||||
"bg-blue-500 hover:bg-blue-600"}`}
|
||||
>
|
||||
{isRedeploying ? "Redeploying" : "Redeploy"}
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
{stacks.length === 0 && <p className="text-gray-400">Keine Stacks gefunden.</p>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# --- Konfiguration ---
|
||||
GHCR_USERNAME="mboehmlaender"
|
||||
REPO_NAME="stackpulse"
|
||||
|
||||
# --- Branch prüfen ---
|
||||
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||
if [[ "$BRANCH" != "master" ]]; then
|
||||
echo "Fehler: Du musst auf 'master' sein, um ein Release zu machen."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# --- Versionsnummer abfragen ---
|
||||
while true; do
|
||||
read -p "Bitte Versionsnummer für das Docker-Image eingeben (z.B. v0.1): " VERSION_TAG
|
||||
if [[ -n "$VERSION_TAG" ]]; then break; else echo "Versionsnummer darf nicht leer sein."; fi
|
||||
done
|
||||
|
||||
# --- Docker: Login ---
|
||||
if [ -z "$CR_PAT" ]; then
|
||||
echo "CR_PAT (GitHub Token) nicht gesetzt! Bitte export CR_PAT=<token>"
|
||||
exit 1
|
||||
fi
|
||||
echo $CR_PAT | docker login ghcr.io -u $GHCR_USERNAME --password-stdin
|
||||
|
||||
# --- Docker: Build & Tag ---
|
||||
docker build -t ghcr.io/$GHCR_USERNAME/$REPO_NAME:$VERSION_TAG .
|
||||
docker tag ghcr.io/$GHCR_USERNAME/$REPO_NAME:$VERSION_TAG ghcr.io/$GHCR_USERNAME/$REPO_NAME:latest
|
||||
|
||||
# --- Docker: Push ---
|
||||
docker push ghcr.io/$GHCR_USERNAME/$REPO_NAME:$VERSION_TAG
|
||||
docker push ghcr.io/$GHCR_USERNAME/$REPO_NAME:latest
|
||||
|
||||
echo "Docker-Release $VERSION_TAG erfolgreich gebaut und zu GHCR gepusht!"
|
||||
Reference in New Issue
Block a user