Rebuild UI for master-slave file distribution

This commit is contained in:
liumangmang
2026-03-10 18:08:07 +08:00
parent 0c443b029d
commit cbb0d42a46
5 changed files with 1164 additions and 626 deletions

84
Makefile Normal file
View File

@@ -0,0 +1,84 @@
SHELL := /bin/bash
APP_NAME := sftp-manager
PORT := 48081
BASE_PATH := /sftp-manager
APP_URL := http://localhost:$(PORT)$(BASE_PATH)
MVN := mvn
DOCKER_COMPOSE := docker compose
.DEFAULT_GOAL := help
.PHONY: help check-mvn check-docker install build test start stop restart status logs deploy bootstrap clean jar-start jar-stop jar-restart
help:
@echo "Available targets:"
@echo " make bootstrap - One command install + deploy + start (Docker)"
@echo " make deploy - Build app and start with Docker Compose"
@echo " make install - Maven install (skip tests)"
@echo " make build - Maven package (skip tests)"
@echo " make test - Run all tests"
@echo " make start - Start service by Docker Compose"
@echo " make stop - Stop service by Docker Compose"
@echo " make restart - Restart Docker service"
@echo " make status - Show Docker service status"
@echo " make logs - Tail service logs"
@echo " make jar-start - Start packaged jar using deploy.sh"
@echo " make jar-stop - Stop packaged jar using deploy.sh"
@echo " make jar-restart - Restart packaged jar using deploy.sh"
check-mvn:
@command -v $(MVN) >/dev/null 2>&1 || { echo "Error: mvn not found"; exit 1; }
check-docker:
@command -v docker >/dev/null 2>&1 || { echo "Error: docker not found"; exit 1; }
@$(DOCKER_COMPOSE) version >/dev/null 2>&1 || { echo "Error: docker compose not available"; exit 1; }
install: check-mvn
@echo ">>> Installing project artifacts (skip tests)..."
@$(MVN) clean install -DskipTests
build: check-mvn
@echo ">>> Packaging application (skip tests)..."
@$(MVN) clean package -DskipTests
test: check-mvn
@echo ">>> Running tests..."
@$(MVN) clean test
start: check-docker
@echo ">>> Starting $(APP_NAME) with Docker Compose..."
@$(DOCKER_COMPOSE) up -d --build
@echo ">>> Started. Visit: $(APP_URL)"
stop: check-docker
@echo ">>> Stopping $(APP_NAME)..."
@$(DOCKER_COMPOSE) down
restart: stop start
status: check-docker
@$(DOCKER_COMPOSE) ps
logs: check-docker
@$(DOCKER_COMPOSE) logs -f --tail=200 $(APP_NAME)
deploy: build start
bootstrap: install start
clean: check-mvn
@$(MVN) clean
jar-start: build
@chmod +x ./deploy.sh
@./deploy.sh start
jar-stop:
@chmod +x ./deploy.sh
@./deploy.sh stop
jar-restart: build
@chmod +x ./deploy.sh
@./deploy.sh restart