Port im Browser-Javascript
This commit is contained in:
24
docker-compose.yaml
Normal file
24
docker-compose.yaml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
version: "3.9"
|
||||||
|
|
||||||
|
services:
|
||||||
|
appRobotControlRed:
|
||||||
|
image: node:20-bullseye
|
||||||
|
# Alternativ: node:20-alpine (kleiner, aber evtl. openssl/ca/certs nachziehen)
|
||||||
|
container_name: appRobotControlRed
|
||||||
|
network_mode: host
|
||||||
|
working_dir: /app
|
||||||
|
volumes:
|
||||||
|
- /home/chk/Documents/appRobotControlScara:/app
|
||||||
|
environment:
|
||||||
|
# Deine App liest diese Variablen (config.js ist schon vorbereitet)
|
||||||
|
- FluidNcHost=fluidncred.local
|
||||||
|
- FluidNcPort=80
|
||||||
|
- PORT=3000
|
||||||
|
ports:
|
||||||
|
- "3000:3000"
|
||||||
|
command: >
|
||||||
|
/bin/bash -lc "
|
||||||
|
npm ci || npm install &&
|
||||||
|
node server/server.js
|
||||||
|
"
|
||||||
|
restart: unless-stopped
|
||||||
59
install.sh
Normal file
59
install.sh
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# --- Konfiguration ---
|
||||||
|
REPO_NAME="appRobotControlScara"
|
||||||
|
REPO_URL="http://thinkcentre.local:3000/ChK/appRobotControlScara.git"
|
||||||
|
TARGET_DIR="/home/chk/Documents/appRobotControlScara"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
echo "[1/6] Pakete aktualisieren & Git installieren..."
|
||||||
|
sudo apt-get update -y
|
||||||
|
sudo apt-get install -y git ca-certificates curl
|
||||||
|
|
||||||
|
echo "[2/6] Docker & Compose installieren (falls nicht vorhanden)..."
|
||||||
|
if ! command -v docker >/dev/null 2>&1; then
|
||||||
|
curl -fsSL https://get.docker.com | sudo sh
|
||||||
|
sudo usermod -aG docker "$USER"
|
||||||
|
echo ">> Ab- und wieder anmelden, damit die docker-Gruppe aktiv wird (oder 'newgrp docker')."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Compose-Plugin prüfen/holen (bei Debian/Raspbian Bullseye/Bookworm meist verfügbar)
|
||||||
|
if ! docker compose version >/dev/null 2>&1; then
|
||||||
|
echo "Docker Compose Plugin scheint zu fehlen. Bitte OS-spezifisch nachinstallieren."
|
||||||
|
echo "Bei Raspberry Pi OS: 'sudo apt-get install -y docker-compose-plugin'"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[3/6] Zielverzeichnis vorbereiten: ${TARGET_DIR}"
|
||||||
|
sudo mkdir -p "${TARGET_DIR}"
|
||||||
|
sudo chown -R "$USER":"$USER" "${TARGET_DIR}"
|
||||||
|
|
||||||
|
echo "[4/6] Repository klonen/aktualisieren..."
|
||||||
|
if [ -d "${TARGET_DIR}/.git" ]; then
|
||||||
|
cd "${TARGET_DIR}"
|
||||||
|
git fetch --all
|
||||||
|
git pull --ff-only
|
||||||
|
else
|
||||||
|
git clone "${REPO_URL}" "${TARGET_DIR}"
|
||||||
|
cd "${TARGET_DIR}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[5/6] .env optional anlegen (falls gewünscht)..."
|
||||||
|
if [ ! -f ".env" ]; then
|
||||||
|
cat > .env <<EOF
|
||||||
|
FluidNcHost=fluidncred.local
|
||||||
|
FluidNcPort=80
|
||||||
|
PORT=3000
|
||||||
|
EOF
|
||||||
|
echo ">> .env erstellt (Standardwerte)."
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
echo "[6/6] Certs erstellen"
|
||||||
|
|
||||||
|
chmod +x scripts/create_certs.sh
|
||||||
|
./scripts/create_certs.sh
|
||||||
|
|
||||||
|
|
||||||
|
echo "Docker in portainer eintragen"
|
||||||
@@ -121,7 +121,7 @@
|
|||||||
let ws;
|
let ws;
|
||||||
|
|
||||||
function connectWS() {
|
function connectWS() {
|
||||||
ws = new WebSocket("wss://" + window.location.hostname + ":3000");
|
ws = new WebSocket("wss://" + window.location.hostname + ":" + window.location.port);
|
||||||
|
|
||||||
ws.onopen = () => {
|
ws.onopen = () => {
|
||||||
console.log("WS connected");
|
console.log("WS connected");
|
||||||
|
|||||||
Reference in New Issue
Block a user