diff --git a/readme.md b/README.md similarity index 100% rename from readme.md rename to README.md diff --git a/default b/default new file mode 100644 index 0000000..23addca --- /dev/null +++ b/default @@ -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; + } +} \ No newline at end of file diff --git a/group_vars/all/vars.yml b/group_vars/all/vars.yml index 29fcc59..29c19fb 100644 --- a/group_vars/all/vars.yml +++ b/group_vars/all/vars.yml @@ -2,4 +2,5 @@ username: rpolito shopware_root_username: root shopware_root_pass: rootpass shopware_db_username: shopware -shopware_db_pass: shopware_pw \ No newline at end of file +shopware_db_pass: shopware_pw +shopware_dl_link: https://releases.shopware.com/sw6/install_6.2.0_1589874223.zip \ No newline at end of file diff --git a/hosts b/hosts index d4affaf..26ea883 100644 --- a/hosts +++ b/hosts @@ -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 \ No newline at end of file +swserver ansible_host=192.168.0.223 ansible_user=rpolito ansible_connection=ssh ansible_ssh_private_key_file=/home/rpolito/.ssh/id_rsa \ No newline at end of file diff --git a/tasks/shopware.yml b/tasks/shopware.yml index bb80b71..49a5fa7 100644 --- a/tasks/shopware.yml +++ b/tasks/shopware.yml @@ -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' - \ No newline at end of file + +#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 \ No newline at end of file