Multi-tenant from different source directories

Dear All,

I want to setup erpnext in such a way that every tenant site run from different source directories.

e.g:

Site 1
   virtual host: demo.erpnext.ae
   source directory: /home/arehman/demo-bench/erpnext
   port: 80


Site2

   virtual host: test.erpnext.ae
   source directory: /home/arehman/test-bench/erpnext
   port: 80


i want to do this because i want to change source code for my client



Thanks and best regards,
A.Rehman


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/1619145e-b045-4f7d-a4b9-0d1a599dce7a%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.


On 22-Sep-2014, at 7:00 pm, Abdur Rehman Habib <ab...@gmail.com> wrote:

Dear All,

I want to setup erpnext in such a way that every tenant site run from different source directories.

Make each of them run on a separate port and have nginx proxy them as separate domains.


e.g:

Site 1
   virtual host: demo.erpnext.ae
   source directory: /home/arehman/demo-bench/erpnext
   port: 80


Site2

   virtual host: test.erpnext.ae
   source directory: /home/arehman/test-bench/erpnext
   port: 80


i want to do this because i want to change source code for my client



Thanks and best regards,
A.Rehman


  1. Please be kind and don’t send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/1619145e-b045-4f7d-a4b9-0d1a599dce7a%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/BAC520B9-FF48-459B-A9DD-FF48F3C4ACBF%40gmail.com.

    For more options, visit https://groups.google.com/d/optout.
thanks for the reply.

can you please describe how can i run each instance on separate port?
i have tried but i am not able to do this....
may be supervisor or memcached doing some problem....

waiting for our reply

On Tuesday, 23 September 2014 09:54:40 UTC+5, rushabh wrote:


On 22-Sep-2014, at 7:00 pm, Abdur Rehman Habib <ab...@gmail.com> wrote:

Dear All,

I want to setup erpnext in such a way that every tenant site run from different source directories.

Make each of them run on a separate port and have nginx proxy them as separate domains.


e.g:

Site 1
   virtual host: demo.erpnext.ae
   source directory: /home/arehman/demo-bench/erpnext
   port: 80


Site2

   virtual host: test.erpnext.ae
   source directory: /home/arehman/test-bench/erpnext
   port: 80


i want to do this because i want to change source code for my client



Thanks and best regards,
A.Rehman


  1. Please be kind and don’t send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/1619145e-b045-4f7d-a4b9-0d1a599dce7a%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/3e0f2623-c6aa-43a1-a064-69bbd447940e%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.

On 23-Sep-2014, at 12:55 pm, Abdur Rehman Habib <ab...@gmail.com> wrote:

thanks for the reply.

can you please describe how can i run each instance on separate port?
i have tried but i am not able to do this....

What did you try?

may be supervisor or memcached doing some problem....

What is the trace?


waiting for our reply

On Tuesday, 23 September 2014 09:54:40 UTC+5, rushabh wrote:


On 22-Sep-2014, at 7:00 pm, Abdur Rehman Habib <ab...@gmail.com> wrote:

Dear All,

I want to setup erpnext in such a way that every tenant site run from different source directories.

Make each of them run on a separate port and have nginx proxy them as separate domains.


e.g:

Site 1
   virtual host: demo.erpnext.ae
   source directory: /home/arehman/demo-bench/erpnext
   port: 80


Site2

   virtual host: test.erpnext.ae
   source directory: /home/arehman/test-bench/erpnext
   port: 80


i want to do this because i want to change source code for my client



Thanks and best regards,
A.Rehman

-- 
1. Please be kind and don't send large attachments
2. For issues, features requests use https://github.com/frappe/erpnext/issues
--- 
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email toerpnext-developer-forum+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/1619145e-b045-4f7d-a4b9-0d1a599dce7a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


-- 
1. Please be kind and don't send large attachments
2. For issues, features requests use https://github.com/frappe/erpnext/issues
--- 
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email toerpnext-developer-forum+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/3e0f2623-c6aa-43a1-a064-69bbd447940e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/0B912095-9BD4-464D-9A52-06F0D08A55FD%40gmail.com.

    For more options, visit https://groups.google.com/d/optout.
i did the following:
 
 1. install bench on two different folder
 2. install erpnext on each bench
 3. modify superviosur config to run both instances
 4. modify nginx config to cater both virtual host

