A simple app which scrapes information about Cloud Foundry orgs | Read-only mirror of https://github.com/swisscom/cf-scraper — Swisscom. Issues & pull requests at the source.
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2024-10-16 17:16:36 +02:00
.gitignore Initial commit 2019-05-27 23:07:05 +02:00
CODE_OF_CONDUCT.md Compliance bulk update. Add CODE_OF_CONDUCT.md 2024-10-16 17:16:36 +02:00
CONTRIBUTING.md Compliance bulk update. Add CONTRIBUTING.md 2024-10-16 17:16:35 +02:00
index.js Add some idle time between http requests 2019-06-18 23:07:55 +02:00
LICENSE Create LICENSE 2023-04-26 16:10:30 +02:00
manifest.yml Add some idle time between http requests 2019-06-18 23:07:55 +02:00
package-lock.json Bump lodash from 4.17.13 to 4.17.19 2020-10-03 10:30:40 +02:00
package.json Bump lodash from 4.17.13 to 4.17.19 2020-10-03 10:29:54 +02:00
README.md Add some details to README 2019-06-18 21:58:51 +02:00

cf-scraper

A simple app which scrapes information about Cloud Foundry orgs

How to deploy

Prepare the service instances

cf-scraper gets the credentials for accessing the Cloud Foundry API via a service of type secret-store. Furthermore, it gets the list input orgs from an S3 service instance and also writes the scrape output to that S3 service instance.

  1. Create a user in your Cloud Foundry instance with the role cloud_controller.global_auditor.
uaac user add $AUDITOR_USER_NAME --emails $AUDITOR_EMAIL;
uaac member add cloud_controller.global_auditor $AUDITOR_USERNAME;
  1. Create a secrets store called cf-api-credentials.
cf cs secrets-store json cf-api-credentials -c '{"username": "'$AUDITOR_USER_NAME'", "password": "'$AUDITOR_PASSWORD'"}'
  1. Create an S3 service instance named orgs-store.
cf cs dynstrg-2 usage orgs-store

Load the input orgs

The scraper uses a file called input/input-orgs.json in the orgs-store instance. The list can be changed at any time. The scraper will pick up the latest version when it starts the next run.

  1. Prepare the file input-orgs.json to contain an array of org names.
[
  "org-1",
  "org-2",
  "org-3",
  ...,
  "org-n"
]
  1. Upload the file to orgs-store/input, for example using mc.

Adapt the schedule

The scraper runs as a scheduled task. The schedule is defined as a cron expression in the environment variable SYNC_SCHEDULE.

  1. Open manifest.yml and set SYNC_SCHEDULE to the desired cron expression (e.g. */15 * * * * for "at every 15th minute").

Push the app

  1. Everything else is self configuring. Just push the app.
cf push

Collect the scrape result

The scraper uploads the result of a scrape run to orgs-store/output/scrape-result.json. Before starting the upload, a backup copy of the previous result is made called scrape-result-backup.json.

  1. Download orgs-store/output/scrape-result.json, for example using mc.