-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap
executable file
·75 lines (61 loc) · 1.34 KB
/
bootstrap
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
#!/bin/bash
BOOTSTRAP_STAGE="local"
BOOTSTRAP_DIR=$(dirname $0)
BOOTSTRAP_DOCKER_COMPOSE_FILE="$BOOTSTRAP_DIR/$BOOTSTRAP_STAGE/docker-compose.yml"
welcome() {
echo "Welcome to the Arrêt bootstrap script!"
echo "Stage: $BOOTSTRAP_STAGE"
echo ""
}
setup_containers() {
echo "Building and starting containers..."
docker compose -f $BOOTSTRAP_DOCKER_COMPOSE_FILE build
docker compose -f $BOOTSTRAP_DOCKER_COMPOSE_FILE up -d
}
shutdown_containers() {
docker compose -f $BOOTSTRAP_DOCKER_COMPOSE_FILE down
}
test() {
echo "Running tests..."
echo ""
# Clear redis
redis-cli flushall > /dev/null
# Run tests
cargo test --features aio
}
benchmark() {
echo "Running benchmarks..."
echo ""
# Clear redis
redis-cli flushall > /dev/null
# Run benchmarks
cargo bench --features aio
}
usage() {
echo "Usage: $0 [OPTIONS]"
echo ""
echo "Options:"
echo " up Start the containers"
echo " down Stop the containers"
echo " test Run the tests"
echo " bench Run the benchmarks"
echo " help Show this help message"
echo ""
}
main() {
welcome
if [ $1 == "up" ]; then
setup_containers
elif [ $1 == "down" ]; then
shutdown_containers
elif [ $1 == "test" ]; then
test
elif [ $1 == "bench" ]; then
benchmark
elif [ $1 == "help" ]; then
usage
else
usage
fi
}
main $@