access service from worker instance

22 Views Asked by At

I successfully created a worker using this https://docs.digitalocean.com/developer-center/how-to-setup-a-job-scheduler-on-digitalocean-app-platform/, while this is very easy and uses curl as an example, my problem is I need to run php script from the service instance so I need the crontab to access the service outside the worker container to run a php script e.g. /workspace/.heroku/php/bin/php /workspace/bin/console mautic:segments:update. I know I can access the internal service via exposed port 8080 by http://<name>:<port> but due to security concern, I would like to directly access the service rather than using http.

appspec is similar to this

alerts:
- rule: DEPLOYMENT_FAILED
- rule: DOMAIN_FAILED
name: walrus-app
region: nyc
services:
- environment_slug: node-js
  git:
    branch: main
    repo_clone_url: https://github.com/digitalocean/sample-nodejs.git
  http_port: 8080
  instance_count: 1
  instance_size_slug: basic-xxs
  name: sample-nodejs
  routes:
  - path: /
  run_command: yarn start
  source_dir: /
workers:
- dockerfile_path: Dockerfile
  github:
    branch: main
    deploy_on_push: true
    repo: DO-Solutions/Docker-cron
  instance_count: 1
  instance_size_slug: basic-xxs
  name: Docker-cron
  source_dir: /

any help is greatly appreciated.

0

There are 0 best solutions below