diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..e96e24b --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,10 @@ +{ + "name": "JetKVM", + "image": "mcr.microsoft.com/devcontainers/go:1-1.23-bookworm", + "features": { + "ghcr.io/devcontainers/features/node:1": { + // Should match what is defined in ui/package.json + "version": "21.1.0" + } + } +} diff --git a/Makefile b/Makefile index 5c03635..04c7402 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ build_dev: hash_resource GOOS=linux GOARCH=arm GOARM=7 go build -ldflags="-s -w -X kvm.builtAppVersion=$(VERSION_DEV)" -o bin/jetkvm_app cmd/main.go frontend: - cd ui && npm run build:device + cd ui && npm ci && npm run build:device dev_release: build_dev @echo "Uploading release..." diff --git a/dev_deploy.sh b/dev_deploy.sh index 1d6aa82..a106395 100755 --- a/dev_deploy.sh +++ b/dev_deploy.sh @@ -3,35 +3,28 @@ set -e # Function to display help message show_help() { - echo "Usage: $0 [options] -h -r " + echo "Usage: $0 [options] -r " echo echo "Required:" - echo " -h, --host Local host IP address" echo " -r, --remote Remote host IP address" echo echo "Optional:" echo " -u, --user Remote username (default: root)" - echo " -p, --port Python server port (default: 8000)" echo " --help Display this help message" echo echo "Example:" - echo " $0 -h 192.168.0.13 -r 192.168.0.17" - echo " $0 -h 192.168.0.13 -r 192.168.0.17 -u admin -p 8080" + echo " $0 -r 192.168.0.17" + echo " $0 -r 192.168.0.17 -u admin" exit 0 } # Default values -PYTHON_PORT=8000 REMOTE_USER="root" REMOTE_PATH="/userdata/jetkvm/bin" # Parse command line arguments while [[ $# -gt 0 ]]; do case $1 in - -h|--host) - HOST_IP="$2" - shift 2 - ;; -r|--remote) REMOTE_HOST="$2" shift 2 @@ -40,10 +33,6 @@ while [[ $# -gt 0 ]]; do REMOTE_USER="$2" shift 2 ;; - -p|--port) - PYTHON_PORT="$2" - shift 2 - ;; --help) show_help exit 0 @@ -57,8 +46,8 @@ while [[ $# -gt 0 ]]; do done # Verify required parameters -if [ -z "$HOST_IP" ] || [ -z "$REMOTE_HOST" ]; then - echo "Error: Host IP and Remote IP are required parameters" +if [ -z "$REMOTE_HOST" ]; then + echo "Error: Remote IP is a required parameter" show_help fi @@ -69,12 +58,8 @@ make build_dev # Change directory to the binary output directory cd bin -# Start a Python HTTP server in the background to serve files -python3 -m http.server "$PYTHON_PORT" & -PYTHON_SERVER_PID=$! - -# Ensure that the Python server is terminated if the script exits unexpectedly -trap "echo 'Terminating Python server...'; kill $PYTHON_SERVER_PID" EXIT +# Copy the binary to the remote host +cat jetkvm_app | ssh "${REMOTE_USER}@${REMOTE_HOST}" "cat > $REMOTE_PATH/jetkvm_app_debug" # Deploy and run the application on the remote host ssh "${REMOTE_USER}@${REMOTE_HOST}" ash <