Skip to content

Commit 128b32f

Browse files
strickvlwjayeshhtahir1github-actions[bot]
authored
Docs on ZenML setup (#3100)
* add some info on docker skip build * add docs on not building a docker image * update toc and title * added text to stress that this doesnt always happen * Apply suggestions from code review Co-authored-by: Hamza Tahir <[email protected]> * restructure headings * more english * Apply suggestions from code review Co-authored-by: Alex Strick van Linschoten <[email protected]> * apply review changes * add how to reuse builds page * aoply hamza comments * add redirect for new page name * apply review changes * move the artifact store block to the top * update redirect * add shared components section * scarf * update toc * add stacks, pipelines, and models page * add overview page * add access management guide * update setup repository * update text * Update docs/book/how-to/setting-up-a-project-repository/stacks-pipelines-models.md Co-authored-by: Hamza Tahir <[email protected]> * update * a tags become markdown links * add artifacts and real life example * fix typos * add scarf * update toc * remove first md * split pypi section out * restructure * add scarf * add diagram * Optimised images with calibre/image-actions * fix spelling * add descriptions * rename some sections * minor changes * Update docs/book/how-to/setting-up-a-project-repository/README.md Co-authored-by: Hamza Tahir <[email protected]> * Update docs/book/how-to/setting-up-a-project-repository/README.md Co-authored-by: Hamza Tahir <[email protected]> * Apply suggestions from code review Co-authored-by: Hamza Tahir <[email protected]> * add info about roles zenml pro * add link * address review feedback * extra spaces * fix naming * add links and update pypi registry example * add example of connector roles * Optimised images with calibre/image-actions * small fix * update section name * apply reviews * update second location for pypi docs * Optimised images with calibre/image-actions * replace image * Optimised images with calibre/image-actions --------- Co-authored-by: Jayesh Sharma <[email protected]> Co-authored-by: Hamza Tahir <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 8ef9ef3 commit 128b32f

19 files changed

+566
-71
lines changed

.gitbook.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ structure:
66

77
redirects:
88
how-to/customize-docker-builds/use-code-repositories-to-speed-up-docker-build-times: how-to/customize-docker-builds/how-to-reuse-builds.md
9-
reference/migration-guide/README.md: how-to/manage-the-zenml-server/migration-guide/migration-guide.md
10-
reference/migration-guide/migration-zero-twenty.md: how-to/manage-the-zenml-server/migration-guide/migration-zero-twenty.md
11-
reference/migration-guide/migration-zero-thirty.md: how-to/manage-the-zenml-server/migration-guide/migration-zero-thirty.md
12-
reference/migration-guide/migration-zero-forty.md: how-to/manage-the-zenml-server/migration-guide/migration-zero-forty.md
13-
reference/migration-guide/migration-zero-sixty.md: how-to/manage-the-zenml-server/migration-guide/migration-zero-sixty.md
9+
reference/migration-guide: how-to/manage-the-zenml-server/migration-guide/migration-guide.md
10+
reference/migration-guide/migration-zero-twenty: how-to/manage-the-zenml-server/migration-guide/migration-zero-twenty.md
11+
reference/migration-guide/migration-zero-thirty: how-to/manage-the-zenml-server/migration-guide/migration-zero-thirty.md
12+
reference/migration-guide/migration-zero-forty: how-to/manage-the-zenml-server/migration-guide/migration-zero-forty.md
13+
reference/migration-guide/migration-zero-sixty: how-to/manage-the-zenml-server/migration-guide/migration-zero-sixty.md
1414

15-
getting-started/deploying-zenml/manage-the-deployed-services/upgrade-the-version-of-the-zenml-server.md: how-to/manage-the-zenml-server/upgrade-zenml-server.md
16-
getting-started/deploying-zenml/manage-the-deployed-services/troubleshoot-your-deployed-server.md: how-to/manage-the-zenml-server/troubleshoot-your-deployed-server.md
17-
how-to/stack-deployment/implement-a-custom-integration.md: how-to/contribute-to-zenml/implement-a-custom-integration.md
18-
19-
getting-started/zenml-pro/system-architectures: getting-started/system-architectures.md
15+
getting-started/deploying-zenml/manage-the-deployed-services/upgrade-the-version-of-the-zenml-server: how-to/manage-the-zenml-server/upgrade-zenml-server.md
16+
getting-started/deploying-zenml/manage-the-deployed-services/troubleshoot-your-deployed-server: how-to/manage-the-zenml-server/troubleshoot-your-deployed-server.md
17+
how-to/stack-deployment/implement-a-custom-integration: how-to/contribute-to-zenml/implement-a-custom-integration.md
18+
how-to/setting-up-a-project-repository/best-practices: how-to/setting-up-a-project-repository/set-up-repository.md
19+
getting-started/zenml-pro/system-architectures: getting-started/system-architectures.md
-64.1 KB
Loading
Loading
Loading
Loading

docs/book/how-to/customize-docker-builds/how-to-reuse-builds.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ While reusing Docker builds is useful, it can be limited. This is because specif
3333

3434
## Use the artifact store to upload your code
3535

36-
You can also let ZenML use the artifact store to upload your code. This is the default behaviour if no code repository is detected and the `allow_download_from_artifact_store` flag is not set to `False` in your `DockerSettings`.
36+
You can also let ZenML use the artifact store to upload your code. This is the default behavior if no code repository is detected and the `allow_download_from_artifact_store` flag is not set to `False` in your `DockerSettings`.
3737

3838
## Use code repositories to speed up Docker build times
3939

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
description: How to use a private PyPI repository.
3+
---
4+
5+
# How to use a private PyPI repository
6+
7+
For packages that require authentication, you may need to take additional steps:
8+
9+
1. Use environment variables to store credentials securely.
10+
2. Configure pip or poetry to use these credentials when installing packages.
11+
3. Consider using custom Docker images that have the necessary authentication setup.
12+
13+
Here's an example of how you might set up authentication using environment variables:
14+
15+
```python
16+
import os
17+
18+
from my_simple_package import important_function
19+
from zenml.config import DockerSettings
20+
from zenml import step, pipeline
21+
22+
docker_settings = DockerSettings(
23+
requirements=["my-simple-package==0.1.0"],
24+
environment={'PIP_EXTRA_INDEX_URL': f"https://{os.environ.get('PYPI_TOKEN', '')}@my-private-pypi-server.com/{os.environ.get('PYPI_USERNAME', '')}/"}
25+
)
26+
27+
@step
28+
def my_step():
29+
return important_function()
30+
31+
@pipeline(settings={"docker": docker_settings})
32+
def my_pipeline():
33+
my_step()
34+
35+
if __name__ == "__main__":
36+
my_pipeline()
37+
```
38+
39+
Note: Be cautious with handling credentials. Always use secure methods to manage
40+
and distribute authentication information within your team.
41+
<!-- For scarf -->
42+
<figure><img alt="ZenML Scarf" referrerpolicy="no-referrer-when-downgrade" src="https://static.scarf.sh/a.png?x-pxid=f0b4f458-0a54-4fcd-aa95-d5ee424815bc" /></figure>
43+
44+

docs/book/how-to/manage-the-zenml-server/best-practices-upgrading-zenml.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ ZenML Pro comes with multi-tenancy which makes it easy for you to have multiple
4242

4343
## Upgrading your code
4444

45-
Sometimes, you might have to upgrade your code to work with a new version of ZenML. This is true especially when you are moving from a really old version to a new major version. The following tips might help, in addition to everything you've learnt in this document so far.
45+
Sometimes, you might have to upgrade your code to work with a new version of ZenML. This is true especially when you are moving from a really old version to a new major version. The following tips might help, in addition to everything you've learned in this document so far.
4646

4747
### Testing and Compatibility
4848

Lines changed: 86 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,93 @@
11
---
2-
description: Setting your team up for success with a project repository.
2+
description: Setting your team up for success with a well-architected ZenML project.
33
---
44

5-
# 😸 Setting up a project repository
5+
# 😸 Setting up a Well-Architected ZenML Project
66

7-
ZenML code typically lives in a `git` repository. Setting this repository up correctly can make a huge impact on collaboration and
8-
getting the maximum out of your ZenML deployment. This section walks users through some of the options available to create a project
9-
repository with ZenML.
7+
Welcome to the guide on setting up a well-architected ZenML project. This section will provide you with a comprehensive overview of best practices, strategies, and considerations for structuring your ZenML projects to ensure scalability, maintainability, and collaboration within your team.
108

11-
<figure><img src="../../.gitbook/assets/Remote_with_code_repository.png" alt=""><figcaption><p>A visual representation of how the code repository fits into the general ZenML architecture.</p></figcaption></figure>
9+
## The Importance of a Well-Architected Project
10+
11+
A well-architected ZenML project is crucial for the success of your machine learning operations (MLOps). It provides a solid foundation for your team to develop, deploy, and maintain ML models efficiently. By following best practices and leveraging ZenML's features, you can create a robust and flexible MLOps pipeline that scales with your needs.
12+
13+
## Key Components of a Well-Architected ZenML Project
14+
15+
### Repository Structure
16+
17+
A clean and organized repository structure is essential for any ZenML project. This includes:
18+
19+
- Proper folder organization for pipelines, steps, and configurations
20+
- Clear separation of concerns between different components
21+
- Consistent naming conventions
22+
23+
Learn more about setting up your repository in the [Set up repository guide](./best-practices.md).
24+
25+
### Version Control and Collaboration
26+
27+
Integrating your ZenML project with version control systems like Git is crucial for team collaboration and code management. This allows for:
28+
29+
- Makes creating pipeline builds faster, as you can leverage the same image and [have ZenML download code from your repository](../../how-to/customize-docker-builds/how-to-reuse-builds.md#use-code-repositories-to-speed-up-docker-build-times).
30+
- Easy tracking of changes
31+
- Collaboration among team members
32+
33+
Discover how to connect your Git repository in the [Set up a repository guide](./best-practices.md).
34+
35+
### Stacks, Pipelines, Models, and Artifacts
36+
37+
Understanding the relationship between stacks, models, and pipelines is key to designing an efficient ZenML project:
38+
39+
- Stacks: Define your infrastructure and tool configurations
40+
- Models: Represent your machine learning models and their metadata
41+
- Pipelines: Encapsulate your ML workflows
42+
- Artifacts: Track your data and model outputs
43+
44+
Learn about organizing these components in the [Organizing Stacks, Pipelines, Models, and Artifacts guide](./stacks-pipelines-models.md).
45+
46+
### Access Management and Roles
47+
48+
Proper access management ensures that team members have the right permissions and responsibilities:
49+
50+
- Define roles such as data scientists, MLOps engineers, and infrastructure managers
51+
- Set up [service connectors](../auth-management/README.md) and manage authorizations
52+
- Establish processes for pipeline maintenance and server upgrades
53+
- Leverage [Teams in ZenML Pro](../../getting-started/zenml-pro/teams.md) to assign roles and permissions to a group of users, to mimic your real-world team roles.
54+
55+
Explore access management strategies in the [Access Management and Roles guide](./access-management-and-roles.md).
56+
57+
### Shared Components and Libraries
58+
59+
Leverage shared components and libraries to promote code reuse and standardization across your team:
60+
61+
- Custom flavors, steps, and materializers
62+
- Shared private wheels for internal distribution
63+
- Handling authentication for specific libraries
64+
65+
Find out more about sharing code in the [Shared Libraries and Logic for Teams guide](./shared_components_for_teams.md).
66+
67+
### Project Templates
68+
69+
Utilize project templates to kickstart your ZenML projects and ensure consistency:
70+
71+
- Use pre-made templates for common use cases
72+
- Create custom templates tailored to your team's needs
73+
74+
Learn about using and creating project templates in the [Project Templates guide](./project-templates.md).
75+
76+
### Migration and Maintenance
77+
78+
As your project evolves, you may need to migrate existing codebases or upgrade your ZenML server:
79+
80+
- Strategies for migrating legacy code to newer ZenML versions
81+
- Best practices for upgrading ZenML servers
82+
83+
Discover migration strategies and maintenance best practices in the [Migration and Maintenance guide](../../how-to/manage-the-zenml-server/best-practices-upgrading-zenml.md#upgrading-your-code).
84+
85+
## Getting Started
86+
87+
To begin building your well-architected ZenML project, start by exploring the guides in this section. Each guide provides in-depth information on specific aspects of project setup and management.
88+
89+
Remember, a well-architected project is an ongoing process. Regularly review and refine your project structure, processes, and practices to ensure they continue to meet your team's evolving needs.
90+
91+
By following these guidelines and leveraging ZenML's powerful features, you'll be well on your way to creating a robust, scalable, and collaborative MLOps environment.
1292

1393
<figure><img src="https://static.scarf.sh/a.png?x-pxid=f0b4f458-0a54-4fcd-aa95-d5ee424815bc" alt="ZenML Scarf"><figcaption></figcaption></figure>
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
---
2+
description: A guide on managing user roles and responsibilities in ZenML.
3+
---
4+
5+
# Access Management and Roles in ZenML
6+
7+
Effective access management is crucial for maintaining security and efficiency in your ZenML projects. This guide will help you understand the different roles within a ZenML server and how to manage access for your team members.
8+
9+
## Typical Roles in an ML Project
10+
11+
In an ML project, you will typically have the following roles:
12+
13+
- Data Scientists: Primarily work on developing and running pipelines.
14+
- MLOps Platform Engineers: Manage the infrastructure and stack components.
15+
- Project Owners: Oversee the entire ZenML deployment and manage user access.
16+
17+
The above is an estimation of roles that you might have in your team. In your case, the names might be different or there might be more roles, but you can relate the responbilities we discuss in this document to your own project loosely.
18+
19+
{% hint style="info" %}
20+
You can create [Roles in ZenML Pro](../../getting-started/zenml-pro/roles.md) with a given set of permissions and assign them to either Users or Teams that represent your real-world team structure. Sign up for a free trial to try it yourself: https://cloud.zenml.io/
21+
{% endhint %}
22+
23+
## Service Connectors: Gateways to External Services
24+
25+
Service connectors are how different cloud services are integrated with ZenML. They are used to abstract away the credentials and other configurations needed to access these services.
26+
27+
Ideally, you would want that only the MLOps Platform Engineers have access for creating and managing connectors. This is because they are closest to your infrastructure and can make informed decisions about what authentication mechanisms to use and more.
28+
29+
Other team members can use connectors to create stack components that talk to the external services but should not have to worry about setting them and shouldn't have access to the credentials used to configure them.
30+
31+
Let's look at an example of how this works in practice.
32+
Imagine you have a `DataScientist` role in your ZenML server. This role should only be able to use the connectors to create stack components and run pipelines. They shouldn't have access to the credentials used to configure these connectors. Therefore, the permissions for this role could look like the following:
33+
34+
![Data Scientist Permissions](../../.gitbook/assets/data_scientist_connector_role.png)
35+
36+
You can notice that the role doesn't grant the data scientist permissions to create, update, or delete connectors, or read their secret values.
37+
38+
On the other hand, the `MLOpsPlatformEngineer` role has the permissions to create, update, and delete connectors, as well as read their secret values. The permissions for this role could look like the following:
39+
40+
![MLOps Platform Engineer Permissions](../../.gitbook/assets/platform_engineer_connector_role.png)
41+
42+
{% hint style="info" %}
43+
Note that you can only use the RBAC features in ZenML Pro. Learn more about roles in ZenML Pro [here](../../getting-started/zenml-pro/roles.md).
44+
{% endhint %}
45+
46+
Learn more about the best practices in managing credentials and recommended roles in our [Managing Stacks and Components guide](../stack-deployment/README.md).
47+
48+
49+
## Who is responsible for upgrading the ZenML server?
50+
51+
The decision to upgrade your ZenML server is usually taken by your Project Owners after consulting with all the teams using the server. This is because there might be teams with conflicting requirements and moving to a new version of ZenML (that might come with upgrades to certain libraries) can break code for some users.
52+
53+
{% hint style="info" %}
54+
You can choose to have different servers for different teams and that can alleviate some of the pressure to upgrade if you have multiple teams using the same server. ZenML Pro offers [multi-tenancy](../../getting-started/zenml-pro/tenants.md) out of the box, for situations like these. Sign up for a free trial to try it yourself: https://cloud.zenml.io/
55+
{% endhint %}
56+
57+
Performing the upgrade itself is a task that typically falls on the MLOps Platform Engineers. They should:
58+
59+
- ensure that all data is backed up before performing the upgrade
60+
- no service disruption or downtime happens during the upgrade
61+
62+
and more. Read in detail about the best practices for upgrading your ZenML server in the [Best Practices for Upgrading ZenML Servers](../manage-the-zenml-server/best-practices-upgrading-zenml.md) guide.
63+
64+
65+
## Who is responsible for migrating and maintaining pipelines?
66+
67+
When you upgrade to a new version of ZenML, you might have to test if your code works as expected and if the syntax is up to date with what ZenML expects. Although we do our best to make new releases compatible with older versions, there might be some breaking changes that you might have to address.
68+
69+
The pipeline code itself is typically owned by the Data Scientist, but the Platform Engineer is responsible for making sure that new changes can be tested in a safe environment without impacting existing workflows. This involves setting up a new server and doing a staged upgrade and other strategies.
70+
71+
The Data Scientist should also check out the release notes, and the migration guide where applicable when upgrading the code. Read more about the best practices for upgrading your ZenML server and your code in the [Best Practices for Upgrading ZenML Servers](../manage-the-zenml-server/best-practices-upgrading-zenml.md) guide.
72+
73+
74+
## Best Practices for Access Management
75+
76+
Apart from the role-specific tasks we discussed so far, there are some general best practices you should follow to ensure a secure and well-managed ZenML environment that supports collaboration while maintaining proper access controls.
77+
78+
- Regular Audits: Conduct periodic reviews of user access and permissions.
79+
- Role-Based Access Control (RBAC): Implement RBAC to streamline permission management.
80+
- Least Privilege: Grant minimal necessary permissions to each role.
81+
- Documentation: Maintain clear documentation of roles, responsibilities, and access policies.
82+
83+
{% hint style="info" %}
84+
The Role-Based Access Control (RBAC) and assigning of permissions is only available for ZenML Pro users.
85+
{% endhint %}
86+
87+
By following these guidelines, you can ensure a secure and well-managed ZenML environment that supports collaboration while maintaining proper access controls.
88+
89+
90+
<!-- For scarf -->
91+
<figure><img alt="ZenML Scarf" referrerpolicy="no-referrer-when-downgrade" src="https://static.scarf.sh/a.png?x-pxid=f0b4f458-0a54-4fcd-aa95-d5ee424815bc" /></figure>
92+
93+

docs/book/how-to/setting-up-a-project-repository/connect-your-git-repository.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ description: >-
88

99
A code repository in ZenML refers to a remote storage location for your code. Some commonly known code repository platforms include [GitHub](https://github.com/) and [GitLab](https://gitlab.com/).
1010

11+
<figure><img src="../../.gitbook/assets/Remote_with_code_repository.png" alt=""><figcaption><p>A visual representation of how the code repository fits into the general ZenML architecture.</p></figcaption></figure>
12+
1113
Code repositories enable ZenML to keep track of the code version that you use for your pipeline runs. Additionally, running a pipeline that is tracked in a registered code repository can [speed up the Docker image building for containerized stack components](../customize-docker-builds/use-code-repositories-to-speed-up-docker-build-times.md) by eliminating the need to rebuild Docker images each time you change one of your source code files.
1214

1315
Learn more about how code repositories benefit development [here](../customize-docker-builds/use-code-repositories-to-speed-up-docker-build-times.md).

0 commit comments

Comments
 (0)