comparison mrjunejune/deploy.sh @ 269:de291f396881

install initial production config Copy the ignored repository config into /etc/mrjunejune on first deployment while preserving existing production configuration on later deploys. Co-authored-by: Copilot <[email protected]>
author MrJuneJune <me@mrjunejune.com>
date Fri, 07 Aug 2026 13:08:10 -0700
parents f7b1188d5fb1
children 358dd5950985
comparison
equal deleted inserted replaced
268:f7b1188d5fb1 269:de291f396881
4 bazel build -c opt //mrjunejune:mrjunejune_server_bundle 4 bazel build -c opt //mrjunejune:mrjunejune_server_bundle
5 5
6 bundle="$(realpath bazel-bin/mrjunejune/mrjunejune_server_bundle)" 6 bundle="$(realpath bazel-bin/mrjunejune/mrjunejune_server_bundle)"
7 staging="/opt/mrjunejune_server_bundle_new" 7 staging="/opt/mrjunejune_server_bundle_new"
8 active="/opt/mrjunejune_server_bundle_active" 8 active="/opt/mrjunejune_server_bundle_active"
9 source_config="$(pwd)/mrjunejune/.config"
10 production_config="/etc/mrjunejune/.config"
11
12 # The real config is ignored and intentionally excluded from the immutable
13 # bundle. Install it once into the service-owned system location; preserve the
14 # existing production config on subsequent deployments.
15 if ! sudo test -f "$production_config"; then
16 if [[ ! -f "$source_config" ]]; then
17 echo "Missing initial config: $source_config" >&2
18 exit 1
19 fi
20 sudo install -d -o mrjunejune_server -g zenbu_team -m 0750 \
21 "$(dirname "$production_config")"
22 sudo install -o mrjunejune_server -g zenbu_team -m 0640 \
23 "$source_config" "$production_config"
24 echo "Installed initial production config at $production_config"
25 fi
9 26
10 # Always create staging from an empty directory. Copying into an existing 27 # Always create staging from an empty directory. Copying into an existing
11 # directory nests the bundle and can promote stale/incomplete runtime files. 28 # directory nests the bundle and can promote stale/incomplete runtime files.
12 sudo rm -rf "$staging" 29 sudo rm -rf "$staging"
13 sudo mkdir -p "$staging" 30 sudo mkdir -p "$staging"