Skip to content

Commit

Permalink
Merge pull request #1067 from honzajavorek/honzajavorek/actor-spelling
Browse files Browse the repository at this point in the history
fix(academy): capitalize 'actors' and 'actor'
  • Loading branch information
honzajavorek authored Jun 17, 2024
2 parents 3a003a2 + 9eecadf commit e02505d
Show file tree
Hide file tree
Showing 54 changed files with 472 additions and 460 deletions.
16 changes: 14 additions & 2 deletions .github/styles/Apify/Capitalization.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@ message: "The word '%s' should always be capitalized."
ignorecase: false
level: error
tokens:
- '(?<!\W)\bactor\b'
- '(?<!\W)\bactors\b'
# Before the word there should be no: /, -, #, word character
# (avoids anchors, URLs, identifiers, and words like 'factors')
#
# After the word there should be no: /, } (avoids paths or URLs)
# Also no . followed by a word character (avoids 'actors.md')
- '(?<![\/\-#\w])actors(?![\/\}])(?!\.\w)'

# Before the word there should be no: /, -, #, ., word character
# (avoids anchors, URLs, identifiers, code, and words like 'factors')
#
# After the word there should be no: /, }, -, word character (avoids paths or URLs)
# Also no " =" (avoids code like "actor = ...")
# Also no . followed by a word character (avoids 'actor.md' or 'actor.update()')
- '(?<![\/\-#\.\w`])actor(?![\/\}\-\w])(?! =)(?!\.\w)'
nonword: false
2 changes: 1 addition & 1 deletion sources/academy/glossary/tools/apify_cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ slug: /tools/apify-cli

---

The [Apify CLI](/cli) helps you create, develop, build and run Apify actors, and manage the Apify cloud platform from any computer. It can be used to automatically generate the boilerplate for different types of projects, initialize projects, remotely call actors on the platform, and run your own projects.
The [Apify CLI](/cli) helps you create, develop, build and run Apify Actors, and manage the Apify cloud platform from any computer. It can be used to automatically generate the boilerplate for different types of projects, initialize projects, remotely call Actors on the platform, and run your own projects.

## Installing {#installing}

Expand Down
4 changes: 2 additions & 2 deletions sources/academy/platform/apify_platform.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ slug: /apify-platform

---

The [Apify platform](https://apify.com) was built to serve large-scale and high-performance web scraping and automation needs. It provides easy access to compute instances ([actors](./getting_started/actors.md)), convenient request and result storages, proxies, scheduling, webhooks and more - all accessible through the **Console** web interface, [Apify's API](/api/v2), or our [JavaScript](/api/client/js) and [Python](/api/client/python) API clients.
The [Apify platform](https://apify.com) was built to serve large-scale and high-performance web scraping and automation needs. It provides easy access to compute instances ([Actors](./getting_started/actors.md)), convenient request and result storages, proxies, scheduling, webhooks and more - all accessible through the **Console** web interface, [Apify's API](/api/v2), or our [JavaScript](/api/client/js) and [Python](/api/client/python) API clients.

## Category outline {#this-category}

In this category, you'll learn how to become an Apify platform developer from the ground up. From creating your first account, to developing actors, this is your one-stop-shop for understanding how the platform works, and how to work with it.
In this category, you'll learn how to become an Apify platform developer from the ground up. From creating your first account, to developing Actors, this is your one-stop-shop for understanding how the platform works, and how to work with it.

## First up {#first}

Expand Down
24 changes: 12 additions & 12 deletions sources/academy/platform/deploying_your_code/deploying.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
---
title: Deploying
description: Push local code to the platform, or create a new actor on the console and integrate it with a Git repo to optionally automatically rebuild any new changes.
description: Push local code to the platform, or create a new Actor on the console and integrate it with a Git repo to optionally automatically rebuild any new changes.
sidebar_position: 5
slug: /deploying-your-code/deploying
---

# Deploying {#deploying}

**Push local code to the platform, or create a new actor on the console and integrate it with a Git repo to optionally automatically rebuild any new changes.**
**Push local code to the platform, or create a new Actor on the console and integrate it with a Git repo to optionally automatically rebuild any new changes.**

---

Once you've **actorified** your code, there are two ways to deploy it to the Apify platform. You can either push the code directly from your local machine onto the platform, or you can create a blank actor in the web interface, and then integrate its source code with a GitHub repository.
Once you've **actorified** your code, there are two ways to deploy it to the Apify platform. You can either push the code directly from your local machine onto the platform, or you can create a blank Actor in the web interface, and then integrate its source code with a GitHub repository.

## With a Git repository {#with-git-repository}

Before we deploy our project onto the Apify platform, let's ensure that we've pushed the changes we made in the last 3 lessons into our remote GitHub repository.

> The benefit of using this method is that any time you push to the Git repo, the code on the platform is also updated and the actor is automatically rebuilt. Also, you don't have to use a GitHub repository - you can use GitLab or any other service you'd like.
> The benefit of using this method is that any time you push to the Git repo, the code on the platform is also updated and the Actor is automatically rebuilt. Also, you don't have to use a GitHub repository - you can use GitLab or any other service you'd like.
### Creating the actor
### Creating the Actor

Before anything can be integrated, we've gotta create a new actor. Luckily, this is super easy to do. Let's head over to our [Apify Console](https://console.apify.com?asrc=developers_portal) and click on the **New** button, then select the **Empty** template.
Before anything can be integrated, we've gotta create a new Actor. Luckily, this is super easy to do. Let's head over to our [Apify Console](https://console.apify.com?asrc=developers_portal) and click on the **New** button, then select the **Empty** template.

![Create new button](../getting_started/images/create-new-actor.png)

Easy peasy!

### Changing source code location {#change-source-code}

In the **Source** tab on the new actor's page, we'll click the dropdown menu under **Source code** and select **Git repository**. By default, this is set to **Web IDE**.
In the **Source** tab on the new Actor's page, we'll click the dropdown menu under **Source code** and select **Git repository**. By default, this is set to **Web IDE**.

![Select source code location](../expert_scraping_with_apify/images/select-source-location.png)

Now we'll paste the link to our GitHub repository into the **Git URL** text field and click **Save**.

### Adding the webhook to the repository {#adding-repo-webhook}

The final step is to click on **API** in the top right corner of our actor's page:
The final step is to click on **API** in the top right corner of our Actor's page:

![API button](../expert_scraping_with_apify/images/api-button.jpg)

Expand All @@ -55,15 +55,15 @@ If you're logged in to the Apify CLI, the `apify push` command can be used to pu

One important thing to note is that you can use a `.gitignore` file to exclude files from being pushed. When you use `apify push` without a `.gitignore`, the full folder contents will be pushed, meaning that even the **storage** and **node_modules** will be pushed. These files are unnecessary to push, as they are both generated on the platform.

> The `apify push` command should only really be used for quickly pushing and testing actors on the platform during development. If you are ready to make your actor public, use a Git repository instead, as you will reap the benefits of using Git and others will be able to contribute to the project.
> The `apify push` command should only really be used for quickly pushing and testing Actors on the platform during development. If you are ready to make your Actor public, use a Git repository instead, as you will reap the benefits of using Git and others will be able to contribute to the project.
## Deployed! {#deployed}

Great! Once you've pushed your actor to the platform, you should see it in the list of actors under the **Actors** tab. If you used `apify push`, you'll have access to the **multifile editor** (discussed [here](../getting_started/creating_actors.md)).
Great! Once you've pushed your Actor to the platform, you should see it in the list of Actors under the **Actors** tab. If you used `apify push`, you'll have access to the **multifile editor** (discussed [here](../getting_started/creating_actors.md)).

![Deployed actor on the Apify platform](./images/actor-page.jpg)
![Deployed Actor on the Apify platform](./images/actor-page.jpg)

The next step is to test your actor and experiment with the vast amount of features the platform has to offer.
The next step is to test your Actor and experiment with the vast amount of features the platform has to offer.

## Wrap up {#next}

Expand Down
24 changes: 12 additions & 12 deletions sources/academy/platform/deploying_your_code/docker_file.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ import TabItem from '@theme/TabItem';

---

The **Dockerfile** is a file which gives the Apify platform (or Docker, more specifically) instructions on how to create an environment for your code to run in. Every actor must have a Dockerfile, as actors run in Docker containers.
The **Dockerfile** is a file which gives the Apify platform (or Docker, more specifically) instructions on how to create an environment for your code to run in. Every Actor must have a Dockerfile, as Actors run in Docker containers.

> Actors on the platform are always run in Docker containers; however, they can also be run in local Docker containers. This is not common practice though, as it requires more setup and a deeper understanding of Docker. For testing, it's best to just run the actor on the local OS (this requires you to have the underlying runtime installed, such as Node.js, Python, Rust, GO, etc).
> Actors on the platform are always run in Docker containers; however, they can also be run in local Docker containers. This is not common practice though, as it requires more setup and a deeper understanding of Docker. For testing, it's best to just run the Actor on the local OS (this requires you to have the underlying runtime installed, such as Node.js, Python, Rust, GO, etc).
## Base images {#base-images}

If your project doesn’t already contain a Dockerfile, don’t worry! Apify offers [many base images](/sdk/js/docs/guides/docker-images) that are optimized for building and running actors on the platform, which can be found [here](https://hub.docker.com/u/apify). When using a language for which Apify doesn't provide a base image, [Docker Hub](https://hub.docker.com/) provides a ton of free Docker images for most use-cases, upon which you can create your own images.
If your project doesn’t already contain a Dockerfile, don’t worry! Apify offers [many base images](/sdk/js/docs/guides/docker-images) that are optimized for building and running Actors on the platform, which can be found [here](https://hub.docker.com/u/apify). When using a language for which Apify doesn't provide a base image, [Docker Hub](https://hub.docker.com/) provides a ton of free Docker images for most use-cases, upon which you can create your own images.

> Tip: You can see all of Apify's Docker images [on DockerHub](https://hub.docker.com/r/apify/).
Expand All @@ -38,9 +38,9 @@ FROM apify/actor-node:16

The rest of the Dockerfile is about copying the source code from the local filesystem into the container's filesystem, installing libraries, and setting the `RUN` command (which falls back to the parent image).

> If you are not using a base image from Apify, then you should specify how to launch the source code of your actor with the `CMD` instruction.
> If you are not using a base image from Apify, then you should specify how to launch the source code of your Actor with the `CMD` instruction.
Here's the Dockerfile for our Node.js example project's actor:
Here's the Dockerfile for our Node.js example project's Actor:

<Tabs groupId="main">
<TabItem value="Node.js Dockerfile" label="Node.js Dockerfile">
Expand Down Expand Up @@ -78,7 +78,7 @@ COPY . ./
# You can also use any other image from Docker Hub.
FROM apify/actor-python:3.9

# Second, copy just requirements.txt into the actor image,
# Second, copy just requirements.txt into the Actor image,
# since it should be the only file that affects "pip install" in the next step,
# in order to speed up the build
COPY requirements.txt ./
Expand All @@ -100,7 +100,7 @@ RUN echo "Python version:" \
# for most source file changes.
COPY . ./

# Specify how to launch the source code of your actor.
# Specify how to launch the source code of your Actor.
# By default, the main.py file is run
CMD python3 main.py

Expand All @@ -111,10 +111,10 @@ CMD python3 main.py

## Examples {#examples}

The examples we just showed were for Node.js and Python, however, to drive home the fact that actors can be written in any language, here are some examples of some Dockerfiles for actors written in different programming languages:
The examples we just showed were for Node.js and Python, however, to drive home the fact that Actors can be written in any language, here are some examples of some Dockerfiles for Actors written in different programming languages:

<Tabs groupId="main">
<TabItem value="GO actor Dockerfile" label="GO actor Dockerfile">
<TabItem value="GO Actor Dockerfile" label="GO Actor Dockerfile">

```Dockerfile
FROM golang:1.17.1-alpine
Expand All @@ -130,7 +130,7 @@ CMD ["/example-actor"]
```

</TabItem>
<TabItem value="Rust actor Dockerfile" label="Rust actor Dockerfile">
<TabItem value="Rust Actor Dockerfile" label="Rust Actor Dockerfile">

```Dockerfile
# Image with prebuilt Rust. We use the newest 1.* version
Expand Down Expand Up @@ -163,7 +163,7 @@ CMD ["./target/release/actor-example"]
```

</TabItem>
<TabItem value="Julia actor Dockerfile" label="Julia actor Dockerfile">
<TabItem value="Julia Actor Dockerfile" label="Julia Actor Dockerfile">

```Dockerfile
FROM julia:1.7.1-alpine
Expand All @@ -182,4 +182,4 @@ CMD ["julia", "main.jl"]

## Next up {#next}

In the [next lesson](./deploying.md), we'll push our code directly to the Apify platform, or create and integrate a new actor on the Apify platform with our project's GitHub repository.
In the [next lesson](./deploying.md), we'll push our code directly to the Apify platform, or create and integrate a new Actor on the Apify platform with our project's GitHub repository.
20 changes: 10 additions & 10 deletions sources/academy/platform/deploying_your_code/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Deploying your code
description: In this course learn how to take an existing project of yours and deploy it to the Apify platform as an actor in just a few minutes!
description: In this course learn how to take an existing project of yours and deploy it to the Apify platform as an Actor in just a few minutes!
sidebar_position: 9
category: apify platform
slug: /deploying-your-code
Expand All @@ -11,29 +11,29 @@ import TabItem from '@theme/TabItem';

# Deploying your code to Apify {#deploying}

**In this course learn how to take an existing project of yours and deploy it to the Apify platform as an actor in just a few minutes!**
**In this course learn how to take an existing project of yours and deploy it to the Apify platform as an Actor in just a few minutes!**

---

This section will discuss how to use your newfound knowledge of the Apify platform and actors from the [**Getting started**](../getting_started/index.md) section to deploy your existing project's code to the Apify platform as an actor.
This section will discuss how to use your newfound knowledge of the Apify platform and Actors from the [**Getting started**](../getting_started/index.md) section to deploy your existing project's code to the Apify platform as an Actor.

Because actors are basically just chunks of code running in Docker containers, you're able to **_Actorify_** just about anything!
Because Actors are basically just chunks of code running in Docker containers, you're able to **_Actorify_** just about anything!

![The deployment workflow](../../images/deployment-workflow.png)

Actors are language agnostic, which means that the language your project is written in does not affect your ability to actorify it.

![Supported languages](../../images/supported-languages.jpg)

Though the majority of actors currently on the platform were written in Node.js, and despite the fact our current preferred languages are JavaScript and Python, there are a few examples of actors in other languages:
Though the majority of Actors currently on the platform were written in Node.js, and despite the fact our current preferred languages are JavaScript and Python, there are a few examples of Actors in other languages:

- [Actor written in Rust](https://apify.com/lukaskrivka/rust-actor-example)
- [GO actor](https://apify.com/jirimoravcik/go-actor-example)
- [GO Actor](https://apify.com/jirimoravcik/go-actor-example)
- [Actor written with Julia](https://apify.com/jirimoravcik/julia-actor-example)

## The "actorification" workflow {#workflow}

There are four main steps to turning a piece of code into an actor:
Follow these four main steps to turn a piece of code into an Actor:

1. Handle [accepting inputs and writing outputs](./inputs_outputs.md).
2. Create an [input schema](./input_schema.md) **(optional)**.
Expand All @@ -42,7 +42,7 @@ There are four main steps to turning a piece of code into an actor:

## Our example project

For this section, we'll be turning this example project into an actor:
For this section, we'll be turning this example project into an Actor:

<Tabs groupId="main">
<TabItem value="JavaScript" label="JavaScript">
Expand Down Expand Up @@ -76,8 +76,8 @@ print(add_all_numbers([1, 2, 3, 4])) # -> 10

> For all lessons in this section, we'll have examples for both Node.js and Python so that you can follow along in either language.
<!-- We've pushed this code to GitHub and are ready to turn it into an actor that takes any number of integers as input, adds them all up, then stores the solution as its output. -->
<!-- We've pushed this code to GitHub and are ready to turn it into an Actor that takes any number of integers as input, adds them all up, then stores the solution as its output. -->

## Next up {#next}

[Next lesson](./inputs_outputs.md), we'll be learning how to accept input into our actor as well as deliver output.
[Next lesson](./inputs_outputs.md), we'll be learning how to accept input into our Actor as well as deliver output.
Loading

0 comments on commit e02505d

Please sign in to comment.