ERPNext running along side other frappe sites and apps

Hi Team,

I managed to get erpnext running on a ubuntu vm and now im trying to get another site running where I would like to build my own app using frappe. I have the sites working but cannot install the app I just created into the new site I created.

getting this error:

hemant@ubuntu:~/frappe-bench$ bench --site rounds install-app rounds
Traceback (most recent call last):
File “/usr/lib/python2.7/runpy.py”, line 162, in _run_module_as_main
main”, fname, loader, pkg_name)
File “/usr/lib/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File “/home/hemant/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 77, in
main()
File “/home/hemant/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 14, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/hemant/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 664, in call
return self.main(*args, **kwargs)
File “/home/hemant/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 644, in main
rv = self.invoke(ctx)
File “/home/hemant/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 991, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/hemant/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 991, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/hemant/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 837, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/hemant/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 464, in invoke
return callback(*args, **kwargs)
File “/home/hemant/frappe-bench/apps/frappe/frappe/commands.py”, line 28, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/hemant/frappe-bench/apps/frappe/frappe/commands.py”, line 163, in install_app
_install_app(app, verbose=context.verbose)
File “/home/hemant/frappe-bench/apps/frappe/frappe/installer.py”, line 93, in install_app
app_hooks = frappe.get_hooks(app_name=name)
File “/home/hemant/frappe-bench/apps/frappe/frappe/init.py”, line 671, in get_hooks
hooks = _dict(load_app_hooks(app_name))
File “/home/hemant/frappe-bench/apps/frappe/frappe/init.py”, line 644, in load_app_hooks
app_hooks = get_module(app + “.hooks”)
File “/home/hemant/frappe-bench/apps/frappe/frappe/init.py”, line 564, in get_module
return importlib.import_module(modulename)
File “/usr/lib/python2.7/importlib/init.py”, line 37, in import_module
import(name)
ImportError: No module named rounds.hooks
hemant@ubuntu:~/frappe-bench$

Am I missing something?
I have run bench config dns_multitenant on
and have site1.local which is the default site

Please assist in getting the app installed so I can contnue with the tutorial for frappe.

Thanks

regards
Hemant

Hi…no response on this for a while…but in case someone else is looking i managed to get this working.

2 sites, using dns running on 1 server both on port 80.

I recreated the vm installed ubuntu,

#installed erpnext,
wget https://raw.githubusercontent.com/frappe/bench/master/install_scripts/setup_frappe.sh
sudo bash setup_frappe.sh --setup-production

#created the new app and new site,
bench new-app library_management
bench new-site library

#installed the app on the new site,
bench --site library install-app library_management

#configed multitenant,
bench config dns_multitenant on

bench setup nginx,

and obviously set the dns records (im my case the hosts file). restarted and was ready to do some dev.

Yeah, thank erpnext…learning continues :wink:

1 Like

Hi

Has there been a change in bench or something.

I am ready to start to develop my own application using frappe and when I now try the above setup im still reaching the site1.local instead of my new site created, am i missing something?

When i turn multitenant on and run setup nginx, when i reload it shows fails.

Please assist. thanks

regards
Hemant

See your frappe-bench/Procfile to see what sites you are running with bench start

this is what is showing in my Procfile:

workerbeat: sh -c ‘cd sites && exec …/env/bin/python -m frappe.celery_app beat -s scheduler.schedule’
web: bench serve
worker: sh -c ‘cd sites && exec …/env/bin/python -m frappe.celery_app worker’
redis_cache: redis-server config/redis.conf

You are always loading the default site, either add a new site to your /etc/hosts or set your default site as bench use newsite

Like i mentioned, hosts file is updated and all was fine when i was going through the dev tutorial. Using a fresh install and following the same procedure im not able to replicate, so trying to troubleshoot why. Best way to learn :wink:

running ‘bench setup nginx’ is what I think is causing the issue. Now main site also cannot display “Problem loading page”

here is my nginx conf file:

server_names_hash_bucket_size 64;

upstream frappe {
server 127.0.0.1:8000 fail_timeout=0;
}

upstream socketio-server {
server 127.0.0.1:3000 fail_timeout=0;
}

server {
listen 80 default ;
client_max_body_size 4G;
server_name frappe_default_site;

	keepalive_timeout 5;
	sendfile on;
	root /home/hemant/frappe-bench/sites;

	location /private/ {
		internal;
		try_files /$uri =424;
	}

	location /assets {
		try_files $uri =404;
	}

	location /socket.io {
		proxy_pass http://socketio-server;
		proxy_http_version 1.1;
		proxy_set_header Upgrade $http_upgrade;
		proxy_set_header Connection "upgrade";
		proxy_set_header X-Frappe-Site-Name site1.local;
		proxy_set_header Origin $http_host;
		proxy_set_header Host $host;
	}

	location / {
		try_files /site1.local/public/$uri @magic;
	}

	location @magic {
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header X-Forwarded-Proto $scheme;
					proxy_set_header X-Frappe-Site-Name site1.local;
					proxy_set_header Host $host;
		proxy_set_header X-Use-X-Accel-Redirect True;
		proxy_read_timeout 120;
		proxy_redirect off;
		proxy_pass  http://frappe;
	}
}

server {
listen 80 ;
client_max_body_size 4G;
server_name rounds site1.local ;

	keepalive_timeout 5;
	sendfile on;
	root /home/hemant/frappe-bench/sites;

	location /private/ {
		internal;
		try_files /$uri =424;
	}

	location /assets {
		try_files $uri =404;
	}

	location /socket.io {
		proxy_pass http://socketio-server;
		proxy_http_version 1.1;
		proxy_set_header Upgrade $http_upgrade;
		proxy_set_header Connection "upgrade";
		proxy_set_header X-Frappe-Site-Name ;
		proxy_set_header Origin $http_host;
		proxy_set_header Host $host;
	}

	location / {
		try_files /$host/public/$uri @magic;
	}

	location @magic {
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header X-Forwarded-Proto $scheme;
					proxy_set_header Host $host;
		proxy_set_header X-Use-X-Accel-Redirect True;
		proxy_read_timeout 120;
		proxy_redirect off;
		proxy_pass  http://frappe;
	}
}

Any ideas or help?

regards

Since you have upgraded to v6, you will need to run this to start node server too:

bench setup supervisor
sudo supervisorctl reload

Did it work?

sorry waiting for node to install, internet a it slow, will feedback as soon as its done.

Pushed another fix. You will need to run bench update and run bench setup supervisor so that it adds a socketio entry into it.

nodejs install failed…going to reboot and try again, not sure if it was our connection or what…will feedback as soon as I go somewhere

ok, got nodeJS loaded,

ran all the steps but nginx still failing on reload, where can I get the logs to investigate why?

after rebooting the site1.local also does not show.

What do you need from me to help?

Check this link: Create a Site
Each time you run bench start, it automatically looks for the current site file, however in cases where you want to spin up multiple sites on the same machine run this command: ```
rm sites/currentsite.txt

then add your site name to your hosts using this command : ```
bench --site library.test add-to-hosts

then replace : 127.0.0.0 or 0.0.0.0 with your site name
like this: http://sitename:port