browsertrix/backend/btrixcloud/swarm/templates/crawl_job.yaml
Ilya Kreymer 418c07bf0d
Local swarm + podman support (#261)
* backend: refactor swarm support to also support podman (#260)
- implement podman support as subclass of swarm deployment
- podman is used when 'RUNTIME=podman' env var is set
- podman socket is mapped instead of docker socket
- podman-compose is used instead of docker-compose (though docker-compose works with podman, it does not support secrets, but podman-compose does)
- separate cli utils into SwarmRunner and PodmanRunner which extends it
- using config.yaml and config.env, both copied from sample versions
- work on simplifying config: add docker-compose.podman.yml and docker-compose.swarm.yml and signing and debug configs in ./configs
- add {build,run,stop}-{swarm,podman}.sh in scripts dir
- add init-configs, only copy if configs don't exist
- build local image use current version of podman, to support both podman 3.x and 4.x
- additional fixes for after testing podman on centos
- docs: update Deployment.md to cover swarm, podman, k8s deployment
2022-06-14 00:13:49 -07:00

68 lines
1.4 KiB
YAML

version: '3.9'
services:
job:
image: {{ job_image }}
command: ["uvicorn", "btrixcloud.swarm.crawl_job:app", "--host", "0.0.0.0", "--access-log", "--log-level", "info"]
container_name: job-{{ id }}_job
security_opt:
- "label=disable"
secrets:
- btrix_shared_job_config.yaml
- crawl-opts-{{ cid }}
volumes:
- {{ socket_src }}:{{ socket_dest }}:z
networks:
- btrix
deploy:
replicas: {{ 1 if not schedule else 0 }}
labels:
btrix.run.manual: "{{ manual }}"
btrix.user: {{ userid }}
btrix.archive: {{ aid }}
btrix.crawlconfig: {{ cid }}
{% if schedule %}
swarm.cronjob.enable: "true"
swarm.cronjob.skip-running: "true"
swarm.cronjob.schedule: "{{ schedule }}"
{% endif %}
mode: replicated
restart_policy:
condition: none
environment:
SHARED_JOB_CONFIG: btrix_shared_job_config.yaml
CUSTOM_JOB_CONFIG: crawl-opts-{{ cid }}
JOB_ID: "{{ id }}"
STACK_PREFIX: "crawl-"
STORE_PATH: "{{ storage_path }}"
STORAGE_NAME: "{{ storage_name }}"
PROFILE_PATH: "{{ profile_path }}"
MONGO_DB_URL: "{{ mongo_db_url }}"
RUN_MANUAL: "{{ manual }}"
RUNTIME: "{{ runtime }}"
networks:
btrix:
external:
name: btrix-net
secrets:
btrix_shared_job_config.yaml:
external: true
crawl-opts-{{ cid }}:
external: true