Sha256: e148dbe81d67f83b423437f044e131a98c4b97548aff28b26d3da02dcaaf08fd

Contents?: true

Size: 852 Bytes

Versions: 3

Compression:

Stored size: 852 Bytes

Contents

#!/usr/bin/env zsh

set -eu

die() { echo "$0: $*" 1>&2 ; false; }

root_dir="$(dirname $(dirname "$0:A"))"
pid_file="$root_dir/tmp/cockroach.pid"
log_file="$root_dir/tmp/cockroachdb.log"

mkdir -p "$root_dir/tmp"
[[ -f "$pid_file" ]] && kill -9 $(cat "$pid_file") || true
rm -f "$pid_file"

if ! (( ${+commands[cockroach]} )); then
	die 'the `cockroach` toolchain is not installed.
See https://www.cockroachlabs.com/docs/stable/install-cockroachdb.html'
fi

cockroach start-single-node \
	--insecure --store=type=mem,size=0.25 --advertise-addr=localhost \
	--spatial-libs="$(geos-config --includes)" \
	--pid-file "$pid_file" \
	&> "$log_file" &

until [[ -f "$pid_file" ]]; do
	sleep 1
done


cat "$root_dir/setup.sql" | cockroach sql --insecure --host=localhost:26257 > /dev/null

echo "CockroachDB started. PID: $(cat "$pid_file"). log: $log_file"

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
activerecord-cockroachdb-adapter-8.0.0 bin/start-cockroachdb
activerecord-cockroachdb-adapter-7.2.0 bin/start-cockroachdb
activerecord-cockroachdb-adapter-7.1.1 bin/start-cockroachdb