Managing projects
Group what you keep on a server into projects, share them with your team, and clean them up together.
A project is how you organize what you keep on a server. Everything you create there belongs to a project.
Use projects to:
- Keep separate work apart, such as one project per app, customer, or environment.
- Share resources with teammates by adding them to a project.
- Clean up everything for one piece of work at once by removing its project.
You do not need a project to get started.
Until you choose one, everything goes into your own project, default.
Create a project
project = await client.create_project("demo")const project = await client.createProject('demo')let project = client.create_project("demo").await?;You become the project’s owner.
A project name is at most 128 characters of lower-case letters, digits, ., _ and -, not starting with . or -.
It cannot be default, which is your own, or be spelled like a project id.
To see your projects, use list_project, which includes those others have shared with you.
To look one up, use get_project.
Work in a project
Choose the project when you connect. Everything you do through that client then happens in that project.
client = Client.connect("https://virtx.example", auth, project="demo")
volume = await client.create_volume("data") # a volume in "demo"const client = Client.connect('https://virtx.example', auth, 'demo')
const volume = await client.createVolume('data') // a volume in "demo"let client = Client::connect("https://virtx.example", auth, Some("demo"))?;
let volume = client.create_volume(Some("data")).await?; // a volume in "demo"To switch projects on a client you already have, use set_project.
In the virtx command, use --project; see CLI.
Projects are isolated from each other. A volume named data in one project and a volume named data in another are two different volumes.
Share a project
Add teammates to a project so they can use what is in it. Name them as the server knows them, usually by email address.
from virtx import Role
await project.set_member("bob@example.com", Role.MEMBER)await project.setMember('bob@example.com', 'member')use virtx::Role;
project.set_member("bob@example.com", Role::Member).await?;There are two roles:
- A member can use everything in the project.
- An owner can also add and remove members, and remove the project.
members lists who is in a project, and remove_member takes someone out.
A member can also leave a project on their own with remove_member.
A project name is unique only for its owner, so two people can each have a project called demo. Your teammates must therefore use a shared project’s id, not its name. Send them project.id.
Where you can share projects depends on the server:
- Your own server: share projects with
set_member, as above. See Running your own server. - Local server (
Client.spawn()): has only one user, you, so there is no one to share with. - VirtX cloud: create projects and add members in the console.
Remove a project
When the work is done, remove the project to delete everything in it at once.
Remove its sandboxes first: removing a project that still has a sandbox fails with 409.
await project.remove()await project.remove()project.remove().await?;You can remove your default project like any other. The server creates a new, empty default the next time you use it.
The new default has a new id and only you as a member, so you need to add your teammates again.
For every call and what each returns, see Projects in the SDK reference.
Troubleshooting
-
400,invalid,"default" is each user's own project, made for themCause: A project named
defaultwas created.Fix: Pick another name: everyone has a
defaultalready. -
400,invalid,… is not a project's nameCause: Upper case, another character, more than 128, or a name shaped like an id.
Fix: Use lower-case letters, digits,
.,_and-, not starting with.or-. -
409,exists,a project named … is already its owner'sCause: You already own a project with that name.
Fix: Use it, or pick another name.
-
403,not a member of the project, or not from hereCause: A teammate’s project named by its name, which finds only your own, or a project you are not in.
Fix: Name it by its
id, or ask its owner to add you. -
403,only an owner …Cause: A member tried what only an owner may do.
Fix: Ask an owner.
-
409,in_use,project … would be left without its ownerCause: The user whose project it is tried to leave it or step down. Other owners can leave or step down freely.
Fix: Remove the project instead.
-
409,in_use,a sandbox lives in project …Cause: The project was removed while it has a sandbox.
Fix: Remove its sandboxes first.
-
404, frommembersorset_memberCause: The server started by
Client.spawn()has no users to share with.Fix: Use a server of your own.
Next
- Running your own server: serve VirtX to the team you share projects with.
- Mounting volumes: the volumes a project keeps.