From ba6f32958d6e239eca4716d9021eee4658280b8e Mon Sep 17 00:00:00 2001 From: Daniel Schultz Date: Wed, 18 Feb 2026 11:18:11 -0500 Subject: [PATCH 1/3] Set up psql log rotation I noticed the psql log files were pretty darn large (1.5GB) so I want to be better about log rotation --- newsyslog/install.sh | 29 ++++++++++++++++++++ newsyslog/postgresql.conf | 2 ++ postgresql/conf.d/logging.conf | 17 ++++++++++++ postgresql/install.sh | 50 ++++++++++++++++++++++++++++++++-- 4 files changed, 96 insertions(+), 2 deletions(-) create mode 100644 newsyslog/install.sh create mode 100644 newsyslog/postgresql.conf create mode 100644 postgresql/conf.d/logging.conf diff --git a/newsyslog/install.sh b/newsyslog/install.sh new file mode 100644 index 0000000..3ca8ff4 --- /dev/null +++ b/newsyslog/install.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +set -e +source ~/.dotfiles/lib/functions.sh + +NEWSYSLOG_D="/etc/newsyslog.d" +DOTFILES_NEWSYSLOG=~/.dotfiles/newsyslog + +check_exists "$NEWSYSLOG_D" + +info "Configuring newsyslog" + +for conf_file in "$DOTFILES_NEWSYSLOG"/*.conf; do + filename="$(basename "$conf_file")" + target="${NEWSYSLOG_D}/${filename}" + + if [ -L "$target" ]; then + info "${filename} already symlinked" + else + if [ -e "$target" ]; then + warn "${filename} exists and is not a symlink, backing up" + sudo mv "$target" "${target}.backup" + fi + info "Symlinking ${filename} (requires sudo)" + sudo ln -s "$conf_file" "$target" + success "Symlinked ${filename}" + fi +done + +success "newsyslog configured" diff --git a/newsyslog/postgresql.conf b/newsyslog/postgresql.conf new file mode 100644 index 0000000..53b245f --- /dev/null +++ b/newsyslog/postgresql.conf @@ -0,0 +1,2 @@ +# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num] +/opt/homebrew/var/log/postgresql@14.log 644 2 51200 * JN diff --git a/postgresql/conf.d/logging.conf b/postgresql/conf.d/logging.conf new file mode 100644 index 0000000..7e8962c --- /dev/null +++ b/postgresql/conf.d/logging.conf @@ -0,0 +1,17 @@ +# Enable the logging collector (required for log rotation) +logging_collector = on + +# Log directory (relative to data directory) +log_directory = 'log' + +# Use day-of-week filenames so logs cycle weekly +log_filename = 'postgresql-%a.log' + +# Rotate log files when they reach 50MB +log_rotation_size = 50MB + +# Also rotate daily +log_rotation_age = 1d + +# Overwrite same-named log files from previous weeks +log_truncate_on_rotation = on diff --git a/postgresql/install.sh b/postgresql/install.sh index f6f8260..8eb9f29 100755 --- a/postgresql/install.sh +++ b/postgresql/install.sh @@ -4,12 +4,58 @@ source ~/.dotfiles/lib/functions.sh check_command brew +# Determine the PostgreSQL data directory +PG_DATA="$(brew --prefix)/var/postgres" +PG_CONF="${PG_DATA}/postgresql.conf" +CONF_D="${PG_DATA}/conf.d" +DOTFILES_CONF_D=~/.dotfiles/postgresql/conf.d + +check_exists "$PG_CONF" + +# Set up conf.d include directory +info "Configuring PostgreSQL conf.d" + +if [ ! -d "$CONF_D" ]; then + mkdir -p "$CONF_D" + success "Created ${CONF_D}" +fi + +# Enable include_dir in postgresql.conf if not already enabled +if ! grep -q "^include_dir = 'conf.d'" "$PG_CONF"; then + info "Enabling conf.d include directory in postgresql.conf" + echo "" >> "$PG_CONF" + echo "include_dir = 'conf.d'" >> "$PG_CONF" + success "Enabled conf.d include directory" +else + info "conf.d include directory already enabled" +fi + +# Symlink config files from dotfiles conf.d into the PostgreSQL conf.d +for conf_file in "$DOTFILES_CONF_D"/*.conf; do + filename="$(basename "$conf_file")" + target="${CONF_D}/${filename}" + + if [ -L "$target" ]; then + info "${filename} already symlinked" + else + if [ -e "$target" ]; then + warn "${filename} exists and is not a symlink, backing up" + mv "$target" "${target}.backup" + fi + ln -s "$conf_file" "$target" + success "Symlinked ${filename}" + fi +done + +# Start (or restart) PostgreSQL to pick up config changes info "Starting PostgreSQL service" if brew services start postgresql; then success "PostgreSQL service started" else - warn "PostgreSQL service may already be running" + warn "PostgreSQL service may already be running, restarting" + brew services restart postgresql + success "PostgreSQL service restarted" fi # Since I always come here when psql is not working as expected @@ -18,7 +64,7 @@ fi # brew services restart -v postgresql # brew services info -a # brew postgresql-upgrade-database -# tail /opt/homebrew/var/log/postgres.log +# tail /opt/homebrew/var/postgres/log/ # # If the postmaster.pid exists when it shouldn't (e.g. forced reboot) # its location will be /opt/homebrew/var/postgres/postmaster.pid From 56653e8263b07b0d7b285059327d29f49fcfc883 Mon Sep 17 00:00:00 2001 From: Daniel Schultz Date: Sat, 23 May 2026 10:20:38 -0400 Subject: [PATCH 2/3] Improve git settings --- claude/config/settings.json | 3 ++- git/gitconfig.symlink | 1 + git/gitignore.symlink | 2 ++ system/path.zsh | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/claude/config/settings.json b/claude/config/settings.json index e889b23..281781a 100644 --- a/claude/config/settings.json +++ b/claude/config/settings.json @@ -5,7 +5,8 @@ "Bash(npm run test)", "Bash(npm run lint)", "Bash(npm run build)", - "Bash(gh issue view*)" + "Bash(gh issue view*)", + "Bash(gh pr view*)" ], "deny": ["Bash(sed *)"] } diff --git a/git/gitconfig.symlink b/git/gitconfig.symlink index cecc514..31052a2 100644 --- a/git/gitconfig.symlink +++ b/git/gitconfig.symlink @@ -35,6 +35,7 @@ cremit = commit --reedit-message=HEAD sync = "!f() { remote=\"${GIT_UPSTREAM_NAME:-upstream}\"; branch=\"$(git rev-parse --abbrev-ref HEAD)\"; if [ \"$branch\" != \"main\" ] && [ \"$branch\" != \"master\" ]; then echo \"Error: Must be on main or master branch (currently on $branch)\"; return 1; fi; git fetch \"$remote\" --tags || return 1; if [ -n \"$1\" ]; then ref=\"$1\"; sync_branch=\"sync/${ref}\"; else git remote set-head \"$remote\" --auto 2>/dev/null; upstream_branch=\"$(git symbolic-ref \"refs/remotes/$remote/HEAD\" 2>/dev/null | sed \"s|refs/remotes/$remote/||\")\" || { echo \"Error: Could not determine default branch for $remote\"; return 1; }; ref=\"$remote/$upstream_branch\"; sync_branch=\"sync/$(date +%s)-${upstream_branch}\"; fi; git checkout -b \"$sync_branch\" && git merge \"$ref\" -m \"Merge upstream ${ref}\"; }; f" fpush = push --force-with-lease + track = !git branch --set-upstream-to=origin/$(git symbolic-ref --short HEAD) [pull] default = current rebase = true diff --git a/git/gitignore.symlink b/git/gitignore.symlink index 22b0347..65f6f33 100644 --- a/git/gitignore.symlink +++ b/git/gitignore.symlink @@ -56,3 +56,5 @@ venv ########################## .claude CLAUDE.md +CLAUDE.local.md +agents.local.md diff --git a/system/path.zsh b/system/path.zsh index 8182e2b..facf272 100644 --- a/system/path.zsh +++ b/system/path.zsh @@ -1 +1 @@ -export PATH="$HOME/bin:$PATH" +export PATH="$HOME/.local/bin:$HOME/bin:$PATH" From c7e157b8f6c46146617ed71d19731e812dc8ec08 Mon Sep 17 00:00:00 2001 From: Daniel Schultz Date: Sat, 23 May 2026 10:52:00 -0400 Subject: [PATCH 3/3] Fix iterm preferences --- iterm/install.sh | 12 ++++++++++++ iterm/profiles/Default.json | 3 +-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/iterm/install.sh b/iterm/install.sh index ed4be26..9af7774 100755 --- a/iterm/install.sh +++ b/iterm/install.sh @@ -24,8 +24,20 @@ printf "\e[32mConfiguring iTerm2\e[0m\n" # ============================================================================== # 1. Disable preference sync folder (if previously enabled) # ============================================================================== +# iTerm2 rewrites its preferences from in-memory state on quit, which will +# clobber any `defaults write` we do here. If iTerm2 is running, warn the +# user — the settings below will only stick after a clean quit and relaunch. +if pgrep -xq iTerm2; then + printf "\e[33m⚠️ iTerm2 is currently running.\e[0m\n" + printf "\e[33m It will overwrite these preferences on quit.\e[0m\n" + printf "\e[33m Quit iTerm2 completely, then re-run this script.\e[0m\n" +fi + info "Disabling plist sync folder..." defaults write com.googlecode.iterm2 "LoadPrefsFromCustomFolder" -bool false +# Clear the stale custom folder path so iTerm2 doesn't complain about a +# missing/malformed directory on next launch. +defaults delete com.googlecode.iterm2 "PrefsCustomFolder" 2> /dev/null || true # ============================================================================== # 2. Set up Dynamic Profiles diff --git a/iterm/profiles/Default.json b/iterm/profiles/Default.json index 37e5f6f..e0eb21e 100644 --- a/iterm/profiles/Default.json +++ b/iterm/profiles/Default.json @@ -1,9 +1,8 @@ { "Profiles": [ { - "Name": "Default", + "Name": "Dotfiles Default", "Guid": "dotfiles-default-profile", - "Dynamic Profile Parent Name": "Default", "Working Directory": "~", "Custom Directory": "Recycle",