Workspace Startup Customization
This guide explains how to customize your workspace environment using configuration files in your home directory and the shared project directory.
Overview
Section titled “Overview”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
SSH Session Initialization
Section titled “SSH Session Initialization”When you connect to a workspace via SSH, your shell environment is configured through several files that are sourced in sequence:
- Shared Profile -
/shared/.profile(if it exists) - Shared Bash Config -
/shared/.bashrc(if it exists) - User Home Files -
~/.bashrcand~/.workspacercare 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.
Customization Methods
Section titled “Customization Methods”1. Personal Configuration Files
Section titled “1. Personal Configuration Files”Files in your home directory (/home/web) allow you to customize your personal workspace environment.
~/.bashrc
Section titled “~/.bashrc”Standard bash configuration file, sourced for interactive shells.
~/.workspacerc
Section titled “~/.workspacerc”Custom initialization file specifically for workspace customization. Sourced on session start.
~/.profile
Section titled “~/.profile”Standard shell profile file, sourced for login shells.
2. Shared Directory Customization
Section titled “2. Shared Directory Customization”The shared directory (/shared) is shared across all workspaces in a project. Files here affect everyone on the team.
/shared/.profile
Section titled “/shared/.profile”Sourced automatically on every SSH session for all users in the project.
/shared/.bashrc
Section titled “/shared/.bashrc”Sourced for bash users on every SSH session.
/shared/bin/
Section titled “/shared/bin/”This directory is automatically added to $PATH. Place executable scripts here to make them available to all workspaces.
/shared/startup.d/*.sh
Section titled “/shared/startup.d/*.sh”Scripts in this directory run once when the workspace container starts, as your user. This is useful for initializing the workspace environment.
File Precedence and Overrides
Section titled “File Precedence and Overrides”Understanding the order in which files are sourced helps you organize your configuration:
/shared/.profile- Project-wide defaults/shared/.bashrc- Project-wide bash configuration~/.bashrc- Personal bash configuration~/.workspacerc- Personal workspace configuration
Later files can override settings from earlier files. For example:
# /shared/.profile sets a defaultexport API_URL="https://api.staging.example.com"
# ~/.workspacerc can override itexport API_URL="https://api.local.example.com"Best Practices
Section titled “Best Practices”- Use
/shared/for team conventions - Aliases, functions, and environment variables that everyone should use - Use
~/for personal preferences - Your preferred prompt, editor, personal aliases - Document shared scripts - Add comments explaining what scripts in
/shared/bin/do - Make scripts executable -
chmod +x /shared/bin/script-name - Use meaningful names - Name scripts and functions clearly
- Handle errors gracefully - Check for required files/directories before using them
- Keep it simple - Don’t over-complicate your configuration
- Version control shared files - Consider keeping
/shared/files in a local git repository - Test changes - Test configuration changes before committing them for the team
- Use comments - Document non-obvious configuration choices
Troubleshooting
Section titled “Troubleshooting”Changes Not Taking Effect
Section titled “Changes Not Taking Effect”After modifying shell configuration files, you need to reload them:
# Reload your shell configurationsource ~/.bashrc
# Or start a new SSH sessionexit# Then reconnectScript Permission Denied
Section titled “Script Permission Denied”Make sure scripts are executable:
chmod +x /shared/bin/my-scriptConflicts Between Personal and Shared Config
Section titled “Conflicts Between Personal and Shared Config”If you’re experiencing unexpected behavior, check for conflicts:
# See what's defined in shared configcat /shared/.bashrc
# See what's in your personal configcat ~/.bashrc
# Check current environmentenv | grep MY_VARIABLESummary
Section titled “Summary”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.