Skip to content

Advanced Topics

This page covers advanced topics and features of Tsuru.

Post-install Scripts

Tsuru allows you to configure scripts or commands that run automatically after installing an SDK. This is useful for:

  • Installing additional packages or tools that complement the SDK
  • Configuring security settings (e.g., adding certificates)
  • Setting up development environments

Adding a Post-install Script

You can add a post-install script using the postinstall command:

bash
tsuru postinstall <provider> [vendor] <script_path>

The script must be executable. Tsuru will run this script after each installation of the specified provider.

Adding a Post-install Command

Instead of a script file, you can also specify a direct command to run:

bash
tsuru postinstall <provider> [vendor] <command>

Examples

bash
# Run a script after installing any Zulu JDK
tsuru postinstall jdk zulu /path/to/setup-certificates.sh

# Install Yarn globally after installing any NodeJS version
tsuru postinstall nodejs "npm install -g yarn"

Profiles

Profiles allow you to define a set of SDKs that work together. This is useful when you need specific versions of multiple SDKs for a particular project.

INFO

Note: Profiles are planned for a future release.

Creating a Profile

To create a profile, you would define which SDK versions should be included:

bash
tsuru profile create my-profile
tsuru profile add my-profile jdk zulu 21
tsuru profile add my-profile nodejs 20

Using a Profile

To activate a profile:

bash
tsuru profile use my-profile

This would set up all the environment variables for the SDKs specified in the profile.

Shell Integration

Tsuru integrates with your shell to provide a seamless experience. The shell integration sets up the necessary environment variables and provides additional commands for managing your SDKs.

Setting Up Shell Integration

Add the following to your shell configuration file (.bashrc, .zshrc, etc.):

bash
# Tsuru shell integration
eval "$(tsuru shell-init)"

ZSH Integration

Tsuru has special integration with ZSH, providing tab completion and enhanced features:

bash
# Add to .zshrc
eval "$(tsuru shell-init zsh)"

Environment Variables

Tsuru manages environment variables to ensure your SDKs work correctly. Here's how Tsuru handles environment variables:

Global vs Session Scope

  • Session Scope (default): Environment variables are set only for the current shell session
  • Global Scope (-g or --global flag): Environment variables are set system-wide

Variables by Provider

Each provider sets specific environment variables:

  • JDK: JAVA_HOME and updates PATH to include ${JAVA_HOME}/bin
  • NodeJS: NODE_PATH and updates PATH to include ${NODE_PATH}/bin

Custom Environment Variables

You can configure custom environment variables for each provider in the Tsuru configuration.

Configuration

Tsuru stores its configuration in a set of files in your home directory. You can view and modify these settings using the config command:

bash
# View a configuration setting
tsuru config download.path

# Set a configuration setting
tsuru config download.path /custom/path