saltstack-magento-example/salt/srv/salt/base/magento/init.sls

35 lines
2.1 KiB
Plaintext

{% for vhost, config in pillar["vhosts"].items() %}
Deploy magento for {{ vhost }}:
module.run:
- name: docker.run
- m_name: php-fpm-{{ vhost }}
- cmd: |
COMPOSER_HOME=/var/www/html \
COMPOSER_AUTH="{\"http-basic\": {\"repo.magento.com\": {\"username\": \"{{ config.magento_marketplace_public }}\",\"password\":\"{{ config.magento_marketplace_private }}\" }}}" \
sudo -E -u www-data composer create-project --working-dir=/app --repository-url=https://repo.magento.com/ magento/project-community-edition=2.4.6 /app
Setup magento for {{ vhost }}:
module.run:
- name: docker.run
- m_name: php-fpm-{{ vhost }}
- cmd: |
sudo -E -u www-data php -dmemory_limit={{ config.php_maxmem_deploy }} -f bin/magento setup:install --base-url=http://{{ vhost }}:{{ config.nginx_port }} --db-host=mysql-{{ vhost }} --db-name={{ config.mysql_database }} --db-user={{ config.mysql_user }} --db-password={{ config.mysql_password }} --admin-firstname={{ config.magento_admin_firstname }} --admin-lastname={{ config.magento_admin_lastname }} --admin-email={{ config.magento_admin_email }} --admin-user={{ config.magento_admin_user }} --admin-password={{ config.magento_admin_pass }} --language=en_US --currency=USD --timezone=Europe/Bratislava --use-rewrites=1 --elasticsearch-host=elasticsearch-{{ vhost }} --search-engine=elasticsearch7
{% if config.magento_sample_products %}
Deploy sampledata for {{ vhost }}:
module.run:
- name: docker.run
- m_name: php-fpm-{{ vhost }}
- cmd: |
COMPOSER_HOME=/var/www/html \
COMPOSER_AUTH="{\"http-basic\": {\"repo.magento.com\": {\"username\": \"{{ config.magento_marketplace_public }}\",\"password\":\"{{ config.magento_marketplace_private }}\" }}}" \
sudo -E -u www-data php -dmemory_limit={{ config.php_maxmem_deploy }} -f bin/magento sampledata:deploy
{% endif %}
Run Magento upgrade for {{ vhost }}:
module.run:
- name: docker.run
- m_name: php-fpm-{{ vhost }}
- cmd: |
sudo -E -u www-data php -dmemory_limit={{ config.php_maxmem_deploy }} -f bin/magento setup:upgrade
{% endfor %}