11 |
11 |
12 |
12 |
13 0. Before starting |
13 0. Before starting |
14 ++++++++++++++++++ |
14 ++++++++++++++++++ |
15 |
15 |
16 |
16 Required packages |
17 **a. Package required** |
17 ----------------- |
18 |
18 |
19 |
19 PyAMS relies on system and Python packages which you must have been previously installed in your environment. |
20 PyAMS relies on Python packages for which you must have system packages available in your environment. |
|
21 |
|
22 |
20 |
23 .. note:: |
21 .. note:: |
24 |
22 |
25 - C/C++ compiler like **GCC** |
23 - a C/C++ compiler like **GCC** |
26 - **Python 3.5*** with development headers or **Cython3** for better optimization of several packages |
24 - **Python 3.5*** with development headers; **Cython3** for better optimization of several packages |
27 - Cache server, like **Redis** or **Memcached**. |
25 - a cache server, like **Redis** or **Memcached**. |
28 |
26 - Several libraries with their development headers: *libjpeg*, *libpng*, *libfreetype*, *libxml2* and *libxslt* |
29 - Several libraries with their development headers: |
27 (and *libpq* if you want to use PostgreSQL, *libldap* if you want to use LDAP authentication...). |
30 |
28 |
31 => *libjpeg*, *libpng*, *libfreetype*, *libxml2* and *libxslt* (and *libpq* if you want to use PostgreSQL) |
29 * PyAMS may be compatible with other versions but has only been completely tested with this version until now. |
32 |
|
33 |
|
34 *PyAMS may be compatible with other versions but has only been completely tested with this version until now |
|
35 |
30 |
36 On a Debian GNU/Linux: |
31 On a Debian GNU/Linux: |
37 |
32 |
38 .. code-block:: bash |
33 .. code-block:: bash |
39 |
34 |
41 $ apt-get install cython3 |
36 $ apt-get install cython3 |
42 $ apt-get install redis-server redis-tools |
37 $ apt-get install redis-server redis-tools |
43 $ apt-get install libjpeg-dev libpng-dev libfreetype6-dev libxml2-dev libxslt1-dev |
38 $ apt-get install libjpeg-dev libpng-dev libfreetype6-dev libxml2-dev libxslt1-dev |
44 |
39 |
45 |
40 |
46 **b. Initialize virtual environment** |
41 Initialize virtual environment |
47 |
42 ------------------------------ |
48 |
43 |
49 We are creating a virtual environment in */var/local/env* |
44 We are creating a virtual environment in */var/local/env* |
50 |
45 |
51 .. code-block:: bash |
46 .. code-block:: bash |
52 |
47 |
53 $ mkdir /var/local/ |
48 $ mkdir /var/local/ |
54 $ pip3 install virtualenv |
49 $ pip3 install virtualenv |
55 $ virtualenv --python=python3.5 env |
50 $ virtualenv --python=python3.5 env |
56 $ source env/bin/activate |
51 $ source env/bin/activate |
57 |
52 |
58 To use PyAMS templates *cookiecutter* is required |
53 To use PyAMS templates, the *cookiecutter* tool is required: |
59 |
54 |
60 .. code-block:: bash |
55 .. code-block:: bash |
61 |
56 |
62 (env)$ pip3.5 install cookiecutter |
57 (env)$ pip3.5 install cookiecutter |
63 |
|
64 |
58 |
65 |
59 |
66 1. Create ZODB |
60 1. Create ZODB |
67 ++++++++++++++ |
61 ++++++++++++++ |
68 |
62 |
69 We are creating a local ZODB using ZEO server using cookiecutter template |
63 We are creating a local ZODB using a "ZEO server" cookiecutter template. |
70 |
64 |
71 .. tip:: To know more about ZODB storage you can see :ref:`zodb`. |
65 .. tip:: To know more about ZODB storages you can see :ref:`zodb`. |
72 |
66 |
73 .. note:: |
67 .. note:: |
74 |
68 |
75 In this example, ZEO server instance will run as UNIX user and group. For a production |
69 In this example, ZEO server instance will run as current UNIX user and group. For a production |
76 environment, it's better to use dedicated service user and group. |
70 environment, it's better to use dedicated service user and group. |
77 |
71 |
78 Run cookiecutter: |
72 Run cookiecutter: |
79 |
73 |
80 .. code-block:: bash |
74 .. code-block:: bash |
87 .. code-block:: bash |
81 .. code-block:: bash |
88 |
82 |
89 pyams_release [latest]: |
83 pyams_release [latest]: |
90 project_name [ZEO_server]: ZEO_pyams |
84 project_name [ZEO_server]: ZEO_pyams |
91 project_slug [zeo_pyams]: |
85 project_slug [zeo_pyams]: |
92 eggs_directory [eggs]: /var/local/eggs #Python eggs will be stored into */var/local/eggs* directory. |
86 eggs_directory [eggs]: /var/local/eggs # Python eggs will be stored into */var/local/eggs* directory. |
93 run_user [zeo]: mylogin |
87 run_user [zeo]: mylogin # current user ID |
94 run_group [zeo]: mygroup |
88 run_group [zeo]: mygroup # current user group |
95 zeo_server_port [8100]: |
89 zeo_server_port [8100]: |
96 zeo_storage [pyams]: |
90 zeo_storage [pyams]: |
97 zeo_pack_report [root@localhost]: email@my-domain.com |
91 zeo_pack_report [root@localhost]: email@my-domain.com |
98 logs_directory [/var/log/zeo/zeo_pyams]: #Absolute path is mandatory |
92 logs_directory [/var/log/zeo/zeo_pyams]: # An absolute path is mandatory!!! |
99 |
93 |
100 Your ZEO environment is initialized. |
94 Your ZEO environment is initialized. |
101 To finalize it\'s creation, just type: |
95 To finalize it\'s creation, just type: |
102 - cd zeo_pyams |
96 - cd zeo_pyams |
103 - python3.5 bootstrap.py |
97 - python3.5 bootstrap.py |
104 - ./bin/buildout |
98 - ./bin/buildout |
105 |
99 |
106 |
100 |
107 In *zeo_pyams* folder, execute *bootstrap.py*... |
101 In *zeo_pyams* folder, execute *bootstrap.py*: |
108 |
102 |
109 .. code-block:: bash |
103 .. code-block:: bash |
110 |
104 |
111 (env)$ cd zeo_pyams |
105 (env)$ cd zeo_pyams |
112 |
106 |
115 Creating directory '/var/local/env/zeo_pyams/parts'. |
109 Creating directory '/var/local/env/zeo_pyams/parts'. |
116 Creating directory '/var/local/env/zeo_pyams/develop-eggs'. |
110 Creating directory '/var/local/env/zeo_pyams/develop-eggs'. |
117 Generated script '/var/local/env/zeo_pyams/bin/buildout'. |
111 Generated script '/var/local/env/zeo_pyams/bin/buildout'. |
118 |
112 |
119 |
113 |
120 ...and then run *buildout* |
114 And then run final *buildout*: |
121 |
115 |
122 .. code-block:: bash |
116 .. code-block:: bash |
123 |
117 |
124 (env)$ ./bin/buildout |
118 (env)$ ./bin/buildout |
125 |
119 |
143 Password: |
137 Password: |
144 . . . |
138 . . . |
145 daemon process started, pid=26230 |
139 daemon process started, pid=26230 |
146 |
140 |
147 |
141 |
148 |
|
149 |
|
150 2. Create application instance |
142 2. Create application instance |
151 +++++++++++++++++++++++++++ |
143 ++++++++++++++++++++++++++++++ |
152 |
144 |
153 Application instance will be created in */var/local/env/pyams* via another coockiecutter template: |
145 Application instance will be created in */var/local/env/pyams* via another coockiecutter template: |
154 |
|
155 .. tip:: |
|
156 |
146 |
157 .. code-block:: bash |
147 .. code-block:: bash |
158 |
148 |
159 (env)$ cd /var/local/env |
149 (env)$ cd /var/local/env |
160 (env)$ cookiecutter hg+http://hg.ztfy.org/pyams/scaffolds/pyams |
150 (env)$ cookiecutter hg+http://hg.ztfy.org/pyams/scaffolds/pyams |
161 |
151 |
162 |
152 |
163 Configuration |
153 .. tip:: Configuration |
164 |
154 |
165 .. tip:: |
155 1. The variable **$((INSTALL))** is the path to current folder; it will be replaced automatically by cookiecutter |
166 |
156 after application creation |
167 1. The variable *$((INSTALL))* is the path path to current folder |
157 2. You will be invited to setup additional services like **Elasticsearch** but you must install them on |
168 2. You will be invited setup supplementary services like **elastics search** but you must to install them on your own. |
158 your own. |
169 |
159 |
170 |
160 |
171 .. code-block:: bash |
161 .. code-block:: bash |
172 |
162 |
173 pyams_release [latest]: |
163 pyams_release [latest]: |
175 project_slug [pyams]: |
165 project_slug [pyams]: |
176 virtual_hostname [pyams.mydomain.com]: pyams.example.com |
166 virtual_hostname [pyams.mydomain.com]: pyams.example.com |
177 webapp_name [webapp]: |
167 webapp_name [webapp]: |
178 webapp_port [6543]: |
168 webapp_port [6543]: |
179 eggs_directory [eggs]: |
169 eggs_directory [eggs]: |
180 logs_directory [ $((INSTALL))/var/log]: |
170 logs_directory [$((INSTALL))/var/log]: |
181 run_user [www-data]: #user used to run server and write log |
171 run_user [www-data]: # user used to run server and write logs |
182 run_group [www-data]: |
172 run_group [www-data]: # group used to run server and write logs |
183 Select beaker_backend: |
173 Select beaker_backend: |
184 1 - redis |
174 1 - redis |
185 2 - memcached |
175 2 - memcached |
186 Choose from 1, 2 [1]: |
176 Choose from 1, 2 [1]: |
187 beaker_server [127.0.0.1:6379]: |
177 beaker_server [127.0.0.1:6379]: |
190 2 - relstorage |
180 2 - relstorage |
191 3 - newt |
181 3 - newt |
192 Choose from 1, 2, 3 [1]: |
182 Choose from 1, 2, 3 [1]: |
193 db_host [127.0.0.1]: |
183 db_host [127.0.0.1]: |
194 db_port [8100]: |
184 db_port [8100]: |
195 db_name [pyams]: zeo_pyams # db_name created step 1 |
185 db_name [pyams]: zeo_pyams # db_name created in step 1 |
196 db_username []: |
186 db_username []: |
197 db_password []: |
187 db_password []: |
198 zeo_realm [pyams]: |
188 zeo_realm [pyams]: |
199 blobs_dir [$((INSTALL)/var/db/blobs]: |
189 blobs_dir [$((INSTALL)/var/db/blobs]: |
200 use_postgresql [True]: False |
190 use_postgresql [True]: False |
223 To finalize it\'s creation, just type: |
213 To finalize it\'s creation, just type: |
224 - cd pyams |
214 - cd pyams |
225 - python3.5 bootstrap.py |
215 - python3.5 bootstrap.py |
226 - ./bin/buildout |
216 - ./bin/buildout |
227 |
217 |
228 In the project *pyams* folder, execute *bootstrap.py*... |
218 In the project's *pyams* folder, execute *bootstrap.py*: |
229 |
219 |
230 .. code-block:: bash |
220 .. code-block:: bash |
231 |
221 |
232 (env)$ cd pyams |
222 (env)$ cd pyams |
233 (env)$ python3.5 bootstrap.py |
223 (env)$ python3.5 bootstrap.py |
234 Creating directory '/var/local/env/pyams/bin'. |
224 Creating directory '/var/local/env/pyams/bin'. |
235 Creating directory '/var/local/env/pyams/develop-eggs'. |
225 Creating directory '/var/local/env/pyams/develop-eggs'. |
236 Generated script '/var/local/env/pyams/bin/buildout'. |
226 Generated script '/var/local/env/pyams/bin/buildout'. |
237 |
227 |
238 ...and then run *buildout* |
228 And run final *buildout*: |
239 |
229 |
240 .. code-block:: bash |
230 .. code-block:: bash |
241 |
231 |
242 (env)$ ./bin/buildout |
232 (env)$ ./bin/buildout |
243 |
233 |
244 |
234 |
245 .. note:: |
235 .. note:: |
|
236 |
246 Packages download, compilation and installation can easily take several minutes. Install errors are generally due to |
237 Packages download, compilation and installation can easily take several minutes. Install errors are generally due to |
247 missing libraries development headers. |
238 missing libraries development headers. |
248 |
239 |
249 |
240 |
250 .. tip:: |
241 .. tip:: |
265 ... |
256 ... |
266 Starting server in PID 29335. |
257 Starting server in PID 29335. |
267 Serving on http://0.0.0.0:6543 |
258 Serving on http://0.0.0.0:6543 |
268 |
259 |
269 |
260 |
270 Congrats PyAMS is running ! |
261 Congrats: PyAMS is running ! |
271 |
262 |
272 Launch a browser and open URL http://127.0.0.1:6543/admin to get access to PyAMS management interface. |
263 Launch a browser and open URL http://127.0.0.1:6543/admin to get access to PyAMS management interface. |
273 |
264 |
274 |
265 |
275 .. warning:: By default: |
266 .. warning:: |
|
267 |
|
268 By default: |
276 |
269 |
277 - Login: admin |
270 - Login: admin |
|
271 |
278 - Password: admin |
272 - Password: admin |
279 |
273 |
280 You must change it as soon as possible! |
274 **You must change it as soon as possible!** |
281 |
275 |