Repository navigation
install.sh: PostgreSQL + build deps for Linux/WSL2 (#517) - #530
Conversation
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).
There was a problem hiding this comment.
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.
| echo " ⚠️ Could not install build tools. Rust compilation may fail." | ||
| else | ||
| echo " ✅ Build tools: installed" | ||
| fi |
There was a problem hiding this comment.
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.
| 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 |
| 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 || \ |
There was a problem hiding this comment.
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.
| 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 || \ |
| 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 |
There was a problem hiding this comment.
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.
| 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 |
| # 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 |
There was a problem hiding this comment.
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).
| # 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\"" |
| 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 |
There was a problem hiding this comment.
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).
| 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 |
First external user hit walls. Added PostgreSQL auto-install, build-essential, pkg-config, libssl-dev. Creates postgres user automatically.