Skip to content

Commit e1d2d31

Browse files
authored
feat: Improve Standby docs (#1150)
There were some questions on Discord how to find out if an Actor is started in Standby mode, or normally. This should answer them. I've also added a tip about Standby in the Container web server docs. This needs apify/apify-sdk-js#320 released.
1 parent 0bfe8c6 commit e1d2d31

File tree

3 files changed

+46
-1
lines changed

3 files changed

+46
-1
lines changed

sources/platform/actors/development/programming_interface/actor_standby.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,44 @@ async def main() -> None:
7272
Please make sure to describe your Actors, their endpoints, and the schema for their
7373
inputs and outputs in your README.
7474

75+
## How do I find out whether my Actor is started in Standby or standard mode
76+
77+
Actors that support Actor Standby can still be started in standard mode, for example from the Console or via the API.
78+
To find out in which mode was the Actor started, you can read the `metaOrigin` option in `Actor.config`, or the `APIFY_META_ORIGIN` environment variable in case you're not using the Apify SDK.
79+
If it is equal to `STANDBY`, the Actor was started in Standby mode, otherwise it was started in standard mode.
80+
81+
<Tabs groupId="main">
82+
<TabItem value="JavaScript" label="JavaScript">
83+
84+
```js
85+
import { Actor } from 'apify';
86+
87+
await Actor.init();
88+
89+
if (Actor.config.get('metaOrigin') === 'STANDBY') {
90+
// Start your Standby server here
91+
} else {
92+
// Perform the standard Actor operations here
93+
}
94+
```
95+
96+
</TabItem>
97+
<TabItem value="Python" label="Python">
98+
99+
```python
100+
from apify import Actor
101+
102+
async def main() -> None:
103+
async with Actor:
104+
if Actor.config.meta_origin == 'STANDBY':
105+
# Start your Standby server here
106+
else:
107+
# Perform the standard Actor operations here
108+
```
109+
110+
</TabItem>
111+
</Tabs>
112+
75113
## Can I monetize my Actor in the Standby mode
76114

77-
No, Standby mode is in Beta, and monetization is not supported.
115+
No, Standby mode is in Beta, and monetization is currently not supported.

sources/platform/actors/development/programming_interface/container_web_server.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ import TabItem from '@theme/TabItem';
1414

1515
Each Actor run is assigned a unique URL (e.g. `kmdo7wpzlshygi.runs.apify.net`) that allows HTTP access to an optional web server running inside the Actor's Docker container. This feature enhances your Actor's capabilities by enabling external communication.
1616

17+
:::tip Using Actors as an API
18+
19+
The container web server provides a way how to connect to one specific Actor run. To enable using your Actor as an API, with a pre-defined hostname, load balancing and autoscaling, check out [Actor Standby](./actor_standby.md).
20+
21+
:::
22+
1723
## Access the container URL
1824

1925
You can find the container URL in three locations:

sources/platform/actors/running/runs_and_builds.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ All **Actor runs** have an **Origin** field indicating where the Actor run was i
5050
|SCHEDULER|Using a Schedule|
5151
|WEBHOOK|Using a webhook|
5252
|ACTOR|From another Actor run|
53+
|STANDBY|From Actor Standby|
5354

5455
## Lifecycle
5556

0 commit comments

Comments
 (0)