apify-cli 1.10.1-runtime.1 → 1.10.1-runtime.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/actor.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{i as e,r as t,t as n}from"./_register-ocjWT2_T.js";t(`Actor`);for(let e of n)e.registerCommand(`actor`);await e(`actor`);export{};
2
+ import{i as e,r as t,t as n}from"./_register-CN8ALErT.js";t(`Actor`);for(let e of n)e.registerCommand(`actor`);await e(`actor`);export{};
3
3
  //# sourceMappingURL=actor.js.map
package/dist/apify.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{i as e,n as t,r as n}from"./_register-ocjWT2_T.js";n(`Apify`);for(let e of t)e.registerCommand(`apify`);await e(`apify`);export{};
2
+ import{i as e,n as t,r as n}from"./_register-CN8ALErT.js";n(`Apify`);for(let e of t)e.registerCommand(`apify`);await e(`apify`);export{};
3
3
  //# sourceMappingURL=apify.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apify-cli",
3
- "version": "1.10.1-runtime.1",
3
+ "version": "1.10.1-runtime.3",
4
4
  "description": "Apify command-line interface (CLI) helps you manage the Apify cloud platform and develop, build, and deploy Apify Actors.",
5
5
  "exports": "./dist/index.js",
6
6
  "type": "module",
@@ -87,6 +87,67 @@ apify key-value-stores set-value <storeId> <key> <value>
87
87
  apify key-value-stores keys <storeId> --json
88
88
  ```
89
89
 
90
+ ## Local Actor runtime
91
+
92
+ `apify runtime` runs a self-contained local Apify platform as a container on Docker or Podman. Use it to develop and test Actors against a platform-compatible API without touching the user's cloud account. It ships on the `runtime` npm dist-tag, not on `latest`.
93
+
94
+ **Prerequisite: Docker or Podman.** One of them must be installed and running before any `apify runtime` command works; the CLI does not install either. It uses the first engine found on PATH (Docker before Podman); `APIFY_CONTAINER_ENGINE=podman` forces Podman.
95
+
96
+ With Podman, the API socket must be served: check with `podman info --format '{{.Host.RemoteSocket.Exists}}'` (must print `true`). If it does not, run `systemctl --user enable --now podman.socket` (rootless) or `sudo systemctl enable --now podman.socket` (rootful); without systemd, `podman system service --time=0 &`. On macOS/Windows, `podman machine start` first. Rootful and rootless Podman both work.
97
+
98
+ With Docker, check with `docker info` and act on what it tells you:
99
+
100
+ - `docker info` succeeds - you are ready.
101
+ - It fails with "Cannot connect to the Docker daemon" (or similar) - Docker is installed but not running. Do not reinstall it; start the daemon:
102
+ - Docker Desktop (macOS, Windows): start the Docker Desktop app and wait until it reports running.
103
+ - Linux with systemd: `sudo systemctl start docker`.
104
+ - Sandboxes and containers without systemd (common for agent environments): `dockerd` is usually present but nothing starts it. iptables and IP forwarding are often unavailable there, so start it without them, then poll until the daemon answers:
105
+
106
+ ```sh
107
+ if ! docker info >/dev/null 2>&1; then
108
+ nohup dockerd --iptables=false --ip6tables=false > dockerd.log 2>&1 &
109
+ until docker info >/dev/null 2>&1; do sleep 1; done
110
+ fi
111
+ ```
112
+
113
+ Keep the default bridge network - `apify runtime start` publishes ports 3333 and 3000 with `-p`, which needs it. If `docker info` never succeeds, read `dockerd.log` before trying anything else.
114
+ - The `docker` command is missing - installation differs per OS and can need admin rights, so do not improvise it. Point the user at the official Docker docs and let them pick the right path:
115
+ - Docker Desktop (macOS, Windows, Linux desktop): https://docs.docker.com/get-started/get-docker/
116
+ - Docker Engine (Linux servers, headless): https://docs.docker.com/engine/install/
117
+
118
+ `apify runtime install` runs the same engine checks and prints a platform-specific hint when something is missing. It installs `apify/actor-runtime:latest` unless another image is given (for example `apify runtime install apify/actor-runtime:master-5462005` for a pinned build); `apify runtime start` runs whichever image was installed last. Only name an image when the user asks for a specific one.
119
+
120
+ **Working directory.** Install the preview CLI locally in one dedicated directory rather than globally, so it cannot replace the user's stable `apify` install. Keep the runtime data and the Actor projects you create in the same directory - everything the session produced is then in one place and easy to clean up:
121
+
122
+ ```sh
123
+ mkdir -p apify-runtime-work && cd apify-runtime-work
124
+ npm init -y >/dev/null && npm i apify-cli@runtime
125
+ APIFY=./node_modules/.bin/apify # use $APIFY for every command below
126
+ ```
127
+
128
+ **Start it and point the CLI at it.** The runtime publishes two ports on `localhost`. Export these variables in the shell you drive the CLI from (they are the same values `apify runtime -h` and `apify runtime start` print):
129
+
130
+ | Port | Service | Environment variable | Value |
131
+ | ---- | ------- | -------------------- | ----- |
132
+ | 3333 | API (Apify API compatible) | `APIFY_CLIENT_BASE_URL` | `http://localhost:3333` |
133
+ | 3000 | Console (web UI) | `APIFY_CONSOLE_URL` | `http://localhost:3000` |
134
+
135
+ ```sh
136
+ export APIFY_CLIENT_BASE_URL=http://localhost:3333
137
+ export APIFY_CONSOLE_URL=http://localhost:3000
138
+ export APIFY_DISABLE_KEYRING=1
139
+
140
+ $APIFY runtime install
141
+ $APIFY runtime start --detach --data-dir ./runtime-data # omit --detach to run in the foreground (Ctrl+C stops it)
142
+ $APIFY login --token local-dev-token # the runtime accepts any token
143
+ $APIFY actors ls --json # now talks to the local runtime
144
+ $APIFY runtime stop
145
+ ```
146
+
147
+ `APIFY_DISABLE_KEYRING=1` makes `apify login` store the token in `~/.apify/auth.json` instead of the OS keyring. Set it for agent flows: sandboxes rarely have a keyring, and the runtime token is a throwaway placeholder anyway, so there is nothing worth protecting. Note that this login still replaces whatever credentials `~/.apify/auth.json` held - fine in a throwaway sandbox, but on a developer's machine ask first or have the user run `apify login` with their real token afterwards.
148
+
149
+ Every `apify` command in that shell (`push`, `call`, `actors`, `datasets`, `api`, ...) then targets the runtime. Unset the variables (or start a new shell) to talk to the Apify cloud again. Do not set them globally for the user without asking - they silently redirect all API traffic.
150
+
90
151
  ## Scheduling and recurring runs
91
152
 
92
153
  For anything recurring or unattended (e.g. "run every 15 minutes"), use the Apify platform — **not** local `cron`, a `while` loop, or GitHub Actions. Apify Schedules run in the cloud, so they keep firing after your laptop, terminal, or agent session is shut down.