after the above mentioned steps i am able to run both instances but the problem is if go to first instance desk then second instance desk not load i have to refresh my browser many times to second instance load and first instance is doing the same problem then i have to refresh browser man times to load first instance. may be memchaced or supervisour problem.

i used the second way to encounter the problem but not succeed:
 1. install bench
 2. install erpnext
 3. clone erpnext as erpnext2 (at his point i have to apps erpnext and erpnext2)
 4. modify apps.txt to add erpnext2 on this
 5. create new site
 6. try to install erpnext2 but i got the error (import error no module named erpnext2)

can you suggest me the better solution.


On Tuesday, 23 September 2014 13:28:15 UTC+5, rushabh wrote:

On 23-Sep-2014, at 12:55 pm, Abdur Rehman Habib <ab...@gmail.com> wrote:

thanks for the reply.

can you please describe how can i run each instance on separate port?
i have tried but i am not able to do this....

What did you try?

may be supervisor or memcached doing some problem....

What is the trace?


waiting for our reply

On Tuesday, 23 September 2014 09:54:40 UTC+5, rushabh wrote:


On 22-Sep-2014, at 7:00 pm, Abdur Rehman Habib <ab...@gmail.com> wrote:

Dear All,

I want to setup erpnext in such a way that every tenant site run from different source directories.

Make each of them run on a separate port and have nginx proxy them as separate domains.


e.g:

Site 1
   virtual host: demo.erpnext.ae
   source directory: /home/arehman/demo-bench/erpnext
   port: 80


Site2

   virtual host: test.erpnext.ae
   source directory: /home/arehman/test-bench/erpnext
   port: 80


i want to do this because i want to change source code for my client



Thanks and best regards,
A.Rehman

-- 
1. Please be kind and don't send large attachments
2. For issues, features requests use https://github.com/frappe/erpnext/issues
--- 
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email toerpnext-developer-forum+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/1619145e-b045-4f7d-a4b9-0d1a599dce7a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


-- 
1. Please be kind and don't send large attachments
2. For issues, features requests use https://github.com/frappe/erpnext/issues
--- 
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email toerpnext-developer-forum+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/3e0f2623-c6aa-43a1-a064-69bbd447940e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/1ab7be7d-6579-4f9d-ae03-0dd673f24b20%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.

Abdur,

Start with a clean machine,

  • Install a bench frappe-bench and setup erpnext on it.
  • Install another bench frappe-bench2 (ie use frappe init frappe-bench2) and get erpnext running on it

After this, setup supervisor and edit one of the supervisor config to
run on another port (say 5000). Adjust this port corresponding nginx
config too.

In case of error, do you see any tracebacks in frappe-bench/logs/web.error.log?

Thanks,
Pratik

thanks for the reply.

i have tried your solutions but when i use both domains on different browser at the same time; error shows on console network not found.
but when i refresh page then it reload one instance but at the same time other instance on other browser shows network not found error on console.

On Tuesday, 23 September 2014 15:03:45 UTC+5, Pratik Vyas wrote:
Abdur,

Start with a clean machine,

* Install a bench `frappe-bench` and setup erpnext on it.
* Install another bench `frappe-bench2` (ie use `frappe init
frappe-bench2`) and get erpnext running on it

After this, setup supervisor and edit one of the supervisor config to
run on another port (say 5000). Adjust this port corresponding nginx
config too.

-

In case of error, do you see any tracebacks in frappe-bench/logs/web.error.log?

Thanks,
Pratik


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/46d1879e-b7d8-4ac0-8eff-4f04e3e77f34%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.
now it is working. 
thanks for the help

On Tuesday, 23 September 2014 18:52:40 UTC+5, Abdur Rehman Habib wrote:
thanks for the reply.

i have tried your solutions but when i use both domains on different browser at the same time; error shows on console network not found.
but when i refresh page then it reload one instance but at the same time other instance on other browser shows network not found error on console.

On Tuesday, 23 September 2014 15:03:45 UTC+5, Pratik Vyas wrote:
Abdur,

Start with a clean machine,

* Install a bench `frappe-bench` and setup erpnext on it.
* Install another bench `frappe-bench2` (ie use `frappe init
frappe-bench2`) and get erpnext running on it

After this, setup supervisor and edit one of the supervisor config to
run on another port (say 5000). Adjust this port corresponding nginx
config too.

-

In case of error, do you see any tracebacks in frappe-bench/logs/web.error.log?

Thanks,
Pratik


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/d0e8077b-4af4-4755-977c-b7f0164ca11f%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.
Hi Abdur Rehman Habib
 Can you share your configuration i am having the same problem

