78 lines
2.0 KiB
Bash
Executable File
78 lines
2.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Docmost Custom Management Script
|
|
|
|
# Colors for output
|
|
GREEN='\033[0;32m'
|
|
BLUE='\033[0;34m'
|
|
YELLOW='\033[1;33m'
|
|
RED='\033[0;31m'
|
|
NC='\033[0m' # No Color
|
|
|
|
# Function to display help
|
|
show_help() {
|
|
echo -e "${BLUE}Docmost Custom Management Script${NC}"
|
|
echo "Usage: ./manage.sh [command]"
|
|
echo ""
|
|
echo "Commands:"
|
|
echo " start Start the project in detached mode"
|
|
echo " stop Stop the project"
|
|
echo " restart Restart the project"
|
|
echo " build Build the images and start"
|
|
echo " logs Show real-time logs"
|
|
echo " status Show status of containers"
|
|
echo " clean Stop and remove all volumes (WARNING: Data will be lost)"
|
|
echo " help Show this help message"
|
|
}
|
|
|
|
# Check if docker is installed
|
|
if ! command -v docker &> /dev/null; then
|
|
echo -e "${RED}Error: docker is not installed.${NC}"
|
|
exit 1
|
|
fi
|
|
|
|
# Determine docker compose command (docker compose or docker-compose)
|
|
if docker compose version &> /dev/null; then
|
|
DOCKER_COMPOSE="docker compose"
|
|
else
|
|
DOCKER_COMPOSE="docker-compose"
|
|
fi
|
|
|
|
case "$1" in
|
|
start)
|
|
echo -e "${GREEN}Starting Docmost Custom...${NC}"
|
|
$DOCKER_COMPOSE up -d
|
|
echo -e "${GREEN}Project is running at http://localhost:3000${NC}"
|
|
;;
|
|
stop)
|
|
echo -e "${YELLOW}Stopping Docmost Custom...${NC}"
|
|
$DOCKER_COMPOSE stop
|
|
;;
|
|
restart)
|
|
echo -e "${YELLOW}Restarting Docmost Custom...${NC}"
|
|
$DOCKER_COMPOSE restart
|
|
;;
|
|
build)
|
|
echo -e "${BLUE}Building and starting Docmost Custom...${NC}"
|
|
$DOCKER_COMPOSE up -d --build
|
|
;;
|
|
logs)
|
|
$DOCKER_COMPOSE logs -f
|
|
;;
|
|
status)
|
|
$DOCKER_COMPOSE ps
|
|
;;
|
|
clean)
|
|
echo -e "${RED}WARNING: This will remove all data volumes.${NC}"
|
|
read -p "Are you sure? (y/N) " -n 1 -r
|
|
echo
|
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
$DOCKER_COMPOSE down -v
|
|
echo -e "${GREEN}Project cleaned.${NC}"
|
|
fi
|
|
;;
|
|
help|*)
|
|
show_help
|
|
;;
|
|
esac
|