Stop legacy dta_service systemd units before Docker deploy (#52).

ai-server-4080 runs dta_service active/active with adama and roslin.
Disable beta_dta_wsgi/prod_dta_wsgi so port 8001/8011 are free for compose.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-09 11:45:03 -05:00
co-authored by Cursor
parent a7417345a3
commit b1b9b3bafe
4 changed files with 31 additions and 2 deletions
+1 -1
View File
@@ -190,7 +190,7 @@ After Docker install, re-SSH so the `docker` group membership takes effect.
| App | Type | Hosts | Notes | | App | Type | Hosts | Notes |
|-----|------|-------|-------| |-----|------|-------|-------|
| `company_site` | django (docker) | adama + roslin | active/active behind NPM | | `company_site` | django (docker) | adama + roslin | active/active behind NPM |
| `dta_service` | django (docker) | adama + roslin | active/active behind NPM | | `dta_service` | django (docker) | adama + roslin + ai-server-4080 | active/active behind NPM |
| `dta_webapp` | node/vite static | adama + roslin | active/active; built to `/var/www/<env>_dta_webapp`, served by web-static nginx | | `dta_webapp` | node/vite static | adama + roslin | active/active; built to `/var/www/<env>_dta_webapp`, served by web-static nginx |
Both environments (`beta`, `prod`) are deployed. Django apps use a **shared external Both environments (`beta`, `prod`) are deployed. Django apps use a **shared external
+4
View File
@@ -54,6 +54,10 @@ app_catalog:
compose_file: docker-compose.prod.yml compose_file: docker-compose.prod.yml
web_service: web web_service: web
migrate_cmd: "uv run python manage.py migrate --noinput" migrate_cmd: "uv run python manage.py migrate --noinput"
# Pre-docker deploy used venv + systemd on each host; stop before compose up.
legacy_systemd_units:
beta: beta_dta_wsgi
prod: prod_dta_wsgi
dta_webapp: dta_webapp:
type: node-static type: node-static
repo: "{{ git_base_url }}/Ditch_The_Agent/dta_webapp.git" repo: "{{ git_base_url }}/Ditch_The_Agent/dta_webapp.git"
+2 -1
View File
@@ -13,7 +13,8 @@ act_runner_enabled: true
# passphrase-less deploy key here instead. # passphrase-less deploy key here instead.
gitea_key_path: "/home/{{ admin_user }}/.ssh/gitea_deploy" gitea_key_path: "/home/{{ admin_user }}/.ssh/gitea_deploy"
# company_site prod runs here for side testing. # company_site + dta_webapp + dta_service for side testing and active/active.
# Ports MUST match adama/roslin so NPM can balance all three upstreams.
host_apps: host_apps:
- { name: company_site, env: prod, port: 8000 } - { name: company_site, env: prod, port: 8000 }
- { name: dta_webapp, env: prod, port: 8080 } - { name: dta_webapp, env: prod, port: 8080 }
+24
View File
@@ -76,6 +76,30 @@
become_user: "{{ admin_user }}" become_user: "{{ admin_user }}"
changed_when: true changed_when: true
- name: "django[{{ _project }}] legacy systemd unit"
ansible.builtin.set_fact:
_legacy_systemd: "{{ _spec.legacy_systemd_units[app_item.env] | default('') }}"
when: _spec.legacy_systemd_units is defined
- name: "django[{{ _project }}] probe legacy systemd unit"
ansible.builtin.command:
cmd: systemctl list-unit-files {{ _legacy_systemd }}.service --no-legend
register: _legacy_systemd_probe
changed_when: false
failed_when: false
become: true
when: _legacy_systemd | default('') | length > 0
- name: "django[{{ _project }}] stop legacy systemd unit"
ansible.builtin.systemd:
name: "{{ _legacy_systemd }}"
state: stopped
enabled: false
become: true
when:
- _legacy_systemd | default('') | length > 0
- _legacy_systemd_probe.stdout | default('') | length > 0
- name: "django[{{ _project }}] start containers" - name: "django[{{ _project }}] start containers"
ansible.builtin.command: ansible.builtin.command:
cmd: "docker compose -f {{ _spec.compose_file }} --env-file .env up -d --remove-orphans" cmd: "docker compose -f {{ _spec.compose_file }} --env-file .env up -d --remove-orphans"