-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy-dev.yml
More file actions
112 lines (91 loc) · 2.59 KB
/
Copy pathdeploy-dev.yml
File metadata and controls
112 lines (91 loc) · 2.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: sampleapp
environment: dev
python_version: "3.11"
repo: https://github.com/unomena/deployment-tool-sample-app.git
dependencies:
system:
- postgresql-client
- redis-tools
- git
- curl
python-requirements:
- requirements.txt
env_vars:
DJANGO_SETTINGS_MODULE: "sampleapp.settings"
SECRET_KEY: "django-insecure-dev-key-change-in-production"
DEBUG: "True"
ALLOWED_HOSTS: "localhost,127.0.0.1,0.0.0.0"
# Database configuration (application credentials)
DB_NAME: "sampleapp_dev"
DB_USER: "sampleapp_user"
DB_PASSWORD: "sampleapp_password"
DB_HOST: "localhost"
DB_PORT: "5432"
# Redis configuration
REDIS_URL: "redis://localhost:6379/0"
# Superuser configuration
DEFAULT_SUPERUSER_USERNAME: "admin"
DEFAULT_SUPERUSER_PASSWORD: "admin123"
DEFAULT_SUPERUSER_EMAIL: "admin@sampleapp.local"
database:
type: postgresql
name: ${DB_NAME}
user: ${DB_USER}
password: ${DB_PASSWORD}
host: ${DB_HOST}
port: ${DB_PORT}
services:
- name: web
type: gunicorn
command: "gunicorn sampleapp.wsgi:application --timeout 120 --keep-alive 5 --max-requests 1000 --max-requests-jitter 100"
workers: 2
port: 8000
directory: src
- name: worker
type: celery
command: "celery -A sampleapp worker -l info"
workers: 2
directory: src
- name: beat
type: celery
command: "celery -A sampleapp beat -l info"
directory: src
hooks:
pre_deploy:
- script: "verify-postgresql-database.sh"
description: "Verifying PostgreSQL database and creating if not exists"
allow_failure: false
post_deploy:
- script: "validate-django-environment.sh"
description: "Validating Django environment and database connection"
allow_failure: false
- script: "run-django-migrations.sh"
description: "Running Django database migrations"
allow_failure: false
- script: "create-django-superuser.sh"
description: "Creating Django superuser"
allow_failure: true
- script: "run-unit-tests.sh"
description: "Running unit tests and health check validation"
allow_failure: false
health_checks:
- name: web_health
url: "http://localhost:8000/"
timeout: 30
retries: 3
- name: comprehensive_health
url: "http://localhost:8000/health/"
timeout: 15
retries: 3
- name: readiness_probe
url: "http://localhost:8000/health/readiness/"
timeout: 10
retries: 2
- name: liveness_probe
url: "http://localhost:8000/health/liveness/"
timeout: 5
retries: 2
rollback:
enabled: true
keep_releases: 3
health_check_timeout: 60