-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathMakefile
More file actions
82 lines (64 loc) · 2.71 KB
/
Copy pathMakefile
File metadata and controls
82 lines (64 loc) · 2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# Variables
DOCKER_COMPOSE_FILE = docker-compose.yml
SERVICE_PREFIX = jeqo-
SERVER_SUFFIX = -server
# Building details
BUILD_OUTPUT = target/*.jar
BUILD_SERVER = dev-server
TARGET_PLUGIN_DIR = dev/plugins/
TARGET_PAPER_DIR = dev-paper/plugins/
# Container lists
CONTAINERS = dev$(SERVER_SUFFIX)
# Grouped containers
SERVER_CONTAINERS = $(foreach container, $(filter %$(SERVER_SUFFIX) %$(PROXY_SUFFIX), $(CONTAINERS)), $(SERVICE_PREFIX)$(container))
# Phony targets
.PHONY: help up up-build down start stop up-servers restart-servers attach bash send-command pbuild
# Help command
help:
@echo "Available commands:"
@echo " up Start all services"
@echo " up-build Build and start all services"
@echo " down Stop all services"
@echo " start Start a specific service"
@echo " stop Stop a specific service"
@echo " up-servers Start all server services"
@echo " restart-servers Restart server services"
@echo " stop-servers Stop all server services"
@echo " attach Attach to a running container. Use CTRL+Q to detach"
@echo " bash Open a bash shell in a running container. Only meant to interact with container infrastructure"
@echo " send-command Send a command to a Jeqo server container"
@echo " pbuild Clean, build, and deploy the plugin, then reload the server"
# General control commands
up:
docker compose -f $(DOCKER_COMPOSE_FILE) up -d
up-build:
docker compose -f $(DOCKER_COMPOSE_FILE) up -d --build
down:
docker compose -f $(DOCKER_COMPOSE_FILE) down
attach:
docker compose -f $(DOCKER_COMPOSE_FILE) attach $(SERVICE_PREFIX)$(container)
bash:
docker compose -f $(DOCKER_COMPOSE_FILE) exec $(SERVICE_PREFIX)$(container) bash
# Individual service control commands
start:
docker compose -f $(DOCKER_COMPOSE_FILE) up -d $(SERVICE_PREFIX)$(service)
stop:
docker compose -f $(DOCKER_COMPOSE_FILE) stop $(SERVICE_PREFIX)$(service)
# Grouped service control commands
up-servers:
docker compose -f $(DOCKER_COMPOSE_FILE) up -d $(SERVER_CONTAINERS)
restart-servers:
docker compose -f $(DOCKER_COMPOSE_FILE) restart $(SERVER_CONTAINERS)
stop-servers:
docker compose -f $(DOCKER_COMPOSE_FILE) stop $(SERVER_CONTAINERS)
# Jeqo related commands
# Note: This only works with actual servers; not proxies
send-command:
docker exec $(SERVICE_PREFIX)$(container) rcon-cli $(command)
pbuild:
mvn clean package
@mkdir -p $(TARGET_PLUGIN_DIR)
@mkdir -p $(TARGET_PAPER_DIR)
find $(BUILD_OUTPUT) -type f ! -name 'original-*' -exec cp {} $(TARGET_PLUGIN_DIR) \;
find $(BUILD_OUTPUT) -type f ! -name 'original-*' -exec cp {} $(TARGET_PAPER_DIR) \;
make send-command container=$(BUILD_SERVER) command="reload confirm"