Open chinmaybhatk opened 2 years ago
Having the same issue
I am also having an issue as shown below
TASK [bench : python3 bench init for production] *******************************
task path: /tmp/.bench/bench/playbooks/roles/bench/tasks/main.yml:44
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: root
<127.0.0.1> EXEC /bin/sh -c 'echo ~root && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /var/tmp `"&& mkdir /var/tmp/ansible-tmp-1650375360.5142555-29110-215754325287561 && echo ansible-tmp-1650375360.5142555-29110-215754325287561="` echo /var/tmp/ansible-tmp-1650375360.5142555-29110-215754325287561 `" ) && sleep 0'
Using module file /usr/local/lib/python3.8/dist-packages/ansible/modules/commands/command.py
<127.0.0.1> PUT /root/.ansible/tmp/ansible-local-22298mx27ib7v/tmp_1gk6qo8 TO /var/tmp/ansible-tmp-1650375360.5142555-29110-215754325287561/AnsiballZ_command.py
<127.0.0.1> EXEC /bin/sh -c 'setfacl -m u:ubuntu:r-x /var/tmp/ansible-tmp-1650375360.5142555-29110-215754325287561/ /var/tmp/ansible-tmp-1650375360.5142555-29110-215754325287561/AnsiballZ_command.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /var/tmp/ansible-tmp-1650375360.5142555-29110-215754325287561/ /var/tmp/ansible-tmp-1650375360.5142555-29110-215754325287561/AnsiballZ_command.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'chown ubuntu /var/tmp/ansible-tmp-1650375360.5142555-29110-215754325287561/ /var/tmp/ansible-tmp-1650375360.5142555-29110-215754325287561/AnsiballZ_command.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'sudo -H -S -n -u ubuntu /bin/sh -c '"'"'echo BECOME-SUCCESS-mttaoxguqkuxmuapdoqsbmxglllcumiy ; /usr/bin/python3 /var/tmp/ansible-tmp-1650375360.5142555-29110-215754325287561/AnsiballZ_command.py'"'"' && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /var/tmp/ansible-tmp-1650375360.5142555-29110-215754325287561/ > /dev/null 2>&1 && sleep 0'
fatal: [localhost]: FAILED! => {
"changed": true,
"cmd": [
"bench",
"init",
"/home/ubuntu/frappe-bench",
"--frappe-path",
"https://github.com/frappe/frappe",
"--frappe-branch",
"version-13",
"--python",
"python3"
],
"delta": "0:00:00.198017",
"end": "2022-04-19 19:06:00.867025",
"invocation": {
"module_args": {
"_raw_params": "bench init /home/ubuntu/frappe-bench --frappe-path https://github.com/frappe/frappe --frappe-branch version-13 --python python3",
"_uses_shell": false,
"argv": null,
"chdir": null,
"creates": "/home/ubuntu/frappe-bench",
"executable": null,
"removes": null,
"stdin": null,
"stdin_add_newline": true,
"strip_empty_ends": true,
"warn": true
}
},
"msg": "non-zero return code",
"rc": 1,
"start": "2022-04-19 19:06:00.669008",
"stderr": "Traceback (most recent call last):\n File \"/usr/bin/bench\", line 33, in <module>\n sys.exit(load_entry_point('frappe-bench', 'console_scripts', 'bench')())\n File \"/usr/bin/bench\", line 22, in importlib_load_entry_point\n for entry_point in distribution(dist_name).entry_points\n File \"/usr/lib/python3.8/importlib/metadata.py\", line 503, in distribution\n return Distribution.from_name(distribution_name)\n File \"/usr/lib/python3.8/importlib/metadata.py\", line 177, in from_name\n raise PackageNotFoundError(name)\nimportlib.metadata.PackageNotFoundError: frappe-bench",
"stderr_lines": [
"Traceback (most recent call last):",
" File \"/usr/bin/bench\", line 33, in <module>",
" sys.exit(load_entry_point('frappe-bench', 'console_scripts', 'bench')())",
" File \"/usr/bin/bench\", line 22, in importlib_load_entry_point",
" for entry_point in distribution(dist_name).entry_points",
" File \"/usr/lib/python3.8/importlib/metadata.py\", line 503, in distribution",
" return Distribution.from_name(distribution_name)",
" File \"/usr/lib/python3.8/importlib/metadata.py\", line 177, in from_name",
" raise PackageNotFoundError(name)",
"importlib.metadata.PackageNotFoundError: frappe-bench"
],
"stdout": "",
"stdout_lines": []
}
PLAY RECAP *********************************************************************
localhost : ok=70 changed=37 unreachable=0 failed=1 skipped=60 rescued=0 ignored=0
Traceback (most recent call last):
File "install.py", line 500, in <module>
install_bench(args)
File "install.py", line 281, in install_bench
run_playbook('site.yml', sudo=True, extra_vars=extra_vars)
File "install.py", line 416, in run_playbook
success = subprocess.check_call(args, cwd=playbooks_folder, stdout=log_stream, stderr=sys.stderr)
You guys might be interested by this patch:
diff --git a/bench/playbooks/roles/bench/tasks/main.yml b/bench/playbooks/roles/bench/tasks/main.yml
index 164a216..3db6b2a 100644
--- a/bench/playbooks/roles/bench/tasks/main.yml
+++ b/bench/playbooks/roles/bench/tasks/main.yml
@@ -35,6 +35,10 @@
become_user: root
command: chown {{ frappe_user }} -R {{ user_directory }}
+ - name: pip3 install frappe-bench
+ command: 'pip3 install frappe-bench'
+ become: yes
+
- name: python3 bench init for develop
command: bench init {{ bench_path }} --frappe-path {{ frappe_repo_url }} --frappe-branch {{ frappe_branch }} --python {{ python }}
args:
diff --git a/bench/playbooks/roles/bench/tasks/setup_bench_production.yml b/bench/playbooks/roles/bench/tasks/setup_bench_production.yml
index b0725da..a85aaa2 100644
--- a/bench/playbooks/roles/bench/tasks/setup_bench_production.yml
+++ b/bench/playbooks/roles/bench/tasks/setup_bench_production.yml
@@ -1,4 +1,9 @@
---
+- name: pip3 install frappe-bench
+ command: pip3 install frappe-bench
+ become: yes
+ become_user: root
+
- name: Setup production
become: yes
become_user: root
@@ -21,8 +26,8 @@
become: yes
become_user: root
-- name: Restart the bench
- command: bench restart
+- name: start the bench
+ command: bench start
args:
chdir: '{{ bench_path }}'
-...
\ No newline at end of file
+...
I wrote a long blog post about this whole “easy install” thing: https://rollance.com/blog/News/user-hostile-open-source-software
@jdecaron Thx for Your interesting post. I'm not a software developer, but a frustrated admin, trying since two days to get ERPNext up and running on Ubuntu 18.04.6. I've tried a lot of different ways, but would actually prefer the easy install script. I also applied the batch from jdecaron, but the error still persists.
As described above, the script stops at the ansible-playbook command:
File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ansible-playbook', '-c', 'local', 'site.yml', '-vvvv', '-e', '@/tmp/extra_vars.json', '--become', '--become-user=geoerp']' returned non-zero exit status 2.
When I run the command directly in the shell, it complains, that there is no config file and that site.yml couldn't be found:
root@map:~# ansible-playbook -c local site.yml -vvvv -e @/tmp/extra_vars.json --become --become-user=geoerp
ansible-playbook 2.8.20
config file = None
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.8/dist-packages/ansible
executable location = /usr/local/bin/ansible-playbook
python version = 3.8.13 (default, Apr 19 2022, 00:53:22) [GCC 7.5.0]
No config file found; using defaults
ERROR! the playbook: site.yml could not be found
When I look to find if a site.yml exists, I get the two locations for identical site.yml files:
root@map:/# find -name 'site.yml'
./tmp/.bench/bench/playbooks/site.yml
./usr/local/lib/python3.8/dist-packages/bench/playbooks/site.yml
I really don't know what to do, to get it to work???