This commit is contained in:
2026-03-19 14:36:35 +07:00
parent 6d7d86befd
commit 96635dbcf2
28 changed files with 4332 additions and 1683 deletions

View File

@@ -1,22 +1,95 @@
# Имя проекта (можно менять)
PROJECT_NAME=postgres_admin
.PHONY: help install dev start stop logs clean build up down restart
# Файл compose
COMPOSE=docker-compose
# Project settings
PROJECT_NAME=pg-admin
DOCKER_COMPOSE=docker-compose
# === Основные команды ===
# Colors for output
BLUE=\033[0;34m
GREEN=\033[0;32m
YELLOW=\033[0;33m
NC=\033[0m # No Color
# Сборка контейнеров
help:
@echo "$(BLUE)=== PG-Admin - PostgreSQL Admin Panel ===$(NC)"
@echo "$(GREEN)Available commands:$(NC)"
@echo " make install - Install dependencies"
@echo " make dev - Run development server"
@echo " make start - Start application"
@echo " make stop - Stop application"
@echo " make restart - Restart application"
@echo " make build - Build Docker image"
@echo " make up - Start Docker containers"
@echo " make down - Stop Docker containers"
@echo " make logs - View Docker logs"
@echo " make clean - Remove containers and volumes"
@echo " make db-reset - Reset database"
@echo ""
# Install dependencies
install:
@echo "$(BLUE)Installing dependencies...$(NC)"
npm install
@echo "$(GREEN)✓ Dependencies installed$(NC)"
# Development server with hot reload
dev:
@echo "$(BLUE)Starting development server...$(NC)"
npm run dev
# Start production server
start:
@echo "$(BLUE)Starting server...$(NC)"
npm start
# Stop application
stop:
@echo "$(BLUE)Stopping server...$(NC)"
@pkill -f "node server.js" || true
# Restart application
restart: stop start
@echo "$(GREEN)✓ Server restarted$(NC)"
# Docker - Build image
build:
$(COMPOSE) build
@echo "$(BLUE)Building Docker image...$(NC)"
$(DOCKER_COMPOSE) build
@echo "$(GREEN)✓ Image built$(NC)"
# Запуск (в фоне)
up:
$(COMPOSE) up -d
# Docker - Start containers
up: build
@echo "$(BLUE)Starting containers...$(NC)"
$(DOCKER_COMPOSE) up -d
@echo "$(GREEN)✓ Containers started$(NC)"
@echo "Application available at http://localhost:3000"
# Остановка
# Docker - Stop containers
down:
$(COMPOSE) down
@echo "$(BLUE)Stopping containers...$(NC)"
$(DOCKER_COMPOSE) down
@echo "$(GREEN)✓ Containers stopped$(NC)"
# Docker - View logs
logs:
@echo "$(BLUE)Fetching logs...$(NC)"
$(DOCKER_COMPOSE) logs -f
# Docker - Clean (remove containers and volumes)
clean:
@echo "$(YELLOW)Cleaning Docker resources...$(NC)"
$(DOCKER_COMPOSE) down -v
@echo "$(GREEN)✓ Cleaned$(NC)"
# Database - Reset database
db-reset:
@echo "$(YELLOW)Resetting database...$(NC)"
$(DOCKER_COMPOSE) exec postgres psql -U postgres -d postgres -c "DROP DATABASE IF EXISTS postgres;"
$(DOCKER_COMPOSE) exec postgres psql -U postgres -d postgres -c "CREATE DATABASE postgres;"
@echo "$(GREEN)✓ Database reset$(NC)"
# Show all targets
.DEFAULT_GOAL := help
# Перезапуск
restart: