Skip to content

Commit f58d986

Browse files
authored
Harden bootstrap procedure (#130)
1 parent fa2fbde commit f58d986

3 files changed

Lines changed: 26 additions & 2 deletions

File tree

collector/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ RUN mkdir -p /versions/0-default \
4646
# Set environment variables
4747
ENV BASE_URL=https://telemetry.betterstack.com
4848
ENV CLUSTER_COLLECTOR=false
49-
ENV COLLECTOR_VERSION=1.1.24
49+
ENV COLLECTOR_VERSION=1.1.25
5050
ENV VECTOR_VERSION=0.47.0
5151
ENV OBI_VERSION=0.4.1
5252
ENV CLUSTER_AGENT_VERSION=1.2.4

collector/run_supervisord.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,24 @@ set -e
66
SUPERVISORD_CONF="/var/lib/better-stack/collector/supervisord.conf"
77
BOOTSTRAP_CONF="/bootstrap/supervisord.conf"
88

9+
NEEDS_BOOTSTRAP=false
10+
COLLECTOR_DIR="/var/lib/better-stack/collector"
11+
912
if [ ! -f "$SUPERVISORD_CONF" ]; then
10-
echo "Supervisord config not found at $SUPERVISORD_CONF, copying from bootstrap..."
13+
echo "Supervisord config not found at $SUPERVISORD_CONF"
14+
NEEDS_BOOTSTRAP=true
15+
else
16+
for required_file in "$COLLECTOR_DIR/vector.sh" "$COLLECTOR_DIR/updater.rb" "$COLLECTOR_DIR/proxy.rb"; do
17+
if [ ! -f "$required_file" ]; then
18+
echo "Incomplete install detected: $required_file is missing"
19+
NEEDS_BOOTSTRAP=true
20+
break
21+
fi
22+
done
23+
fi
24+
25+
if [ "$NEEDS_BOOTSTRAP" = true ]; then
26+
echo "Copying bootstrap supervisord config to $SUPERVISORD_CONF..."
1127
mkdir -p "$(dirname "$SUPERVISORD_CONF")"
1228
cp "$BOOTSTRAP_CONF" "$SUPERVISORD_CONF"
1329
echo "Copied bootstrap supervisord config to $SUPERVISORD_CONF"

install.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,14 @@ if [ -n "$SWARM_CONTAINER" ]; then
8787
exit 1
8888
fi
8989

90+
# Warn about existing data directory
91+
COLLECTOR_DATA_DIR="/var/lib/better-stack"
92+
if [ -d "$COLLECTOR_DATA_DIR" ]; then
93+
echo "WARNING: $COLLECTOR_DATA_DIR already exists from a previous installation."
94+
echo "This is expected during upgrades. If you're fully reinstalling the collector, delete the directory first:"
95+
echo " rm -rf $COLLECTOR_DATA_DIR"
96+
fi
97+
9098
# Create temporary directory and cd into it
9199
TEMP_DIR=$(mktemp -d)
92100
cd "$TEMP_DIR"

0 commit comments

Comments
 (0)