On Wednesday, September 24, 2014 1:20:41 PM UTC+6, Abdur Rehman Habib wrote:
now it is working. 
thanks for the help

On Tuesday, 23 September 2014 18:52:40 UTC+5, Abdur Rehman Habib wrote:
thanks for the reply.

i have tried your solutions but when i use both domains on different browser at the same time; error shows on console network not found.
but when i refresh page then it reload one instance but at the same time other instance on other browser shows network not found error on console.

On Tuesday, 23 September 2014 15:03:45 UTC+5, Pratik Vyas wrote:
Abdur,

Start with a clean machine,

* Install a bench `frappe-bench` and setup erpnext on it.
* Install another bench `frappe-bench2` (ie use `frappe init
frappe-bench2`) and get erpnext running on it

After this, setup supervisor and edit one of the supervisor config to
run on another port (say 5000). Adjust this port corresponding nginx
config too.

-

In case of error, do you see any tracebacks in frappe-bench/logs/web.error.log?

Thanks,
Pratik


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/094a7ed8-990e-40e1-ba23-2a68bc2ffc3c%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.

config for server 1:


server {
listen 80  ;
client_max_body_size 4G;
server_name mv.mint;
keepalive_timeout 5;
sendfile on;
root /home/mint/mv-bench/sites;

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

location /assets {
try_files $uri =404;
}

location / {
try_files /mv.mint/public/$uri @magic;
}

location @magic {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host mv.mint;
proxy_set_header X-Use-X-Accel-Redirect True;
proxy_read_timeout 120;
proxy_redirect off;
#proxy_pass  http://frappe;
proxy_pass http://127.0.0.1:5000;
}
}


config for server2:


server {
listen 80  default ;
client_max_body_size 4G;
server_name frappe_default_site;
keepalive_timeout 5;
sendfile on;
root /home/mint/sp-bench/sites;

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

location /assets {
try_files $uri =404;
}

location / {
try_files /sp.mint/public/$uri @magic;
}

location @magic {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host sp.mint;
proxy_set_header X-Use-X-Accel-Redirect True;
proxy_read_timeout 120;
proxy_redirect off;
#proxy_pass  http://frappe;
proxy_pass http://127.0.0.1:6000;
}
}


On Thursday, 25 September 2014 11:41:54 UTC+5, Abu Sayem wrote:
Hi Abdur Rehman Habib
 Can you share your configuration i am having the same problem

On Wednesday, September 24, 2014 1:20:41 PM UTC+6, Abdur Rehman Habib wrote:
now it is working. 
thanks for the help

On Tuesday, 23 September 2014 18:52:40 UTC+5, Abdur Rehman Habib wrote:
thanks for the reply.

i have tried your solutions but when i use both domains on different browser at the same time; error shows on console network not found.
but when i refresh page then it reload one instance but at the same time other instance on other browser shows network not found error on console.

On Tuesday, 23 September 2014 15:03:45 UTC+5, Pratik Vyas wrote:
Abdur,

Start with a clean machine,

* Install a bench `frappe-bench` and setup erpnext on it.
* Install another bench `frappe-bench2` (ie use `frappe init
frappe-bench2`) and get erpnext running on it

After this, setup supervisor and edit one of the supervisor config to
run on another port (say 5000). Adjust this port corresponding nginx
config too.

-

In case of error, do you see any tracebacks in frappe-bench/logs/web.error.log?

Thanks,
Pratik


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/2dec444a-6d37-465d-bc55-0679eac3118f%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.

I managed to configure this by changing not just the port name but also all the program names in supervisor.conf for the second bench. Then I also changed redis conf files for the second bench (port, pid, database) and socketio.js to reflect what was changed in redis files.

I have two benches (one running two sites, the other one running one site) working and I see no problems when working in ERPNext in any of them.

However, when I run supervisorctl status, I see that “node-socketio” and what I call “second-node-socketio” keep restarting every time somone uses any site on these benches. All the other processes (e.g. frappe-web, second-frappe-web…) keep running for days, but node-socketio restarts as soon as you log in to a site.

How can I fix this?

I don’t really understand what these processes are used for… just managed to guess how to change the config files … do I even need “second-node-socketio”, “second-redis-cache” , etc.?

Many thanks.

You should look at the process logs (stdout/stderr you specified in the config). I am also convinced that supervisor config process names should not be hardcoded.