Skip to content

Workspace Startup Customization

This guide explains how to customize your workspace environment using configuration files in your home directory and the shared project directory.

Workspaces can be customized at two levels:

  • Personal customization - Files in your home directory (/home/web) that affect only your workspace
  • Project-wide customization - Files in the shared directory (/shared) that affect all workspaces in the project

When you connect to a workspace via SSH, your shell environment is configured through several files that are sourced in sequence:

  1. Shared Profile - /shared/.profile (if it exists)
  2. Shared Bash Config - /shared/.bashrc (if it exists)
  3. User Home Files - ~/.bashrc and ~/.workspacerc are sourced

This layered approach allows project-wide defaults to be set in /shared, which can then be overridden or extended in your personal home directory files.

Files in your home directory (/home/web) allow you to customize your personal workspace environment.

Standard bash configuration file, sourced for interactive shells.

Custom initialization file specifically for workspace customization. Sourced on session start.

Standard shell profile file, sourced for login shells.

The shared directory (/shared) is shared across all workspaces in a project. Files here affect everyone on the team.

Sourced automatically on every SSH session for all users in the project.

Sourced for bash users on every SSH session.

This directory is automatically added to $PATH. Place executable scripts here to make them available to all workspaces.

Scripts in this directory run once when the workspace container starts, as your user. This is useful for initializing the workspace environment.

Understanding the order in which files are sourced helps you organize your configuration:

  1. /shared/.profile - Project-wide defaults
  2. /shared/.bashrc - Project-wide bash configuration
  3. ~/.bashrc - Personal bash configuration
  4. ~/.workspacerc - Personal workspace configuration

Later files can override settings from earlier files. For example:

Terminal window
# /shared/.profile sets a default
export API_URL="https://api.staging.example.com"
# ~/.workspacerc can override it
export API_URL="https://api.local.example.com"
  1. Use /shared/ for team conventions - Aliases, functions, and environment variables that everyone should use
  2. Use ~/ for personal preferences - Your preferred prompt, editor, personal aliases
  3. Document shared scripts - Add comments explaining what scripts in /shared/bin/ do
  4. Make scripts executable - chmod +x /shared/bin/script-name
  5. Use meaningful names - Name scripts and functions clearly
  6. Handle errors gracefully - Check for required files/directories before using them
  7. Keep it simple - Don’t over-complicate your configuration
  8. Version control shared files - Consider keeping /shared/ files in a local git repository
  9. Test changes - Test configuration changes before committing them for the team
  10. Use comments - Document non-obvious configuration choices

After modifying shell configuration files, you need to reload them:

Terminal window
# Reload your shell configuration
source ~/.bashrc
# Or start a new SSH session
exit
# Then reconnect

Make sure scripts are executable:

Terminal window
chmod +x /shared/bin/my-script

Conflicts Between Personal and Shared Config

Section titled “Conflicts Between Personal and Shared Config”

If you’re experiencing unexpected behavior, check for conflicts:

Terminal window
# See what's defined in shared config
cat /shared/.bashrc
# See what's in your personal config
cat ~/.bashrc
# Check current environment
env | grep MY_VARIABLE

Workspace customization is available at two levels:

  • Personal (/home/web): ~/.bashrc, ~/.workspacerc, ~/.profile
  • Project-wide (/shared): /shared/.profile, /shared/.bashrc, /shared/bin/, /shared/startup.d/, /shared/hooks/

Use personal files for your preferences and workflow, and shared files for team-wide conventions and tools. This approach ensures consistency across the team while allowing individual customization.