The actor config previously stored in apify.json
has been deprecated in favor of .actor/actor.json
. The new config
follows a very similar structure, and it looks like this:
{
"actorSpecification": 1,
"name": "name-of-my-scraper", // same as before
"version": "0.0", // same as before
"buildTag": "latest", // same as before
"environmentVariables": {}, // same as 'env' field before
"dockerfile": "./Dockerfile", // if omitted, it checks "./Dockerfile" and "../Dockerfile"
"readme": "./ACTOR.md", // if omitted, it checks "./ACTOR.md", "./README.md" and "../README.md"
"input": "./input_schema.json", // either embedded object or path to json. If omitted, it checks ./INPUT_SCHEMA.json and ../INPUT_SCHEMA.json
"storages": {
"dataset": "./dataset_schema.json" // either embedded object or path to json
}
}
When running any CLI script that uses the config, you will be prompted to automatically migrate the old format to the new format in order to proceed.
Alternatively, you can always update it manually. The old config apify.json
can be safely deleted after migration unless you store in there some
information specific for your use case.
All commands will then honor the new config stored in .actor/actor.json
.
Before commands apify run and apify push CLI will ask if you want to migrate your current apify.json to a new structure. You can simply confirm that and apify.json will be updated to a new structure.
You can do it manually with these steps:
- Remove attributes
actId
. - Replace the value of attribute
version
with the value fromversion.versionNumber
. - Move attribute
buildTag
to the root of JSON. - Create attribute
env
and convert there array fromversion.envVars
. All values undername
will be keys and values fromvalue
will be values ofenv
object.
{
"name": "dataset-to-mysql",
"actId": "drobnikj/dataset-to-mysql",
"version": {
"versionNumber": "0.1",
"buildTag": "latest",
"envVars": [
{
"name": "MYSQL_USER",
"value": "my_username"
},
{
"name": "MYSQL_PASSWORD",
"value": "my_secret_password"
}
],
"sourceType": "TARBALL",
"tarballUrl": "https://api.apify.com/v2/key-value-stores/something/records/dataset-to-mysql-0.1.zip?disableRedirect=true"
},
"template": "basic"
}
{
"name": "dataset-to-mysql",
"version": "0.1",
"buildTag": "latest",
"env": {
"MYSQL_USER": "my_username",
"MYSQL_PASSWORD": "@mySecretPassword"
},
"template": "basic"
}
Default local directory name used for apify storage has changed from apify_local
to apify_storage
.
If you are using apify local storage in your project then you need to rename storage directories:
apify_local
->apify_storage
apify_local/key-value-stores
->apify_storage/key_value_stores
apify_local/request-queues
->apify_storage/request_queues
CLI uses npm start
to run actor instead of node main.js
in version 0.2._ .
If you want to run your project after updating to 0.2._, you need to add start script node main.js
to the scripts field of package.json.
{
...
"scripts": {
"start": "node main.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
...
}