Workspaces¶
When belonging to different workspaces, it’s possible you need to switch between workspaces when working on a project.
Imagine the following scenario: You have your personal Tinybird account and you belong to two workspaces: production and staging. You want to be able switch from staging to production when necessary in order to push the current status of your project.
Authenticate¶
Let’s authenticate using the admin token of the staging account:
$> tb auth
Copy the admin token from https://ui.tinybird.co/tokens and paste it here: <pasted token>
** Auth successful!
** Configuration written to .tinyb file, consider adding it to .gitignore
List workspaces¶
Then, you can list the workspaces you have access to, and the one that you’re currently authenticated to
$> tb workspace ls
-------------------------------------------------------------------------------------------
| name | id | role | plan | current |
-------------------------------------------------------------------------------------------
| Staging | 3a798a68-38b1-4947-a0eb-399b7adbfa25 | admin | personal | True |
| Production | 841717b1-2472-44f9-9a81-42f1263cabe7 | guest | personal | False |
-------------------------------------------------------------------------------------------
Create a workspace¶
You can create new empty workspaces or from a starter kit template.
You need to provide your user token for this operation
In the interactive way, where we don’t provide any option, it would ask for the user token, the template (if so), and the workspace name:
$> tb workspace create
In order to create a new workspace we need your user token. Copy it from https://ui.tinybird.co/tokens and paste it here: <pasted token>
------------------------------------------------------------------------------------
| Idx | Id | Description |
------------------------------------------------------------------------------------
| 1 | blank | Empty workspace |
| 2 | web-analytics | Starting workspace ready to track visits and custom events |
| 3 | log-analytics | Build your own logging & telemetry solution |
------------------------------------------------------------------------------------
[0] to cancel
Use starter kit [1]: 1
Please enter the name for your new workspace. Remember the name you choose must be unique, you can add a suffix in case of collision.
You can bypass this step by supplying it after the command.
Workspace name [new_workspace_9e07]: <workspace_name>
In the straight-forward way, we will only need the name and the user token in the options:
$> tb workspace create workspace_name --user_token <token>
** Workspace 'workspace_name' has been created
Switch to a workspace¶
Now, you can switch to another workspace as follows:
$> tb workspace use 841717b1-2472-44f9-9a81-42f1263cabe7
$> tb workspace use Production
** Now using Production workspace (841717b1-2472-44f9-9a81-42f1263cabe7)
$> tb workspace ls
-------------------------------------------------------------------------------------------
| name | id | role | plan | current |
-------------------------------------------------------------------------------------------
| Staging | 3a798a68-38b1-4947-a0eb-399b7adbfa25 | admin | personal | False |
| Production | 841717b1-2472-44f9-9a81-42f1263cabe7 | guest | personal | True |
-------------------------------------------------------------------------------------------
You can also quickly check which workspace you’re currently into:
$> tb workspace current
-------------------------------------------------------------------------------------------
| name | id | role | plan | current |
-------------------------------------------------------------------------------------------
| Production | 841717b1-2472-44f9-9a81-42f1263cabe7 | admin | personal | True |
-------------------------------------------------------------------------------------------
Members management¶
You can manage workspace members using the Web UI or the CLI. For the latter, just use the workspace members
commands.
You can add members:
$ tb workspace members add "user1@example.com,user2@example.com,user3@example.com"
Remove members:
$ tb workspace members rm user3@example.com
And list them:
$ tb workspace members ls
---------------------
| email |
---------------------
| user1@example.com |
| user2@example.com |
---------------------