Python 3.x
Introduction
This image is suitable for deploying python jobs managed by supervisord. Supervisor jobs conf files can be kept int he jobs folder and python requirements.txt can be placed in the root of the project
Stack Code
- python-v3 - To be mentioned in
build.image_template
inappz.yml
. See Sammple AppZ Yaml.
Sample Project
- Wiki Data - This project has a job that pull data from Google big table and uses Grafana to display charts of Wikipedia visitor data.
Sample AppZ YAML
Name: appz.yml
. To be placed in the root of your git repo.
app:
code: WIKIDATA
name: WikiData
notify: appzdev@cloudbourne.co
build:
build_file: none
env: DEV
image_name: myco/wikidata
image_template: python-v3
output_files: output/*.zip
version: 0.2
deploy:
context: myco/DEV
port:
- 80
replicas: 1
properties:
FETCH_MIN: 30000
FETCH_MAX: 300000
BATCH_SLEEP: 10
BATCH_SIZE: 10000
CRED_JSON_PATH:
vault: CRED_JSON_PATH
revision: 6
Environment Variables
There are no image specific environment variables for this image. The image is vault enabled so secrets can be pulled from vault using the vault:
as the value of an environment variable under properties
in appz.yml
. See CRED_JSON_PATH
above.
Resilience
- Capable of running unlimited number of replicas across multiple regions/datacenters.
- Job scheduling accross multiple instance will be application's responsibility
Volumes
- No requirements of volume unless applications need them
- Standard AppZ Volumes are enabled.
Sample Job Conf
Any number of supervisor job conf files are allowed in the jobs
folder in the root of your repo. Here is an example as used in the our sample repo - Wiki Data. When refering to python file in the job use relative path from teh root or the repo without the / at the beginning.
[program:wikidata]
command = python3 wikidata/scripts/wiki_data.py
startretries = 3
autostart = true
autorestart = true
stdout_logfile = /appz/log/%(program_name)s.log
stderr_logfile = /appz/log/%(program_name)s.log
redirect_stderr = true
Please refer Supervisor Configuration File Documentation for more details.