Mercurial
comparison mrjunejune/deploy.sh @ 270:358dd5950985
sync production config on every deploy
Always install the ignored repository .config into /etc/mrjunejune before promoting the new bundle.
Co-authored-by: Copilot <[email protected]>
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Fri, 07 Aug 2026 13:16:47 -0700 |
| parents | de291f396881 |
| children |
comparison
equal
deleted
inserted
replaced
| 269:de291f396881 | 270:358dd5950985 |
|---|---|
| 8 active="/opt/mrjunejune_server_bundle_active" | 8 active="/opt/mrjunejune_server_bundle_active" |
| 9 source_config="$(pwd)/mrjunejune/.config" | 9 source_config="$(pwd)/mrjunejune/.config" |
| 10 production_config="/etc/mrjunejune/.config" | 10 production_config="/etc/mrjunejune/.config" |
| 11 | 11 |
| 12 # The real config is ignored and intentionally excluded from the immutable | 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 | 13 # bundle. Synchronize the repository's service config on every deployment. |
| 14 # existing production config on subsequent deployments. | 14 if [[ ! -f "$source_config" ]]; then |
| 15 if ! sudo test -f "$production_config"; then | 15 echo "Missing deployment config: $source_config" >&2 |
| 16 if [[ ! -f "$source_config" ]]; then | 16 exit 1 |
| 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 | 17 fi |
| 18 sudo install -d -o mrjunejune_server -g zenbu_team -m 0750 \ | |
| 19 "$(dirname "$production_config")" | |
| 20 sudo install -o mrjunejune_server -g zenbu_team -m 0640 \ | |
| 21 "$source_config" "$production_config" | |
| 22 echo "Updated production config at $production_config" | |
| 26 | 23 |
| 27 # Always create staging from an empty directory. Copying into an existing | 24 # Always create staging from an empty directory. Copying into an existing |
| 28 # directory nests the bundle and can promote stale/incomplete runtime files. | 25 # directory nests the bundle and can promote stale/incomplete runtime files. |
| 29 sudo rm -rf "$staging" | 26 sudo rm -rf "$staging" |
| 30 sudo mkdir -p "$staging" | 27 sudo mkdir -p "$staging" |