Workspace Startup Customization
Workspace customization falls into two categories:
- Environment startup — Scripts that run when the workspace environment starts, before any user connects
- Shell session — Configuration that applies each time you open an SSH session
Within each category, customization can be project-wide (in /shared/, affecting all workspaces) or personal (in /home/web/, affecting only your workspace).
Environment Startup
Section titled “Environment Startup”Startup scripts run once when the workspace environment starts. Use these for tasks like installing dependencies, seeding data, or configuring services.
Project-Wide: /shared/startup.d/*.sh
Section titled “Project-Wide: /shared/startup.d/*.sh”Scripts here run on every workspace in the project. Use this for team-wide initialization — setting up shared tools, populating config files, or running migrations.
#!/bin/bashcp /shared/config/env.template /home/web/html/.envPersonal: ~/startup.d/*.sh
Section titled “Personal: ~/startup.d/*.sh”Scripts in /home/web/startup.d/ run after the shared startup scripts. Use this for personal workspace initialization that shouldn’t affect teammates.
#!/bin/bashln -sf /shared/media /home/web/html/pub/mediaExecution Order
Section titled “Execution Order”/shared/startup.d/*.sh— Project-wide~/startup.d/*.sh— Personal
Within each directory, scripts run in alphabetical order. Name them with numeric prefixes (e.g., 01_, 02_) to control ordering.
Shell Session
Section titled “Shell Session”Shell session files are sourced each time you connect via SSH. Use these for environment variables, aliases, prompt customization, and $PATH modifications.
Project-Wide
Section titled “Project-Wide”/shared/.profile
Section titled “/shared/.profile”Sourced on every SSH session for all workspaces in the project. Set project-wide environment variables and defaults here.
export APP_ENV="development"export COMPOSER_MEMORY_LIMIT=-1/shared/.bashrc
Section titled “/shared/.bashrc”Sourced for bash sessions. Define project-wide aliases and functions here.
alias mage='php bin/magento'alias cc='php bin/magento cache:flush'/shared/bin/
Section titled “/shared/bin/”Automatically added to $PATH. Place executable scripts here to make them available as commands in all workspaces.
chmod +x /shared/bin/my-script# Now available as: my-scriptPersonal
Section titled “Personal”~/.bashrc
Section titled “~/.bashrc”Standard bash configuration. Personal aliases, functions, and environment variables.
~/.workspacerc
Section titled “~/.workspacerc”Workspace-specific personal configuration, sourced on session start.
~/.profile
Section titled “~/.profile”Standard shell profile, sourced for login shells.
Source Order
Section titled “Source Order”Shell files are sourced in this sequence:
/shared/.profile— Project-wide defaults/shared/.bashrc— Project-wide bash config~/.bashrc— Personal bash config~/.workspacerc— Personal workspace config
Later files can override earlier ones:
# /shared/.profile sets a defaultexport API_URL="https://api.staging.example.com"
# ~/.workspacerc overrides itexport API_URL="https://api.local.example.com"Best Practices
Section titled “Best Practices”- Make scripts executable —
chmod +xon anything instartup.d/or/shared/bin/ - Use numeric prefixes —
01_,02_to control execution order instartup.d/ - Document shared scripts — Add comments explaining what scripts do
- Version control
/shared/— Consider keeping shared files in a local git repository - Test before committing — Verify startup scripts work before pushing to the team
Troubleshooting
Section titled “Troubleshooting”Shell changes not taking effect
Section titled “Shell changes not taking effect”Reload your config or start a new session:
source ~/.bashrc# Or disconnect and reconnectStartup script permission denied
Section titled “Startup script permission denied”chmod +x /shared/startup.d/my-script.shchmod +x ~/startup.d/my-script.shConflicts between shared and personal config
Section titled “Conflicts between shared and personal config”# Check what's set in shared configcat /shared/.bashrc
# Check personal configcat ~/.bashrc
# Inspect a variableenv | grep MY_VARIABLESummary
Section titled “Summary”| Type | Project-Wide (/shared/) | Personal (~/) |
|---|---|---|
| Environment startup | /shared/startup.d/*.sh | ~/startup.d/*.sh |
| Shell session | /shared/.profile, /shared/.bashrc, /shared/bin/ | ~/.bashrc, ~/.workspacerc, ~/.profile |