Workspace ports
Workspace automatically exposes ports opened inside a workspace, making them accessible from your browser. This enables a secure and seamless interaction with various services and applications running within your workspace.
How it works
- When you start a service or application that opens a port within your workspace, Anyscale automatically detects it.
- The detected port is then securely forwarded and made available through your browser.
- You can access these ports directly from the Anyscale console, without needing to configure any additional networking or port forwarding.
Benefits
- Automatic detection: No manual configuration required for port forwarding.
- Secure access: All connections are encrypted and authenticated through your Anyscale account.
- Seamless integration: Easily interact with services like TensorBoard, or custom web applications running in your workspace.
Using Workspace ports
To use Workspace ports:
- Start your service or application within the workspace as you normally would.
- The port automatically appears in the Anyscale console under the "Ports" section of your workspace.
- Click on the port link to open the service in a new browser tab.
Running services like TensorBoard
To run TensorBoard:
- Install TensorBoard in your workspace if it's not already available:
pip install tensorboard
- Start TensorBoard, specifying your log directory:
tensorboard --logdir=/path/to/logs --port=6006
- The TensorBoard interface automatically becomes available in the Ports section of your workspace, typically on port 6006.
- Click on the port link to open TensorBoard in a new browser tab.
This seamless integration allows you to visualize your machine learning experiments without leaving the Anyscale environment.
Some ports in your workspace may already be open when you start it. These ports are used internally by Anyscale for various system functions and services. While these ports are visible, they are reserved for internal use and should not be modified or closed.
Accessing ports using the CLI
In addition to accessing ports through the Anyscale console, you can also use the Anyscale CLI to create SSH tunnels for port forwarding. This method allows you to access workspace ports directly from your local machine.
To access a port using the CLI:
-
Open a terminal on your local machine.
-
Use the following command structure:
anyscale workspace_v2 ssh -n <workspace-name> -- -L <local-port>:localhost:<workspace-port>
Replace
<workspace-name>
with your workspace name,<local-port>
with the port you want to use on your local machine, and<workspace-port>
with the port number in your workspace. -
For example, to forward port 9000 from your workspace to port 9000 on your local machine:
anyscale workspace_v2 ssh -n my-workspace -- -L 9000:localhost:9000
-
Once the SSH tunnel is established, you can access the service running on that port by opening a browser and navigating to
http://localhost:9000
(or whatever port you specified).
This method is particularly useful for accessing services that require a local connection or for using local development tools with your workspace.
Remember to keep the terminal window open while you're using the forwarded port. Closing the terminal terminates the SSH tunnel and the port forwarding.