mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 10:59:59 +00:00
Memcached, Joomla, Moodle, Odoo, Shopware, Snipe-IT and SuiteCRM set
their cache size, PHP memory_limit, OPcache, worker limits and search
heap as literals next to a mem_limit they never read. They now ask
lookup('service_memory_mb') for a share of that limit. The shares are
chosen so every rendered value stays what it was.
Where the parameter lives in a file that cannot hold a template, the
value is handed in: Shopware's init script reads INIT_PHP_MEMORY_LIMIT
and refuses to start without it, SuiteCRM's image takes it as a build
argument. Shopware's worker gets --memory-limit as a command appended
to its entrypoint, and Moodle's OPcache size moves from the static ini
into the rendered one.
The performance.php.memory_limit keys of Joomla and Moodle are gone
from services.yml; nothing else read them.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
48 lines
1.6 KiB
YAML
48 lines
1.6 KiB
YAML
---
|
|
- name: ⏳ Wait until application container is up
|
|
ansible.builtin.shell: >-
|
|
container ps
|
|
--filter {{ ('label=com.docker.swarm.service.name=' ~ lookup('container_service', application_id, SNIPE_IT_SERVICE)) if DEPLOYMENT_MODE == 'swarm' else ('name=^'
|
|
~ lookup('container_service', application_id, SNIPE_IT_SERVICE) ~ '$') }}
|
|
--format '{% raw %}{{.ID}}{% endraw %}'
|
|
register: snipeit_app_id
|
|
retries: 30
|
|
delay: 5
|
|
until: snipeit_app_id.stdout | length > 0
|
|
changed_when: false
|
|
|
|
- name: "⏳ Wait until the Snipe-IT Service is available"
|
|
uri_retry:
|
|
url: "{{ SNIPE_IT_URL }}"
|
|
method: GET
|
|
return_content: false
|
|
status_code: 200
|
|
register: snipeit_admin_check
|
|
retries: 30
|
|
delay: 5
|
|
until: snipeit_admin_check.status == 200
|
|
|
|
- name: ▶️ Run Snipe-IT migrations (idempotent)
|
|
ansible.builtin.shell: >-
|
|
container exec -i
|
|
-e APP_KEY="{{ SNIPE_IT_APP_KEY }}"
|
|
-e XDG_CONFIG_HOME=/tmp
|
|
{{ SNIPE_IT_CONTAINER_ADDRESS }}
|
|
php artisan migrate --force
|
|
register: snipeit_migrate
|
|
changed_when: >
|
|
('Migrating:' in snipeit_migrate.stdout)
|
|
or ('Migrated:' in snipeit_migrate.stdout)
|
|
failed_when: snipeit_migrate.rc != 0
|
|
|
|
- name: 🌱 Seed Snipe-IT database (optional, safe to rerun if seeder is idempotent)
|
|
ansible.builtin.shell: >-
|
|
container exec -i
|
|
-e APP_KEY="{{ SNIPE_IT_APP_KEY }}"
|
|
-e XDG_CONFIG_HOME=/tmp
|
|
{{ SNIPE_IT_CONTAINER_ADDRESS }}
|
|
php -d memory_limit={{ lookup('service_memory_mb', application_id, SNIPE_IT_SERVICE, 0.25) }}M artisan db:seed --force
|
|
register: snipeit_seed
|
|
changed_when: "'Seeding:' in snipeit_seed.stdout"
|
|
failed_when: snipeit_seed.rc != 0
|