2
0
mirror of https://github.com/frappe/bench.git synced 2024-09-23 04:29:02 +00:00

Bench setup failed on production fix (#546)

* Bench setup failed on production fix

- mariadb 10.2 fix
- root user used instead of frappe_user fix

* fix for production on CentOS

- selinux is set to permissive, in case of CentOS. This is needed to setup nginx
- bench is installed in the /home/username directory and not /home/root
This commit is contained in:
Ameya Shenoy 2018-01-20 23:57:35 +05:30 committed by Faris Ansari
parent c828b24a80
commit f85cbc87a8
3 changed files with 38 additions and 7 deletions

View File

@ -40,6 +40,10 @@
notify: restart nginx notify: restart nginx
when: setup_www_redirect when: setup_www_redirect
- name: Enable SELinux
selinux: policy=targeted state=permissive
when: ansible_distribution == 'CentOS'
- name: Ensure nginx is started and enabled to start at boot. - name: Ensure nginx is started and enabled to start at boot.
service: name=nginx state=started enabled=yes service: name=nginx state=started enabled=yes

View File

@ -1,7 +1,7 @@
--- ---
- hosts: localhost - hosts: localhost
vars: vars:
bench_path: "/home/{{ ansible_user_id }}/{{ bench_name }}" bench_path: "/home/{{ frappe_user }}/{{ bench_name }}"
tasks: tasks:
@ -10,6 +10,33 @@
stat: path="{{ bench_path }}/sites/{{ site }}" stat: path="{{ bench_path }}/sites/{{ site }}"
register: site_folder register: site_folder
- name: Add additional conf for MariaDB 10.2 in mariadb.conf.d
blockinfile:
path: /etc/mysql/conf.d/settings.cnf
block: |
# Import all .cnf files from configuration directory
!includedir /etc/mysql/mariadb.conf.d/
become: yes
become_user: root
when: ansible_distribution == 'Ubuntu' or ansible_distribution == 'Debian'
- name: Add additional conf for MariaDB 10.2 in mariadb.conf.d
blockinfile:
path: /etc/mysql/mariadb.conf.d/erpnext.cnf
block: |
[mysqld]
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
create: yes
become: yes
become_user: root
when: ansible_distribution == 'Ubuntu' or ansible_distribution == 'Debian'
- name: restart mysql
service: name=mysql state=restarted
become: yes
become_user: root
- name: Create new site - name: Create new site
command: bench new-site {{ site }} --admin-password {{ admin_password }} --mariadb-root-password {{ mysql_root_password }} command: bench new-site {{ site }} --admin-password {{ admin_password }} --mariadb-root-password {{ mysql_root_password }}
args: args:
@ -36,9 +63,9 @@
become: yes become: yes
become_user: root become_user: root
file: file:
dest: '{{ ansible_env.HOME }}' dest: '/home/{{ frappe_user }}'
owner: '{{ ansible_user_id }}' owner: '{{ frappe_user }}'
group: '{{ ansible_user_id }}' group: '{{ frappe_user }}'
mode: 0755 mode: 0755
recurse: yes recurse: yes
state: directory state: directory
@ -46,14 +73,14 @@
- name: Setup production - name: Setup production
become: yes become: yes
become_user: root become_user: root
command: bench setup production {{ ansible_user_id }} command: bench setup production {{ frappe_user }}
args: args:
chdir: '{{ bench_path }}' chdir: '{{ bench_path }}'
- name: Setup Sudoers - name: Setup Sudoers
become: yes become: yes
become_user: root become_user: root
command: bench setup sudoers {{ ansible_user_id }} command: bench setup sudoers {{ frappe_user }}
args: args:
chdir: '{{ bench_path }}' chdir: '{{ bench_path }}'

View File

@ -3,7 +3,7 @@
tasks: tasks:
- name: insert/update inputrc for history - name: insert/update inputrc for history
blockinfile: blockinfile:
dest: "/home/{{ ansible_user_id }}/.inputrc" dest: "/home/{{ frappe_user }}/.inputrc"
create: yes create: yes
block: | block: |
## arrow up ## arrow up