mirror of
https://github.com/frappe/bench.git
synced 2024-11-17 02:25:16 +00:00
Merge pull request #1121 from NicolasStr/develop
fix: create bench folder in user directory
This commit is contained in:
commit
f3809b00ac
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
- name: Set home folder perms
|
- name: Set home folder perms
|
||||||
file:
|
file:
|
||||||
path: '/home/{{ frappe_user }}'
|
path: '{{ user_directory }}'
|
||||||
mode: 'o+rx'
|
mode: 'o+rx'
|
||||||
owner: '{{ frappe_user }}'
|
owner: '{{ frappe_user }}'
|
||||||
group: '{{ frappe_user }}'
|
group: '{{ frappe_user }}'
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
- name: Fix permissions
|
- name: Fix permissions
|
||||||
become_user: root
|
become_user: root
|
||||||
command: chown {{ frappe_user }} -R /home/{{ frappe_user }}
|
command: chown {{ frappe_user }} -R {{ user_directory }}
|
||||||
|
|
||||||
- name: python3 bench init for develop
|
- name: python3 bench init for develop
|
||||||
command: bench init {{ bench_path }} --frappe-path {{ frappe_repo_url }} --frappe-branch {{ frappe_branch }} --python {{ python }}
|
command: bench init {{ bench_path }} --frappe-path {{ frappe_repo_url }} --frappe-branch {{ frappe_branch }} --python {{ python }}
|
||||||
@ -77,6 +77,6 @@
|
|||||||
# Setup Bench for production environment
|
# Setup Bench for production environment
|
||||||
- include_tasks: setup_bench_production.yml
|
- include_tasks: setup_bench_production.yml
|
||||||
vars:
|
vars:
|
||||||
bench_path: "/home/{{ frappe_user }}/{{ bench_name }}"
|
bench_path: "{{ user_directory }}/{{ bench_name }}"
|
||||||
when: not run_travis and production
|
when: not run_travis and production
|
||||||
...
|
...
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
- name: insert/update inputrc for history
|
- name: insert/update inputrc for history
|
||||||
blockinfile:
|
blockinfile:
|
||||||
dest: "/home/{{ frappe_user }}/.inputrc"
|
dest: "{{ user_directory }}/.inputrc"
|
||||||
create: yes
|
create: yes
|
||||||
block: |
|
block: |
|
||||||
## arrow up
|
## arrow up
|
||||||
|
@ -40,8 +40,8 @@
|
|||||||
- name: setup bench and dev environment
|
- name: setup bench and dev environment
|
||||||
hosts: localhost
|
hosts: localhost
|
||||||
vars:
|
vars:
|
||||||
bench_repo_path: "/home/{{ frappe_user }}/.bench"
|
bench_repo_path: "{{ user_directory }}/.bench"
|
||||||
bench_path: "/home/{{ frappe_user }}/{{ bench_name }}"
|
bench_path: "{{ user_directory }}/{{ bench_name }}"
|
||||||
roles:
|
roles:
|
||||||
# setup frappe-bench
|
# setup frappe-bench
|
||||||
- { role: bench, tags: "bench", when: not run_travis and not without_bench_setup }
|
- { role: bench, tags: "bench", when: not run_travis and not without_bench_setup }
|
||||||
|
@ -34,6 +34,8 @@ If you are on a fresh server and logged in as root, at first create a dedicated
|
|||||||
|
|
||||||
*(it is very common to use "frappe" as frappe-username, but this comes with the security flaw of ["frappe" ranking very high](https://www.reddit.com/r/dataisbeautiful/comments/b3sirt/i_deployed_over_a_dozen_cyber_honeypots_all_over/?st=JTJ0SC0Q&sh=76e05240) in as a username challenged in hacking attempts. So, for production sites it is highly recommended to use a custom username harder to guess)*
|
*(it is very common to use "frappe" as frappe-username, but this comes with the security flaw of ["frappe" ranking very high](https://www.reddit.com/r/dataisbeautiful/comments/b3sirt/i_deployed_over_a_dozen_cyber_honeypots_all_over/?st=JTJ0SC0Q&sh=76e05240) in as a username challenged in hacking attempts. So, for production sites it is highly recommended to use a custom username harder to guess)*
|
||||||
|
|
||||||
|
*(you can specify the flag --home to specify a directory for your [frappe-user]. Bench will follow the home directory specified by the user's home directory e.g. /data/[frappe-user]/frappe-bench)*
|
||||||
|
|
||||||
Switch to `[frappe-user]` (using `su [frappe-user]`) and start the setup
|
Switch to `[frappe-user]` (using `su [frappe-user]`) and start the setup
|
||||||
|
|
||||||
wget https://raw.githubusercontent.com/frappe/bench/develop/install.py
|
wget https://raw.githubusercontent.com/frappe/bench/develop/install.py
|
||||||
@ -71,7 +73,7 @@ use --python flag to specify virtual environments python version, by default scr
|
|||||||
|
|
||||||
## How do I start ERPNext
|
## How do I start ERPNext
|
||||||
|
|
||||||
1. For development: Go to your bench folder (`frappe-bench` by default) and start the bench with `bench start`
|
1. For development: Go to your bench folder (`~[frappe-user]/frappe-bench` by default) and start the bench with `bench start`
|
||||||
2. For production: Your process will be setup and managed by `nginx` and `supervisor`. Checkout [Setup Production](https://frappe.io/docs/user/en/bench/guides/setup-production.html) for more information.
|
2. For production: Your process will be setup and managed by `nginx` and `supervisor`. Checkout [Setup Production](https://frappe.io/docs/user/en/bench/guides/setup-production.html) for more information.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
@ -235,9 +235,10 @@ def install_bench(args):
|
|||||||
extra_vars = vars(args)
|
extra_vars = vars(args)
|
||||||
extra_vars.update(frappe_user=args.user)
|
extra_vars.update(frappe_user=args.user)
|
||||||
|
|
||||||
|
extra_vars.update(user_directory=get_user_home_directory(args.user))
|
||||||
|
|
||||||
if os.path.exists(tmp_bench_repo):
|
if os.path.exists(tmp_bench_repo):
|
||||||
repo_path = tmp_bench_repo
|
repo_path = tmp_bench_repo
|
||||||
|
|
||||||
else:
|
else:
|
||||||
repo_path = os.path.join(os.path.expanduser('~'), 'bench')
|
repo_path = os.path.join(os.path.expanduser('~'), 'bench')
|
||||||
|
|
||||||
@ -386,6 +387,11 @@ def get_extra_vars_json(extra_args):
|
|||||||
|
|
||||||
return ('@' + json_path)
|
return ('@' + json_path)
|
||||||
|
|
||||||
|
def get_user_home_directory(user):
|
||||||
|
# Return home directory /home/USERNAME or anything else defined as home directory in
|
||||||
|
# passwd for user.
|
||||||
|
return os.path.expanduser('~'+user)
|
||||||
|
|
||||||
|
|
||||||
def run_playbook(playbook_name, sudo=False, extra_vars=None):
|
def run_playbook(playbook_name, sudo=False, extra_vars=None):
|
||||||
args = ['ansible-playbook', '-c', 'local', playbook_name , '-vvvv']
|
args = ['ansible-playbook', '-c', 'local', playbook_name , '-vvvv']
|
||||||
|
Loading…
Reference in New Issue
Block a user