-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathmake-fly-config
executable file
·76 lines (62 loc) · 1.2 KB
/
make-fly-config
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
#!/bin/bash
#
# Create a fly.toml file to deploy logpaste to fly.io.
# Exit on first error.
set -e
# Treat undefined environment variables as errors.
set -u
print_help() {
cat << EOF
Usage: ${0##*/} [-h] app_name
Creates a fly.toml config file.
app_name: Name of fly.io instance to use.
-h Display this help and exit.
EOF
}
# Parse command-line arguments.
while getopts 'h' opt; do
case "${opt}" in
h)
print_help
exit
;;
*)
print_help >&2
exit 1
esac
done
# Ensure 'app_name' is given.
shift $((OPTIND - 1))
if (( $# == 0 )); then
echo 'Input parameter missing: app_name' >&2
exit 1
fi
readonly APP_NAME="$1"
cat > fly.toml <<EOF
app = "${APP_NAME}"
kill_signal = "SIGINT"
kill_timeout = 5
[env]
PORT = "3001"
LP_BEHIND_PROXY="yes"
[build]
image = "mtlynch/logpaste"
[[services]]
internal_port = 3001
protocol = "tcp"
[services.concurrency]
hard_limit = 25
soft_limit = 20
[[services.ports]]
handlers = ["http"]
port = "80"
[[services.ports]]
handlers = ["tls", "http"]
port = "443"
[[services.tcp_checks]]
grace_period = "1s"
interval = "15s"
port = "3001"
restart_limit = 6
timeout = "2s"
EOF