20 .. _ResourceMode: |
20 .. _ResourceMode: |
21 |
21 |
22 Resource mode |
22 Resource mode |
23 ------------- |
23 ------------- |
24 |
24 |
|
25 Standard resource mode |
|
26 ``````````````````````````` |
|
27 |
25 A resource *mode* is a predefined set of settings for various resources |
28 A resource *mode* is a predefined set of settings for various resources |
26 directories, such as cubes, instances, etc. to ease development with the |
29 directories, such as cubes, instances, etc. to ease development with the |
27 framework. There are two running modes with *CubicWeb*: |
30 framework. There are two running modes with *CubicWeb*: |
28 |
31 |
29 * **system**: resources are searched / created in the system directories (eg |
32 * **system**: resources are searched / created in the system directories (eg |
30 usually requiring root access): |
33 usually requiring root access): |
31 |
34 |
32 - instances are stored in :file:`<INSTALL_PREFIX>/etc/cubicweb.d` |
35 - instances are stored in :file:`<INSTALL_PREFIX>/etc/cubicweb.d` |
33 - temporary files (such as pid file) in :file:`/var/run/cubicweb` |
36 - temporary files (such as pid file) in :file:`<INSTALL_PREFIX>/var/run/cubicweb` |
34 |
37 |
35 where `<INSTALL_PREFIX>` is the detected installation prefix ('/usr/local' for |
38 where `<INSTALL_PREFIX>` is the detected installation prefix ('/usr/local' for |
36 instance). |
39 instance). |
37 |
40 |
38 * **user**: resources are searched / created in the user home directory: |
41 * **user**: resources are searched / created in the user home directory: |
39 |
42 |
40 - instances are stored in :file:`~/etc/cubicweb.d` |
43 - instances are stored in :file:`~/etc/cubicweb.d` |
41 - temporary files (such as pid file) in :file:`/tmp` |
44 - temporary files (such as pid file) in :file:`/tmp` |
42 |
45 |
43 |
46 |
|
47 |
|
48 |
|
49 .. _CubicwebWithinVirtualEnv: |
|
50 |
|
51 Within virtual environment |
|
52 ``````````````````````````` |
|
53 |
|
54 If you are not administrator of you machine or if you need to play with some |
|
55 specific version of |cubicweb| you can use `virtualenv`_ a tool to create |
|
56 isolated Python environments. Since version 3.9 |cubicweb| is **`virtualenv` |
|
57 friendly** and won't write any file outside the virtualenv directory. |
|
58 |
|
59 - instances are stored in :file:`<VIRTUAL_ENV>/etc/cubicweb.d` |
|
60 - temporary files (such as pid file) in :file:`<VIRTUAL_ENV>/var/run/cubicweb` |
|
61 |
|
62 .. _`virtualenv`: http://pypi.python.org/pypi/virtualenv |
|
63 |
|
64 Custom resource location |
|
65 ```````````````````````````````` |
44 |
66 |
45 Notice that each resource path may be explicitly set using an environment |
67 Notice that each resource path may be explicitly set using an environment |
46 variable if the default doesn't suit your needs. Here are the default resource |
68 variable if the default doesn't suit your needs. Here are the default resource |
47 directories that are affected according to mode: |
69 directories that are affected according to mode: |
48 |
70 |
49 * **system**: :: |
71 * **system**: :: |
50 |
72 |
51 CW_INSTANCES_DIR = <INSTALL_PREFIX>/etc/cubicweb.d/ |
73 CW_INSTANCES_DIR = <INSTALL_PREFIX>/etc/cubicweb.d/ |
52 CW_INSTANCES_DATA_DIR = /var/lib/cubicweb/instances/ |
74 CW_INSTANCES_DATA_DIR = <INSTALL_PREFIX>/var/lib/cubicweb/instances/ |
53 CW_RUNTIME_DIR = /var/run/cubicweb/ |
75 CW_RUNTIME_DIR = <INSTALL_PREFIX>/var/run/cubicweb/ |
54 |
76 |
55 * **user**: :: |
77 * **user**: :: |
56 |
78 |
57 CW_INSTANCES_DIR = ~/etc/cubicweb.d/ |
79 CW_INSTANCES_DIR = ~/etc/cubicweb.d/ |
58 CW_INSTANCES_DATA_DIR = ~/etc/cubicweb.d/ |
80 CW_INSTANCES_DATA_DIR = ~/etc/cubicweb.d/ |
59 CW_RUNTIME_DIR = /tmp |
81 CW_RUNTIME_DIR = /tmp |
60 |
82 |
61 Cubes search path is also affected, see the :ref:`Cube` section. |
83 Cubes search path is also affected, see the :ref:`Cube` section. |
62 |
84 |
63 By default, the mode automatically set to `user` if a :file:`.hg` directory is found |
85 Setting Cubicweb Mode |
64 in the cubicweb package, else it's set to `system`. You can force this by setting |
86 ````````````````````` |
65 the :envvar:`CW_MODE` environment variable to either `user` or `system` so you can |
87 |
66 easily: |
88 By default, the mode is set to 'system' for standard installation. The mode is |
|
89 set to 'user' if `cubicweb is used from a mercurial repository`_. You can force |
|
90 this by setting the :envvar:`CW_MODE` environment variable to either 'user' or |
|
91 'system' so you can easily: |
67 |
92 |
68 * use system wide installation but user specific instances and all, without root |
93 * use system wide installation but user specific instances and all, without root |
69 privileges on the system (`export CW_MODE=user`) |
94 privileges on the system (`export CW_MODE=user`) |
70 |
95 |
71 * use local checkout of cubicweb on system wide instances (requires root |
96 * use local checkout of cubicweb on system wide instances (requires root |
72 privileges on the system (`export CW_MODE=system`) |
97 privileges on the system (`export CW_MODE=system`) |
73 |
98 |
74 If you've a doubt about the mode you're currently running, check the first line |
99 If you've a doubt about the mode you're currently running, check the first line |
75 outputed by the :command:`cubicweb-ctl list` command. |
100 outputed by the :command:`cubicweb-ctl list` command. |
76 |
101 |
77 Also, if cubicweb is a mercurial checkout located in `<CW_SOFTWARE_ROOT>`: |
102 .. _`cubicweb is used from a mercurial repository`: CubicwebDevelopmentMod_ |
|
103 |
|
104 .. _CubicwebDevelopmentMod: |
|
105 |
|
106 Development Mode |
|
107 ````````````````````` |
|
108 If :file:`.hg` directory is found into the cubicweb package, there are specific resource rules. |
|
109 |
|
110 `<CW_SOFTWARE_ROOT>` is the mercurial checkout of cubicweb: |
78 |
111 |
79 * main cubes directory is `<CW_SOFTWARE_ROOT>/../cubes`. You can specify |
112 * main cubes directory is `<CW_SOFTWARE_ROOT>/../cubes`. You can specify |
80 another one with :envvar:`CW_INSTANCES_DIR` environment variable or simply |
113 another one with :envvar:`CW_INSTANCES_DIR` environment variable or simply |
81 add some other directories by using :envvar:`CW_CUBES_PATH` |
114 add some other directories by using :envvar:`CW_CUBES_PATH` |
82 |
115 |