Multi-tenant from different source directories

134 views
Skip to first unread message

Abdur Rehman Habib

unread,
Sep 22, 2014, 9:30:03 AM9/22/14
to erpnext-dev...@googlegroups.com
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

Rushabh Mehta

unread,
Sep 23, 2014, 12:54:40 AM9/23/14
to erpnext-dev...@googlegroups.com
On 22-Sep-2014, at 7:00 pm, Abdur Rehman Habib <abdurr...@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...@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.

Abdur Rehman Habib

unread,
Sep 23, 2014, 3:25:34 AM9/23/14
to erpnext-dev...@googlegroups.com
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 <abdurr...@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+unsub...@googlegroups.com.

Rushabh Mehta

unread,
Sep 23, 2014, 4:28:15 AM9/23/14
to erpnext-dev...@googlegroups.com
On 23-Sep-2014, at 12:55 pm, Abdur Rehman Habib <abdurr...@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?

To unsubscribe from this group and stop receiving emails from it, send an email toerpnext-developer...@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.

Abdur Rehman Habib

unread,
Sep 23, 2014, 5:45:07 AM9/23/14
to erpnext-dev...@googlegroups.com
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.

Pratik Vyas

unread,
Sep 23, 2014, 6:03:45 AM9/23/14
to erpnext-dev...@googlegroups.com
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

Abdur Rehman Habib

unread,
Sep 23, 2014, 9:52:40 AM9/23/14
to erpnext-dev...@googlegroups.com
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.

Abdur Rehman Habib

unread,
Sep 24, 2014, 3:20:41 AM9/24/14
to erpnext-dev...@googlegroups.com
now it is working. 
thanks for the help

Abu Sayem

unread,
Sep 25, 2014, 2:41:54 AM9/25/14
to erpnext-dev...@googlegroups.com
Hi Abdur Rehman Habib
 Can you share your configuration i am having the same problem

Abdur Rehman Habib

unread,
Sep 25, 2014, 5:14:08 AM9/25/14
to erpnext-dev...@googlegroups.com

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;
}
}


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;
}
}
Reply all
Reply to author
Forward
0 new messages