-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev.sh
More file actions
executable file
·38 lines (29 loc) · 784 Bytes
/
dev.sh
File metadata and controls
executable file
·38 lines (29 loc) · 784 Bytes
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
#!/bin/bash
shopt -s huponexit # make sure children get SIGHUP when the script exits
# Cleanup function to stop and remove containers
cleanup () {
(podman-compose down -t 0 || true)
}
# run cleanup on Ctrl-C (INT), kill/TERM, any error (ERR) or a normal EXIT
trap cleanup INT TERM ERR EXIT
# Get the example script from the argument
if [ -z "$1" ]; then
echo "Usage: $0 <examples/demo.sql>"
exit 1
fi
# Build extension
cargo pgrx package -d
if [ $? -ne 0 ]; then
echo "Failed to build the extension"
exit 1
fi
# Copy the example script to the dev directory so it gets mounted
cp "$1" dev/dev.sql
podman-compose build
if [ $? -ne 0 ]; then
echo "Failed to build the containers"
exit 1
fi
sleep 1
podman-compose up
# Ctrl+C to stop the containers, should cleanup