-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjustfile
94 lines (71 loc) · 2.39 KB
/
justfile
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
83
84
85
86
87
88
89
90
91
92
93
94
set dotenv-load
set positional-arguments
project := env_var('PROJECT_NAME')
cnf := replace_regex('[client]
user=$MARIADB_USER
password=$MARIADB_PASSWORD
[clientroot]
user=root
password=$MARIADB_ROOT_PASSWORD
[MYSQL]
database=$MARIADB_DATABASE', '[\n]', "\\\\n")
dump_options := '--defaults-group-suffix=root --hex-blob --net-buffer-length 100K --routines --databases $MARIADB_DATABASE'
# List available recipes.
help:
just -lu
# Start all containers. Accepts arguments like `-d` to start in background.
up *args='':
docker compose up $@
# Stop all containers.
down:
docker compose down
# Build the server image.
build:
docker compose build
# Start and recreate containers.
reload:
docker compose up -d --force-recreate
# Refresh leaderboard cache.
cache:
docker exec -u www-data -ti {{project}}-server curl -Lk localhost/api/refreshCache.php
# Fetch new scores from Steam.
update:
docker exec -u www-data -ti {{project}}-server curl -Lk localhost/api/fetchNewScores.php
# Update Steam profiles.
update-profiles:
docker exec -u www-data -ti {{project}}-server php -f /var/www/html/util/fetchImportantProfileData.php
# Open shell in server container.
server-debug:
docker exec -u www-data -ti {{project}}-server bash
# Open shell in server container.
debug: server-debug
# Open shell in server container as root user.
root:
docker exec -u root -ti {{project}}-server bash
# Restart server container.
server-restart:
docker container restart {{project}}-server
# Stop server container.
server-stop:
docker container stop {{project}}-server
# Run server tests.
test *args='':
./test $@
# Connect to database.
db:
docker exec -ti {{project}}-db bash -c 'printf {{cnf}} > /etc/my.cnf' && docker exec -ti {{project}}-db mariadb
# Open shell in database container.
db-debug:
docker exec -ti {{project}}-db bash
# Restart database container.
db-restart:
docker container restart {{project}}-db
# Stop database container.
db-stop:
docker container stop {{project}}-db
# Dump and compress a backup of the database.
db-dump:
docker exec -ti {{project}}-db bash -c 'mariadb-dump {{dump_options}} | gzip -8 > /backups/${MARIADB_DATABASE}_dump_$(date +%Y-%m-%d-%H.%M.%S).sql.gz'
# Only dump a backup of the database.
db-dump-raw:
docker exec -ti {{project}}-db bash -c 'mariadb-dump {{dump_options}} > /backups/${MARIADB_DATABASE}_dump_$(date +%Y-%m-%d-%H.%M.%S).sql'