-
Notifications
You must be signed in to change notification settings - Fork 1
/
task
executable file
·108 lines (91 loc) · 1.99 KB
/
task
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/usr/bin/env bash
set -e
cd "$(dirname "${BASH_SOURCE[0]}")"
source config.sh
server () {
ssh root@$SERVER "$@"
}
trench () {
server trench -p 7888 -e "$@"
}
install-tailwind () {
echo Downloading the latest version of Tailwind CSS...
curl -LO https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-$TAILWIND_BUILD
mkdir -p bin
mv tailwindcss-$TAILWIND_BUILD bin/tailwindcss
chmod +x bin/tailwindcss
}
run () {
mkdir -p target/resources
clj "$@" \
-J-XX:-OmitStackTraceInFastThrow \
-M -m $MAIN_NS --port 7888 --middleware '[cider.nrepl/cider-middleware]'
}
dev () {
if ! [ -x bin/tailwindcss ]; then
install-tailwind
fi
echo 7888 > .nrepl-port
BIFF_ENV=dev run
}
format () {
clj -M:format
}
clean () {
rm -rf target
}
post-receive () {
run -P
sudo systemctl reset-failed app.service
sudo systemctl restart app
}
deploy () {
chmod 600 config.*
rsync -a config.* app@$SERVER:
time git push $DEPLOY_TO $DEPLOY_FROM
}
soft-deploy () {
chmod 600 config.*
rsync -a --info=name1 --delete \
config.* \
deps.edn \
task \
src \
resources \
app@$SERVER:
trench '"('$SOFT_DEPLOY_FN' @com.biffweb/system)"'
}
refresh () {
trench '"(com.biffweb/refresh)"'
}
restart () {
server systemctl reset-failed app.service
server systemctl restart app
}
auto-soft-deploy () {
soft-deploy
fswatch -orl 0.1 --event=Updated --event=Removed . | while read changed ; do
soft-deploy
done
}
logs () {
ssh root@$SERVER journalctl -u app -f -n ${1:-300}
}
prod-repl () {
echo Connect to nrepl port 7888
echo 7888 > .nrepl-port
ssh -NL 7888:localhost:7888 root@$SERVER
}
prod-dev () {
if ! which fswatch > /dev/null; then
echo '`fswatch` command not found. Please install it: https://emcrisostomo.github.io/fswatch/getting.html'
echo ' - Ubuntu: sudo apt install fswatch'
echo ' - Mac: brew install fswatch'
exit 1
fi
trap 'kill %1; kill %2' SIGINT
prod-repl &
auto-soft-deploy &
logs
}
"$@"