installing shopware correctly using ansible

master
parent 6c9fbf5983
commit 279965f611
  1. 0
      README.md
  2. 47
      default
  3. 3
      group_vars/all/vars.yml
  4. 2
      hosts
  5. 61
      tasks/shopware.yml

@ -0,0 +1,47 @@
server {
listen 80;
# Handle / to index.php
index index.php;
# Our server name
server_name example.com;
# Should be equal to post_max_size
client_max_body_size 128M;
# Where the code is located
root /var/www/html/public;
# Needed for Shopware install / update
location /recovery/install {
index index.php;
try_files $uri /recovery/install/index.php$is_args$args;
}
location /recovery/update/ {
location /recovery/update/assets {
}
if (!-e $request_filename){
rewrite . /recovery/update/index.php last;
}
}
# Forward any not found file to index.php. Allows to have beautiful urls like /homemade-products/
location / {
try_files $uri /index.php$is_args$args;
}
# Let php-fpm handle .php files
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi.conf;
fastcgi_param HTTP_PROXY "";
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
fastcgi_read_timeout 300s;
client_body_buffer_size 128k;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
http2_push_preload on;
}
}

@ -2,4 +2,5 @@ username: rpolito
shopware_root_username: root
shopware_root_pass: rootpass
shopware_db_username: shopware
shopware_db_pass: shopware_pw
shopware_db_pass: shopware_pw
shopware_dl_link: https://releases.shopware.com/sw6/install_6.2.0_1589874223.zip

@ -1,2 +1,2 @@
[home]
swserver ansible_host=YOUR_IP ansible_user=YOUR_USERNAME ansible_connection=ssh ansible_ssh_private_key_file=PATH_TO_KEY
swserver ansible_host=192.168.0.223 ansible_user=rpolito ansible_connection=ssh ansible_ssh_private_key_file=/home/rpolito/.ssh/id_rsa

@ -18,6 +18,7 @@
- python3-pymysql
state: latest
#configure mariadb
- name: Copy my.cnf
copy:
src: ../my.cnf
@ -67,4 +68,62 @@
password: "{{shopware_db_pass}}"
priv:
'shopware.*': 'ALL,GRANT'
#configure php
- name: Setting PHP memory limit
lineinfile:
dest: /etc/php/7.4/fpm/php.ini
regexp: "^memory_limit = 128M$"
line: "memory_limit = 512M"
- name: Setting PHP POST MAX SIZE
lineinfile:
dest: /etc/php/7.4/fpm/php.ini
regexp: "^post_max_size = 8M$"
line: "post_max_size = 32M"
- name: Setting Upload Max Filesize
lineinfile:
dest: /etc/php/7.4/fpm/php.ini
regexp: "^upload_max_filesize = 2M$"
line: "upload_max_filesize = 32M"
- name: Restart php 7
ansible.builtin.service:
name: php7.4-fpm
state: restarted
- name: Make sure service is started and enabled
systemd:
name: php7.4-fpm
state: started
enabled: yes
# nginx
- name: Copy nginx config
copy:
src: ../default
dest: /etc/nginx/sites-enabled/default
- name: Restart nginx
ansible.builtin.service:
name: nginx
state: restarted
# install shopware 6
- name: delete nginx index file
ansible.builtin.file:
path: /var/www/html/index.nginx-debian.html
state: absent
- name: dl & unarchive shopware
ansible.builtin.unarchive:
src: "{{ shopware_dl_link }}"
dest: /var/www/html
remote_src: yes
- name: Change file ownership, group and permissions
ansible.builtin.file:
path: /var/www/html
owner: www-data
group: www-data
Loading…
Cancel
Save