Skip to content

install.sh: PostgreSQL + build deps for Linux/WSL2 (#517) - #530

Merged
joelteply merged 1 commit into
mainfrom
fix/install-postgres-build-deps
Mar 26, 2026
Merged

joelteply merged 1 commit into
mainfrom
fix/install-postgres-build-deps

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

First external user hit walls. Added PostgreSQL auto-install, build-essential, pkg-config, libssl-dev. Creates postgres user automatically.

First external user hit walls on WSL2. Missing:
- build-essential, pkg-config, libssl-dev (Rust native deps)
- PostgreSQL (the ORM needs it, was never auto-installed)
- Auto-creates postgres user and database for the current user

Contributes to #517 (onboarding crisis).
Copilot AI review requested due to automatic review settings March 26, 2026 16:16
@joelteply
joelteply merged commit 6e49881 into main Mar 26, 2026
@joelteply
joelteply deleted the fix/install-postgres-build-deps branch March 26, 2026 16:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the root install.sh bootstrap installer to reduce first-run friction for new Linux/WSL2 users by proactively installing build dependencies (for Rust/native compilation) and PostgreSQL.

Changes:

  • Add Linux build tool installation (build-essential/pkg-config/OpenSSL headers).
  • Add PostgreSQL installation/startup logic for macOS (Homebrew) and Linux (apt/dnf), including auto user/db creation.
  • Print PostgreSQL version (or a manual install hint) after attempting setup.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread install.sh
echo " ⚠️ Could not install build tools. Rust compilation may fail."
else
echo " ✅ Build tools: installed"
fi

Copilot AI Mar 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build-deps gate only checks for gcc/g++/make/pkg-config, but libssl-dev is only installed when those tools are missing. If build tools are already present but OpenSSL headers aren’t, Rust crates that link against OpenSSL will still fail to compile. Consider checking for OpenSSL dev headers explicitly (e.g., via pkg-config --exists openssl or header presence) and installing the dev package when missing, independent of the compiler toolchain check.

Suggested change
fi
fi
# Ensure OpenSSL development headers are available for Rust crates using OpenSSL
if command -v pkg-config &>/dev/null; then
if ! pkg-config --exists openssl 2>/dev/null; then
echo " 📦 Installing OpenSSL development headers..."
sudo apt-get install -y libssl-dev 2>/dev/null || \
sudo dnf install -y openssl-devel 2>/dev/null || \
echo " ⚠️ Could not install OpenSSL dev package. Rust crates using OpenSSL may fail to compile."
fi
fi

Copilot uses AI. Check for mistakes.
Comment thread install.sh
if [ "$NEED_BUILD_DEPS" = true ]; then
echo " 📦 Installing build essentials..."
sudo apt-get install -y build-essential pkg-config libssl-dev 2>/dev/null || \
sudo dnf groupinstall -y "Development Tools" 2>/dev/null || \

Copilot AI Mar 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the dnf branch, groupinstall "Development Tools" may not provide the specific packages you’re later assuming (notably pkg-config and OpenSSL development headers). To make this reliable on Fedora/RHEL, install the explicit packages as well (e.g., pkgconf-pkg-config and openssl-devel, plus compiler toolchain if needed) instead of relying only on the group.

Suggested change
sudo dnf groupinstall -y "Development Tools" 2>/dev/null || \
sudo dnf install -y @"Development Tools" gcc gcc-c++ make pkgconf-pkg-config openssl-devel 2>/dev/null || \

Copilot uses AI. Check for mistakes.
Comment thread install.sh
brew install postgresql@16 2>/dev/null && brew services start postgresql@16 2>/dev/null
elif [ "$IS_LINUX" = true ]; then
sudo apt-get install -y postgresql postgresql-contrib 2>/dev/null || \
sudo dnf install -y postgresql-server postgresql-contrib 2>/dev/null

Copilot AI Mar 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For dnf install postgresql-server ..., the database typically isn’t initialized until postgresql-setup --initdb (or distro equivalent) is run. As written, systemctl start postgresql will commonly fail on Fedora/RHEL, and the following createuser/createdb will be no-ops (hidden by || true). Consider initializing the cluster and enabling/starting the service in the dnf path so the install is actually usable.

Suggested change
sudo dnf install -y postgresql-server postgresql-contrib 2>/dev/null
sudo dnf install -y postgresql-server postgresql-contrib 2>/dev/null
# Initialize and enable PostgreSQL service where postgresql-setup is available (e.g., Fedora/RHEL)
if command -v postgresql-setup &>/dev/null; then
sudo postgresql-setup --initdb 2>/dev/null || true
sudo systemctl enable postgresql 2>/dev/null || true
fi

Copilot uses AI. Check for mistakes.
Comment thread install.sh
Comment on lines +127 to +129
# Create user if needed (non-fatal — user may need to configure manually)
sudo -u postgres createuser --superuser "$USER" 2>/dev/null || true
sudo -u postgres createdb "$USER" 2>/dev/null || true

Copilot AI Mar 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

createuser --superuser "$USER" grants superuser privileges to the invoking OS user. That’s a risky default for a bootstrap script (especially if run as root, or on shared machines). Prefer creating a dedicated least-privilege role/database for the app, or create a normal role with only the privileges Continuum needs (and print manual instructions instead of silently elevating).

Suggested change
# Create user if needed (non-fatal — user may need to configure manually)
sudo -u postgres createuser --superuser "$USER" 2>/dev/null || true
sudo -u postgres createdb "$USER" 2>/dev/null || true
# For security, we do not automatically create or elevate a PostgreSQL user here.
# You may need to create a role and database manually for Continuum if not already present.
echo " ℹ️ PostgreSQL installed. You may need to create a database/user for Continuum."
echo " Example (as postgres): createuser --createdb \"$USER\" && createdb \"$USER\""

Copilot uses AI. Check for mistakes.
Comment thread install.sh
if ! command -v psql &>/dev/null; then
echo " 📦 Installing PostgreSQL..."
if [ "$IS_MAC" = true ]; then
brew install postgresql@16 2>/dev/null && brew services start postgresql@16 2>/dev/null

Copilot AI Mar 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The macOS PostgreSQL install/start commands redirect stderr to /dev/null and don’t emit a failure message. With set -e, a brew failure will exit the whole installer but the user won’t see why. Consider reusing install_pkg/adding explicit error handling so failures surface with a clear message (and avoid suppressing stderr unless you also print a helpful summary).

Suggested change
brew install postgresql@16 2>/dev/null && brew services start postgresql@16 2>/dev/null
if ! brew install postgresql@16; then
echo " ❌ Failed to install PostgreSQL via Homebrew. Please check your Homebrew setup and try again."
exit 1
fi
if ! brew services start postgresql@16; then
echo " ⚠️ PostgreSQL installed but failed to start via 'brew services'. You may need to start it manually."
fi

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants