Skip to content

Commit caae2ab

Browse files
authored
docs: rewrite source types document (#1160)
improve structure enhanced clarity & simplified language added additional context improved styling & formatting
1 parent 92e844c commit caae2ab

File tree

3 files changed

+100
-45
lines changed

3 files changed

+100
-45
lines changed
20.8 KB
Loading

sources/platform/actors/development/deployment/index.md

Lines changed: 46 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,67 @@ description: Learn how to deploy your Actor to the Apify platform and build them
55
slug: /actors/development/deployment
66
---
77

8-
**Learn how to deploy your Actor to the Apify platform and build them.**
8+
**Learn how to deploy your Actors to the Apify platform and build them.**
99

1010
---
1111

12-
The deployment of your Actor is the process of uploading your Actor [source code](../actor_definition/index.md) and [building](../builds_and_runs/builds.md) it on the Apify platform. After that, you can easily [run](../builds_and_runs/runs.md) and scale your Actor in the cloud.
12+
Deploying an Actor involves uploading your [source code](/platform/actors/development/actor-definition) and [building](/platform/actors/development/builds-and-runs/builds) it on the Apify platform. Once deployed, you can run and scale your Actor in the cloud.
1313

14-
## Apify CLI
14+
## Deploy using Apify CLI
1515

16-
The easiest and fastest way to get your Actor deployed and built is to use [Apify CLI](/cli). If you followed one of the [tutorials](/academy), you should already have it installed. If you do not have Apify CLI installed, then follow the instructions at [Apify CLI documentation](/cli/docs/installation) to install it. Then you can simply log in to your Apify account by running:
16+
The fastest way to deploy and build your Actor is by uising the [Apify CLI](/cli). If you've completed one of the tutorials from the [academy](/academy), you should have already have it installed. If not, follow the [Apify CLI installation instructions](/cli/docs/installation).
17+
18+
To deploy your Actor using Apify CLI:
19+
20+
1. Log in to your Apify account:
21+
22+
```bash
23+
apify login
24+
```
25+
26+
1. Navigate to the directory of your Actor on your local machine.
27+
28+
1. Deploy your Actor by running:
29+
30+
```bash
31+
apify push
32+
```
33+
34+
When you deploy using the CLI, your source code is uploaded as "multiple source files" and is visible and editable in the Web IDE.
35+
36+
![Web IDE](./images/actor-source.png)
37+
38+
:::note Source files size limit
39+
40+
The CLI deploys code as multiple source files up to 3 MB. Beyond that, it deploys as a Zip file.
41+
42+
:::
43+
44+
### Pull an existing Actor
45+
46+
You can also pull an existing Actor from the Apify platform to your local machine using `apify pull` command
1747

1848
```bash
19-
apify login
49+
apify pull [ACTORID]
2050
```
2151

22-
and then deploy your Actor by running:
52+
This command fetches the Actor's files to your current directory. If the Actor is defined as a Git repository, it will be cloned, for Actors defined in the Web IDE, the command will fetch the files diresctly.
53+
54+
You can specify a particular version of the Actor to pull by using the `--version` flag:
2355
2456
```bash
25-
apify push
57+
apify pull [ACTORID] --version=1.2
2658
```
2759
28-
When you deploy an Actor using the CLI, the code gets deployed as "multiple source files" Actor source type and so the code is visible and editable via web IDE:
29-
![Web IDE](./images/actor-source.png)
30-
31-
> This works only until a certain size; after that, Apify CLI deploys the code as a Zip file.
60+
If you don't provide the `ACTORID`, the command will update the Actor in the current directory based on its name in the `.actor/actor.json` file.
3261

33-
## Other ways (Zip, Git, Gist)
62+
## Alternative deployment methods
3463

35-
If you want to deploy an Actor in a different way, you need to first manually create the Actor in [Apify Console](https://my.apify.com/actors). Then switch its source type:
64+
To deploy using other methods, first create the Actor manually through Apify CLI or Apify Console, then change its source type:
3665

3766
![Actor source types](./images/actor-source-types.png)
3867

39-
This enables you to link a Git repository, Gist, or Zip file to your Actor. You will find more information on all source types in the following chapter.
68+
You can link your anctor to a Git repository, Gist, or a Zip file.
69+
70+
For more information on alternative source types, check out next chapter.
71+

sources/platform/actors/development/deployment/source_types.md

Lines changed: 54 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,69 +5,92 @@ slug: /actors/development/deployment/source-types
55
sidebar_position: 1
66
---
77

8-
# Source types {#source-types}
9-
108
**Learn about Apify Actor source types and how to deploy an Actor from GitHub using CLI or Gist.**
119

1210
---
1311

14-
The **Source type** setting determines the location of the source code for the Actor. It can have one of the following values: [Web IDE](#web-ide), [Git repository](#git-repository), [Zip file](#zip-file) or [GitHub Gist](#github-gist).
12+
This section explains the various sources types available for Apify Actors and how to deploy an Actor from Github using CLI or Gist. Apify Actors supporst four source types:
13+
14+
- [Web IDE](#web-ide)
15+
- [Git repository](#git-repository)
16+
- [Zip file](#zip-file)
17+
- [GitHub Gist](#github-gist)
1518

16-
## Web IDE {#web-ide}
19+
## Web IDE
1720

18-
This option is used by default when your Actor's source code is hosted on the Apify platform. You can use our Web IDE to preview and update your Actor's source code and browse its files and directories. This is especially helpful when you need to make fast updates to your source code or README or when you want to directly test the [**INPUT_SCHEMA.json**](../actor_definition/input_schema/index.md) on the Apify platform.
21+
This is the default option when your Actor's source code is hosted on the Apify platform. It offers quick previews and updates to your source code, easy file and directory browsing, and direct testing of the [`INPUT_SCHEMA.json`](/platform/actors/development/actor-definition/input-schema) on the Apify platform.
1922

20-
The only required file is **Dockerfile**, and all other files depend on your Dockerfile settings. By default, Apify's custom NodeJS Dockerfile is used, which requires a **main.js** file containing your source code and a **package.json** file containing package configurations for [NPM](https://www.npmjs.com/).
23+
A `Dockerfile` is mandatory for all Actors. When using the default NodeJS Dockerfile, you'll typically need `main.js` for your source code and `package.json` for [NPM](https://www.npmjs.com/) package configurations.
2124

22-
See [Dockerfile](../actor_definition/docker.md#custom-dockerfile) and [base Docker images](../actor_definition/docker.md#base-docker-images) for more information about creating your own Dockerfile and using Apify's prepared base images.
25+
For more information on creating custom Dockersfiles or using Apify's base images, refer to the [Dockerfile](/platform/actors/development/actor-definition/dockerfile#custom-dockerfile) and [base Docker images](/platform/actors/development/actor-definition/dockerfile#base-docker-images) documentation.
2326

24-
## [](#git-repository)Git repository
27+
## Git repository
2528

2629
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/NEzT_p_RE1Q" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
2730

28-
If the Actor's source code is hosted externally in a Git repository, it can consist of multiple files and directories, use its own **Dockerfile** to control the build process (see [Custom Dockerfile](../actor_definition/docker.md#custom-dockerfile) for details) and have a user description in store fetched from the <strong>README.md</strong> file. The location of the repository is specified by the **Git URL** setting, which can be an **https**, **git** or **ssh** URL.
31+
Hosting your Actor's source code in a Git repository allows for multiple files and directories, a custom `Dockerfile` for build process control, and a user description fetched from `README.md`. Specify the repository location using the **Git URL** setting with `https`, `git`, or `ssh` protocols.
32+
33+
To deploy an Actor from GitHub, set the **Source Type** to **Git repository** and enter the GitHub repository URL in the **Git URL** field. You can optionally specify a branch or tag by adding a URL fragmend (e.g., `#develop`).
34+
35+
To use a specific directory, add it after the branch/tag, separated by a colon (e.g., `#develop:some/dir`)
36+
37+
:::note GitHub integration
38+
39+
You can easily set up an integration where the Actor is automatically rebuilt on every commit to the Git repository. For more details, see [GitHub integration](/platform/integrations/github).
40+
41+
:::
42+
43+
### Private repositories
44+
45+
When using a private Git repository for your Actor's source code, you need to configure a deployment key. This key grants Apify secure, read-only access to your repository.
46+
47+
:::note What are deployment keys
48+
49+
Deployment keys are unique SSH keys that allow Apify to clone and build your Actor from a private repository.
50+
51+
:::
2952

30-
[//]: # (TODO: It's pretty outdated, we should probably update the Actor too)
31-
To help you get started quickly, you can use the [apify/quick-start](https://apify.com/apify/quick-start) Actor which contains all the boilerplate necessary when creating a new Actor hosted on Git. The source code is available on [GitHub](https://github.com/apify/actor-quick-start).
53+
#### How to configure deployment keys
3254

33-
To specify a Git branch or tag to check out, add a URL fragment to the URL. For example, to check out the **develop** branch, specify a URL such as `https://github.com/jancurn/some-actor.git#develop`.
55+
To configure the deployment key for your Actor's source code you need to:
3456

35-
Optionally, the second part of the fragment in the Git URL (separated by a colon) specifies the directory from which the Actor will be built (and where the `.actor`) folder is located. For example, `https://github.com/jancurn/some-actor.git#develop:some/dir` will check out the **develop** branch and set **some/dir** as the root directory of the Actor.
57+
1. In your Actor's settings, find the **Git URL** input field
58+
2. Click the **deployment key** link below the input field
59+
3. Follow the instruction to add the key to your Git hosting service.
3660

37-
Note that you can easily set up an integration where the Actor is automatically rebuilt on every commit to the Git repository. For more details, see [GitHub integration](../../../integrations/programming/github.md).
61+
![Deployment keys instruction window](./images/deployment-keys.png)
3862

39-
### [](#private-repositories)Private repositories
63+
By using deployment keys, you enable secure, automated builds of your Actor from private repositories.
4064

41-
If your source code is hosted in a private Git repository, then you need to configure the deployment key. The deployment key is different for each Actor and may be used only once for the Git hosting of your choice (GitHub, Bitbucket, GitLab, etc.).
65+
:::info Key usage limitations
4266

43-
To obtain the key click at the **deployment key** link under the **Git URL** text input and follow the instructions there.
67+
Remember that each key can only be used once per Git hosting service (GitHub, Bitbucket, GitLab)
4468

45-
### [](#actor-monorepos)Actor monorepos
69+
:::
4670

47-
By default, the context directory for the Docker build is the directory pointed to by the **Git URL** (or the repository root if no directory is specified). If you want to use a different directory for the Docker context, you can use the `dockerContextDir` property in the [Actor definition](../actor_definition/actor_json.md). This is useful for sharing code between multiple Actors in the same repository.
71+
### Actor monorepos
4872

49-
If you want to have multiple Actors in a single repository using shared code also located in the repository, you can set `dockerContextDir` to the path to the folder which contains the Actor's source and the shared code, and then, in the Dockerfile, copy both the Actor's source and the shared code into the Docker image.
73+
To manage multiple Actors in a single repository, use the `dockerContextDix` property in the [Actor definition](/platform/actors/development/actor-definition/actor-json) to set the Docker context directory (if not provided then the repository root is used). In the Dockerfile, copy both the Actor's source and any shared code into the Docker image.
5074

5175
To enable sharing Dockerfiles between multiple Actors, the Actor build process passes the `ACTOR_PATH_IN_DOCKER_CONTEXT` build arg to the Docker build.
5276
It contains the relative path from `dockerContextDir` to the directory selected as the root of the Actor in the Apify Console (the "directory" part of the Actor's git URL).
5377

54-
An example Actor monorepo is shown in the [`apify/actor-monorepo-example`](https://github.com/apify/actor-monorepo-example) repository. To build Actors from this monorepo, you would set the source URL (including branch name and folder) as `https://github.com/apify/actor-monorepo-example#main:actors/javascript-actor` and `https://github.com/apify/actor-monorepo-example#main:actors/typescript-actor` respectively.
78+
For an example, see the [`apify/actor-monorepo-example`](https://github.com/apify/actor-monorepo-example) repository. To build Actors from this monorepo, you would set the source URL (including branch name and folder) as `https://github.com/apify/actor-monorepo-example#main:actors/javascript-actor` and `https://github.com/apify/actor-monorepo-example#main:actors/typescript-actor` respectively.
5579

56-
## [](#zip-file)Zip file
80+
## Zip file
5781

58-
The source code for the Actor can also be located in a Zip archive hosted on an external URL. This option enables integration with arbitrary source code or continuous integration systems. Similarly, as with the [Git repository](#git-repository), the source code can consist of multiple files and directories and can contain a custom **Dockerfile**. The Actor description is taken from the <strong>README.md</strong>. If you don't use a [custom Dockerfile](../actor_definition/docker.md#custom-dockerfile), the root file of your application must be named `main.js`.
82+
Actors can also use source code from a Zip archive hosted on an external URL. This option supports multiple files and directories, allows for custom `Dockerfile`, and uses `README.md` for the Actor description. If not using a [custom Dockerfile](../actor_definition/docker.md#custom-dockerfile), ensure your main applicat file is named `main.js`.
5983

60-
## [](#github-gist)GitHub Gist
84+
:::note Automatic use of ZIP file
6185

62-
Sometimes having a full Git repository or a hosted Zip file might be overly complicated for your small project, but you still want to have the source code in multiple files. In this case, you can simply put your source code into a [GitHub Gist](https://gist.github.com/). For example:
86+
This source type is used automatically when you are using Apify-CLI and the source size exceeds `3MB`.
6387

64-
[//]: # (TODO: It's pretty outdated, we should probably update the Actor too)
65-
https://gist.github.com/jancurn/2dbe83fea77c439b1119fb3f118513e7
88+
:::
6689

67-
Then set the **Source Type** to **GitHub Gist** and paste the Gist URL as follows:
90+
## GitHub Gist
6891

69-
![GitHub Gist settings](./images/source-types-gist-settings.png)
92+
For smaller projects, GitHub Gist offers a simpler alternative to full Git repositories or hosted Zip files. To use a GitHub Gist, create your Gist at [https://gist.github.com/](https://gist.github.com/), set the **Source type** to **GitHub Gist**, and paste the Gist URL in the provided field.
7093

71-
Note that the example Actor is available in the Apify Store as [apify/example-github-gist](https://apify.com/apify/example-github-gist).
94+
Like other source types, Gists can include multiple files, directories, and a custom Dockersfile. The Actor description is taken from `README.md`.
7295

73-
Similarly, as with the [Git repository](#git-repository), the source code can consist of multiple files and directories and can contain a custom **Dockerfile**. The Actor description is taken from the <strong>README.md</strong>. If you don't use a [custom Dockerfile](../actor_definition/docker.md#custom-dockerfile), the root file of your application must be named `main.js`.
96+
By understanding these source types, you can choose the most appropriate option for hosting and deploying your Apify Actors. Each type offers unique advantages, allowing you to select the best fit for your project's size, complexity, and collaboration needs.

0 commit comments

Comments
 (0)