Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33005987
D5758.1768361794.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D5758.1768361794.diff
View Options
diff --git a/scripts/bin/comm-dev b/scripts/bin/comm-dev
new file mode 100755
--- /dev/null
+++ b/scripts/bin/comm-dev
@@ -0,0 +1,7 @@
+#! /usr/bin/env bash
+
+# This is a command entrypoint so that the majority of the bash
+# code can be linted by shellcheck
+
+PRJ_ROOT=$(git rev-parse --show-toplevel)
+"$PRJ_ROOT"/scripts/comm-dev.sh $@
diff --git a/scripts/comm-dev.sh b/scripts/comm-dev.sh
new file mode 100755
--- /dev/null
+++ b/scripts/comm-dev.sh
@@ -0,0 +1,69 @@
+#! /usr/bin/env bash
+
+# This is an entry for common development workflows like starting and stopping
+# expensive services
+
+set -euo pipefail
+
+COMM_ROOT="$(git rev-parse --show-toplevel)"
+
+log() {
+ echo "$@" >&2
+}
+
+usage() {
+ echo "Comm Development"
+ echo ""
+ echo "Commands:"
+ echo " services - start or stop development services"
+ echo ""
+
+ exit 1
+}
+
+services_usage() {
+ echo "Comm Development Services"
+ echo ""
+ echo "Commands:"
+ echo " restart - restart services"
+ echo " start - start rabbitmq"
+ echo " stop - stop rabbitmq"
+ echo ""
+
+ exit 1
+}
+
+services_command() {
+ case "$1" in
+ restart)
+ "$0" services stop || true
+ "$0" services start
+ ;;
+ start)
+ nix run "$COMM_ROOT"#rabbitmq-up
+ ;;
+ stop)
+ log "Stopping services"
+ pkill rabbitmq-server beam.smp
+ ;;
+ *)
+ log "$(basename "$0"): unknown services option '$1'"
+ services_usage
+ exit 1
+ ;;
+ esac
+}
+
+case "$1" in
+ -h|--help)
+ usage
+ ;;
+ services)
+ shift
+ services_command "$@"
+ ;;
+ *)
+ log "$(basename "$0"): unknown option '$1'"
+ usage
+ ;;
+esac
diff --git a/scripts/source_development_defaults.sh b/scripts/source_development_defaults.sh
--- a/scripts/source_development_defaults.sh
+++ b/scripts/source_development_defaults.sh
@@ -32,6 +32,10 @@
export PATH="$PATH":./node_modules/.bin
+# Development helpers
+PRJ_ROOT="$(git rev-parse --show-toplevel)"
+export PATH="$PATH":${PRJ_ROOT}/scripts/bin
+
# mysql2 package wants stable prefixes for temporary directory paths
# 'nix develop' will set TMP and related variables to something different each
# invocation
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jan 14, 3:36 AM (33 m, 48 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5930174
Default Alt Text
D5758.1768361794.diff (2 KB)
Attached To
Mode
D5758: [Nix] Add script to start/stop tunnelbroker services
Attached
Detach File
Event Timeline
Log In to Comment