summaryrefslogtreecommitdiff
path: root/x
blob: 88b745b2073a2a8feb611264a5f9aba183b924e8 (plain)
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
#!/usr/bin/env bash

set -e

DOCKER_COMPOSE="docker compose -f docker/compose.yaml"

help() {
    cat <<EOF
Usage: ./x <command>

Commands:
    start      Build with gradlew and start docker compose
    restart    Restart minecraft and velocity containers
    stop       Stop docker compose
    clean      Stop docker compose and remove volumes
    rcon       Open rcon-cli for minecraft container
    logs       Show minecraft container logs
    vlogs      Show velocity container logs
    help       Show this help message

EOF
}

case "${1:-}" in
    start)
        ./gradlew :platform-paper:clean :platform-paper:shadowJar :platform-velocity:clean :platform-velocity:shadowJar
        $DOCKER_COMPOSE up
        ;;
    restart)
        $DOCKER_COMPOSE restart minecraft velocity
        ;;
    stop)
        $DOCKER_COMPOSE down
        ;;
    clean)
        $DOCKER_COMPOSE down -v
        ;;
    rcon)
        $DOCKER_COMPOSE exec minecraft rcon-cli
        ;;
    logs)
        $DOCKER_COMPOSE logs -f minecraft
        ;;
    vlogs)
        $DOCKER_COMPOSE logs -f velocity
        ;;
    help|"")
        help
        ;;
    *)
        echo "Unknown command: $1"
        echo ""
        help
        exit 1
        ;;
esac