##// END OF EJS Templates
docs: augment setup description with more details of http server and database...
Mads Kiilerich -
r8326:ff8651b2 default
parent child Browse files
Show More
@@ -1,520 +1,520 b''
1 1 ###################################################################################
2 2 ###################################################################################
3 3 ## Kallithea config file generated with kallithea-cli ##
4 4 ## ##
5 5 ## The %(here)s variable will generally be replaced with the parent directory of ##
6 6 ## this file. Other use of % must be escaped as %% . ##
7 7 ###################################################################################
8 8 ###################################################################################
9 9
10 10 [DEFAULT]
11 11
12 12 ################################################################################
13 13 ## Email settings ##
14 14 ## ##
15 15 ## Refer to the documentation ("Email settings") for more details. ##
16 16 ## ##
17 17 ## It is recommended to use a valid sender address that passes access ##
18 18 ## validation and spam filtering in mail servers. ##
19 19 ################################################################################
20 20
21 21 ## 'From' header for application emails. You can optionally add a name.
22 22 ## Default:
23 23 #app_email_from = Kallithea
24 24 ## Examples:
25 25 #app_email_from = Kallithea <kallithea-noreply@example.com>
26 26 #app_email_from = kallithea-noreply@example.com
27 27
28 28 ## Subject prefix for application emails.
29 29 ## A space between this prefix and the real subject is automatically added.
30 30 ## Default:
31 31 #email_prefix =
32 32 ## Example:
33 33 #email_prefix = [Kallithea]
34 34
35 35 ## Recipients for error emails and fallback recipients of application mails.
36 36 ## Multiple addresses can be specified, comma-separated.
37 37 ## Only addresses are allowed, do not add any name part.
38 38 ## Default:
39 39 #email_to =
40 40 ## Examples:
41 41 #email_to = admin@example.com
42 42 #email_to = admin@example.com,another_admin@example.com
43 43 email_to =
44 44
45 45 ## 'From' header for error emails. You can optionally add a name.
46 46 ## Default: (none)
47 47 ## Examples:
48 48 #error_email_from = Kallithea Errors <kallithea-noreply@example.com>
49 49 #error_email_from = kallithea_errors@example.com
50 50 error_email_from =
51 51
52 52 ## SMTP server settings
53 53 ## If specifying credentials, make sure to use secure connections.
54 54 ## Default: Send unencrypted unauthenticated mails to the specified smtp_server.
55 55 ## For "SSL", use smtp_use_ssl = true and smtp_port = 465.
56 56 ## For "STARTTLS", use smtp_use_tls = true and smtp_port = 587.
57 57 smtp_server =
58 58 smtp_username =
59 59 smtp_password =
60 60 smtp_port =
61 61 smtp_use_ssl = false
62 62 smtp_use_tls = false
63 63
64 64 ## Entry point for 'gearbox serve'
65 65 [server:main]
66 66 #host = 127.0.0.1
67 67 host = 0.0.0.0
68 68 port = 5000
69 69
70 70 ## Gearbox serve uses the Waitress web server ##
71 71 use = egg:waitress#main
72 72 ## avoid multi threading
73 73 threads = 1
74 74 ## allow push of repos bigger than the default of 1 GB
75 75 max_request_body_size = 107374182400
76 76 ## use poll instead of select, fixes fd limits, may not work on old
77 77 ## windows systems.
78 78 #asyncore_use_poll = True
79 79
80 80 ## middleware for hosting the WSGI application under a URL prefix
81 81 #[filter:proxy-prefix]
82 82 #use = egg:PasteDeploy#prefix
83 83 #prefix = /<your-prefix>
84 84
85 85 [app:main]
86 86 use = egg:kallithea
87 87 ## enable proxy prefix middleware
88 88 #filter-with = proxy-prefix
89 89
90 90 full_stack = true
91 91 static_files = true
92 92
93 93 ## Internationalization (see setup documentation for details)
94 94 ## By default, the languages requested by the browser are used if available, with English as default.
95 95 ## Set i18n.enabled=false to disable automatic language choice.
96 96 #i18n.enabled = true
97 97 ## To Force a language, set i18n.enabled=false and specify the language in i18n.lang.
98 98 ## Valid values are the names of subdirectories in kallithea/i18n with a LC_MESSAGES/kallithea.mo
99 99 #i18n.lang = en
100 100
101 101 cache_dir = %(here)s/data
102 102 index_dir = %(here)s/data/index
103 103
104 104 ## uncomment and set this path to use archive download cache
105 105 archive_cache_dir = %(here)s/tarballcache
106 106
107 107 ## change this to unique ID for security
108 108 #app_instance_uuid = VERY-SECRET
109 109 app_instance_uuid = development-not-secret
110 110
111 111 ## cut off limit for large diffs (size in bytes)
112 112 cut_off_limit = 256000
113 113
114 114 ## force https in Kallithea, fixes https redirects, assumes it's always https
115 115 force_https = false
116 116
117 117 ## use Strict-Transport-Security headers
118 118 use_htsts = false
119 119
120 120 ## number of commits stats will parse on each iteration
121 121 commit_parse_limit = 25
122 122
123 123 ## Path to Python executable to be used for git hooks.
124 124 ## This value will be written inside the git hook scripts as the text
125 125 ## after '#!' (shebang). When empty or not defined, the value of
126 126 ## 'sys.executable' at the time of installation of the git hooks is
127 127 ## used, which is correct in many cases but for example not when using uwsgi.
128 128 ## If you change this setting, you should reinstall the Git hooks via
129 129 ## Admin > Settings > Remap and Rescan.
130 130 #git_hook_interpreter = /srv/kallithea/venv/bin/python3
131 131
132 132 ## path to git executable
133 133 git_path = git
134 134
135 135 ## git rev filter option, --all is the default filter, if you need to
136 136 ## hide all refs in changelog switch this to --branches --tags
137 137 #git_rev_filter = --branches --tags
138 138
139 139 ## RSS feed options
140 140 rss_cut_off_limit = 256000
141 141 rss_items_per_page = 10
142 142 rss_include_diff = false
143 143
144 144 ## options for showing and identifying changesets
145 145 show_sha_length = 12
146 146 show_revision_number = false
147 147
148 148 ## Canonical URL to use when creating full URLs in UI and texts.
149 149 ## Useful when the site is available under different names or protocols.
150 150 ## Defaults to what is provided in the WSGI environment.
151 151 #canonical_url = https://kallithea.example.com/repos
152 152
153 153 ## gist URL alias, used to create nicer urls for gist. This should be an
154 154 ## url that does rewrites to _admin/gists/<gistid>.
155 155 ## example: http://gist.example.com/{gistid}. Empty means use the internal
156 156 ## Kallithea url, ie. http[s]://kallithea.example.com/_admin/gists/<gistid>
157 157 gist_alias_url =
158 158
159 159 ## default encoding used to convert from and to unicode
160 160 ## can be also a comma separated list of encoding in case of mixed encodings
161 161 default_encoding = utf-8
162 162
163 163 ## Set Mercurial encoding, similar to setting HGENCODING before launching Kallithea
164 164 hgencoding = utf-8
165 165
166 166 ## issue tracker for Kallithea (leave blank to disable, absent for default)
167 167 #bugtracker = https://bitbucket.org/conservancy/kallithea/issues
168 168
169 169 ## issue tracking mapping for commit messages, comments, PR descriptions, ...
170 170 ## Refer to the documentation ("Integration with issue trackers") for more details.
171 171
172 172 ## regular expression to match issue references
173 173 ## This pattern may/should contain parenthesized groups, that can
174 174 ## be referred to in issue_server_link or issue_sub using Python backreferences
175 175 ## (e.g. \1, \2, ...). You can also create named groups with '(?P<groupname>)'.
176 176 ## To require mandatory whitespace before the issue pattern, use:
177 177 ## (?:^|(?<=\s)) before the actual pattern, and for mandatory whitespace
178 178 ## behind the issue pattern, use (?:$|(?=\s)) after the actual pattern.
179 179
180 180 issue_pat = #(\d+)
181 181
182 182 ## server url to the issue
183 183 ## This pattern may/should contain backreferences to parenthesized groups in issue_pat.
184 184 ## A backreference can be \1, \2, ... or \g<groupname> if you specified a named group
185 185 ## called 'groupname' in issue_pat.
186 186 ## The special token {repo} is replaced with the full repository name
187 187 ## including repository groups, while {repo_name} is replaced with just
188 188 ## the name of the repository.
189 189
190 190 issue_server_link = https://issues.example.com/{repo}/issue/\1
191 191
192 192 ## substitution pattern to use as the link text
193 193 ## If issue_sub is empty, the text matched by issue_pat is retained verbatim
194 194 ## for the link text. Otherwise, the link text is that of issue_sub, with any
195 195 ## backreferences to groups in issue_pat replaced.
196 196
197 197 issue_sub =
198 198
199 199 ## issue_pat, issue_server_link and issue_sub can have suffixes to specify
200 200 ## multiple patterns, to other issues server, wiki or others
201 201 ## below an example how to create a wiki pattern
202 202 ## wiki-some-id -> https://wiki.example.com/some-id
203 203
204 204 #issue_pat_wiki = wiki-(\S+)
205 205 #issue_server_link_wiki = https://wiki.example.com/\1
206 206 #issue_sub_wiki = WIKI-\1
207 207
208 208 ## alternative return HTTP header for failed authentication. Default HTTP
209 209 ## response is 401 HTTPUnauthorized. Currently Mercurial clients have trouble with
210 210 ## handling that. Set this variable to 403 to return HTTPForbidden
211 211 auth_ret_code =
212 212
213 213 ## allows to change the repository location in settings page
214 214 allow_repo_location_change = True
215 215
216 216 ## allows to setup custom hooks in settings page
217 217 allow_custom_hooks_settings = True
218 218
219 219 ## extra extensions for indexing, space separated and without the leading '.'.
220 220 #index.extensions =
221 221 # gemfile
222 222 # lock
223 223
224 224 ## extra filenames for indexing, space separated
225 225 #index.filenames =
226 226 # .dockerignore
227 227 # .editorconfig
228 228 # INSTALL
229 229 # CHANGELOG
230 230
231 231 ####################################
232 232 ## SSH CONFIG ##
233 233 ####################################
234 234
235 235 ## SSH is disabled by default, until an Administrator decides to enable it.
236 236 ssh_enabled = false
237 237
238 238 ## File where users' SSH keys will be stored *if* ssh_enabled is true.
239 239 #ssh_authorized_keys = /home/kallithea/.ssh/authorized_keys
240 240
241 241 ## Path to be used in ssh_authorized_keys file to invoke kallithea-cli with ssh-serve.
242 242 #kallithea_cli_path = /srv/kallithea/venv/bin/kallithea-cli
243 243
244 244 ## Locale to be used in the ssh-serve command.
245 245 ## This is needed because an SSH client may try to use its own locale
246 246 ## settings, which may not be available on the server.
247 247 ## See `locale -a` for valid values on this system.
248 248 #ssh_locale = C.UTF-8
249 249
250 250 ####################################
251 251 ## CELERY CONFIG ##
252 252 ####################################
253 253
254 254 ## Note: Celery doesn't support Windows.
255 255 use_celery = false
256 256
257 257 ## Celery config settings from https://docs.celeryproject.org/en/4.4.0/userguide/configuration.html prefixed with 'celery.'.
258 258
259 259 ## Example: use the message queue on the local virtual host 'kallitheavhost' as the RabbitMQ user 'kallithea':
260 260 celery.broker_url = amqp://kallithea:thepassword@localhost:5672/kallitheavhost
261 261
262 262 celery.result.backend = db+sqlite:///celery-results.db
263 263
264 264 #celery.amqp.task.result.expires = 18000
265 265
266 266 celery.worker_concurrency = 2
267 267 celery.worker_max_tasks_per_child = 1
268 268
269 269 ## If true, tasks will never be sent to the queue, but executed locally instead.
270 270 celery.task_always_eager = false
271 271
272 272 ####################################
273 273 ## BEAKER CACHE ##
274 274 ####################################
275 275
276 276 beaker.cache.data_dir = %(here)s/data/cache/data
277 277 beaker.cache.lock_dir = %(here)s/data/cache/lock
278 278
279 279 beaker.cache.regions = long_term,long_term_file
280 280
281 281 beaker.cache.long_term.type = memory
282 282 beaker.cache.long_term.expire = 36000
283 283 beaker.cache.long_term.key_length = 256
284 284
285 285 beaker.cache.long_term_file.type = file
286 286 beaker.cache.long_term_file.expire = 604800
287 287 beaker.cache.long_term_file.key_length = 256
288 288
289 289 ####################################
290 290 ## BEAKER SESSION ##
291 291 ####################################
292 292
293 293 ## Name of session cookie. Should be unique for a given host and path, even when running
294 294 ## on different ports. Otherwise, cookie sessions will be shared and messed up.
295 295 session.key = kallithea
296 296 ## Sessions should always only be accessible by the browser, not directly by JavaScript.
297 297 session.httponly = true
298 298 ## Session lifetime. 2592000 seconds is 30 days.
299 299 session.timeout = 2592000
300 300
301 301 ## Server secret used with HMAC to ensure integrity of cookies.
302 302 #session.secret = VERY-SECRET
303 303 session.secret = development-not-secret
304 304 ## Further, encrypt the data with AES.
305 305 #session.encrypt_key = <key_for_encryption>
306 306 #session.validate_key = <validation_key>
307 307
308 308 ## Type of storage used for the session, current types are
309 309 ## dbm, file, memcached, database, and memory.
310 310
311 311 ## File system storage of session data. (default)
312 312 #session.type = file
313 313
314 314 ## Cookie only, store all session data inside the cookie. Requires secure secrets.
315 315 #session.type = cookie
316 316
317 317 ## Database storage of session data.
318 318 #session.type = ext:database
319 319 #session.sa.url = postgresql://postgres:qwe@localhost/kallithea
320 320 #session.table_name = db_session
321 321
322 322 ####################################
323 323 ## ERROR HANDLING ##
324 324 ####################################
325 325
326 326 ## Show a nice error page for application HTTP errors and exceptions (default true)
327 327 #errorpage.enabled = true
328 328
329 329 ## Enable Backlash client-side interactive debugger (default false)
330 330 ## WARNING: *THIS MUST BE false IN PRODUCTION ENVIRONMENTS!!!*
331 331 ## This debug mode will allow all visitors to execute malicious code.
332 332 #debug = false
333 333 debug = true
334 334
335 335 ## Enable Backlash server-side error reporting (unless debug mode handles it client-side) (default true)
336 336 #trace_errors.enable = true
337 337 ## Errors will be reported by mail if trace_errors.error_email is set.
338 338
339 339 ## Propagate email settings to ErrorReporter of TurboGears2
340 340 ## You do not normally need to change these lines
341 341 get trace_errors.smtp_server = smtp_server
342 342 get trace_errors.smtp_port = smtp_port
343 343 get trace_errors.from_address = error_email_from
344 344 get trace_errors.error_email = email_to
345 345 get trace_errors.smtp_username = smtp_username
346 346 get trace_errors.smtp_password = smtp_password
347 347 get trace_errors.smtp_use_tls = smtp_use_tls
348 348
349 349
350 350 ##################################
351 351 ## LOGVIEW CONFIG ##
352 352 ##################################
353 353
354 354 logview.sqlalchemy = #faa
355 355 logview.pylons.templating = #bfb
356 356 logview.pylons.util = #eee
357 357
358 358 #########################
359 359 ## DB CONFIG ##
360 360 #########################
361 361
362 362 sqlalchemy.url = sqlite:///%(here)s/kallithea.db?timeout=60
363 #sqlalchemy.url = postgresql://user:pass@localhost/kallithea
364 #sqlalchemy.url = mysql://user:pass@localhost/kallithea?charset=utf8
363 #sqlalchemy.url = postgresql://kallithea:password@localhost/kallithea
364 #sqlalchemy.url = mysql://kallithea:password@localhost/kallithea?charset=utf8
365 365 ## Note: the mysql:// prefix should also be used for MariaDB
366 366
367 367 sqlalchemy.pool_recycle = 3600
368 368
369 369 ################################
370 370 ## ALEMBIC CONFIGURATION ##
371 371 ################################
372 372
373 373 [alembic]
374 374 script_location = kallithea:alembic
375 375
376 376 ################################
377 377 ## LOGGING CONFIGURATION ##
378 378 ################################
379 379
380 380 [loggers]
381 381 keys = root, routes, kallithea, sqlalchemy, tg, gearbox, beaker, templates, whoosh_indexer, werkzeug, backlash
382 382
383 383 [handlers]
384 384 keys = console, console_color, console_color_sql, null
385 385
386 386 [formatters]
387 387 keys = generic, color_formatter, color_formatter_sql
388 388
389 389 #############
390 390 ## LOGGERS ##
391 391 #############
392 392
393 393 [logger_root]
394 394 level = NOTSET
395 395 #handlers = console
396 396 ## For coloring based on log level:
397 397 handlers = console_color
398 398
399 399 [logger_routes]
400 400 #level = WARN
401 401 level = DEBUG
402 402 handlers =
403 403 qualname = routes.middleware
404 404 ## "level = DEBUG" logs the route matched and routing variables.
405 405
406 406 [logger_beaker]
407 407 #level = WARN
408 408 level = DEBUG
409 409 handlers =
410 410 qualname = beaker.container
411 411
412 412 [logger_templates]
413 413 #level = WARN
414 414 level = INFO
415 415 handlers =
416 416 qualname = pylons.templating
417 417
418 418 [logger_kallithea]
419 419 #level = WARN
420 420 level = DEBUG
421 421 handlers =
422 422 qualname = kallithea
423 423
424 424 [logger_tg]
425 425 #level = WARN
426 426 level = DEBUG
427 427 handlers =
428 428 qualname = tg
429 429
430 430 [logger_gearbox]
431 431 #level = WARN
432 432 level = DEBUG
433 433 handlers =
434 434 qualname = gearbox
435 435
436 436 [logger_sqlalchemy]
437 437 level = WARN
438 438 handlers =
439 439 qualname = sqlalchemy.engine
440 440 ## For coloring based on log level and pretty printing of SQL:
441 441 #level = INFO
442 442 #handlers = console_color_sql
443 443 #propagate = 0
444 444
445 445 [logger_whoosh_indexer]
446 446 #level = WARN
447 447 level = DEBUG
448 448 handlers =
449 449 qualname = whoosh_indexer
450 450
451 451 [logger_werkzeug]
452 452 level = WARN
453 453 handlers =
454 454 qualname = werkzeug
455 455
456 456 [logger_backlash]
457 457 level = WARN
458 458 handlers =
459 459 qualname = backlash
460 460
461 461 ##############
462 462 ## HANDLERS ##
463 463 ##############
464 464
465 465 [handler_console]
466 466 class = StreamHandler
467 467 args = (sys.stderr,)
468 468 formatter = generic
469 469
470 470 [handler_console_color]
471 471 ## ANSI color coding based on log level
472 472 class = StreamHandler
473 473 args = (sys.stderr,)
474 474 formatter = color_formatter
475 475
476 476 [handler_console_color_sql]
477 477 ## ANSI color coding and pretty printing of SQL statements
478 478 class = StreamHandler
479 479 args = (sys.stderr,)
480 480 formatter = color_formatter_sql
481 481
482 482 [handler_null]
483 483 class = NullHandler
484 484 args = ()
485 485
486 486 ################
487 487 ## FORMATTERS ##
488 488 ################
489 489
490 490 [formatter_generic]
491 491 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
492 492 datefmt = %Y-%m-%d %H:%M:%S
493 493
494 494 [formatter_color_formatter]
495 495 class = kallithea.lib.colored_formatter.ColorFormatter
496 496 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
497 497 datefmt = %Y-%m-%d %H:%M:%S
498 498
499 499 [formatter_color_formatter_sql]
500 500 class = kallithea.lib.colored_formatter.ColorFormatterSql
501 501 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
502 502 datefmt = %Y-%m-%d %H:%M:%S
503 503
504 504 #################
505 505 ## SSH LOGGING ##
506 506 #################
507 507
508 508 ## The default loggers use 'handler_console' that uses StreamHandler with
509 509 ## destination 'sys.stderr'. In the context of the SSH server process, these log
510 510 ## messages would be sent to the client, which is normally not what you want.
511 511 ## By default, when running ssh-serve, just use NullHandler and disable logging
512 512 ## completely. For other logging options, see:
513 513 ## https://docs.python.org/2/library/logging.handlers.html
514 514
515 515 [ssh_serve:logger_root]
516 516 level = CRITICAL
517 517 handlers = null
518 518
519 519 ## Note: If logging is configured with other handlers, they might need similar
520 520 ## muting for ssh-serve too.
@@ -1,657 +1,685 b''
1 1 .. _setup:
2 2
3 3 =====
4 4 Setup
5 5 =====
6 6
7 7
8 8 Setting up Kallithea
9 9 --------------------
10 10
11 11 Some further details to the steps mentioned in the overview.
12 12
13 13 Create low level configuration file
14 14 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
15 15
16 First, you will need to create a Kallithea configuration file. Run the
17 following command to do so::
16 First, you will need to create a Kallithea configuration file. The
17 configuration file is a ``.ini`` file that contains various low level settings
18 for Kallithea, e.g. configuration of how to use database, web server, email,
19 and logging.
18 20
19 kallithea-cli config-create my.ini
21 Run the following command to create the file ``my.ini`` in the current
22 directory::
20 23
21 This will create the file ``my.ini`` in the current directory. This
22 configuration file contains the various settings for Kallithea, e.g.
23 proxy port, email settings, usage of static files, cache, Celery
24 settings, and logging. Extra settings can be specified like::
24 kallithea-cli config-create my.ini http_server=waitress
25
26 To get a good starting point for your configuration, specify the http server
27 you intend to use. It can be ``waitress``, ``gearbox``, ``gevent``,
28 ``gunicorn``, or ``uwsgi``. (Apache ``mod_wsgi`` will not use this
29 configuration file, and it is fine to keep the default http_server configuration
30 unused. ``mod_wsgi`` is configured using ``httpd.conf`` directives and a WSGI
31 wrapper script.)
32
33 Extra custom settings can be specified like::
25 34
26 35 kallithea-cli config-create my.ini host=8.8.8.8 "[handler_console]" formatter=color_formatter
27 36
28 37 Populate the database
29 38 ^^^^^^^^^^^^^^^^^^^^^
30 39
31 Next, you need to create the databases used by Kallithea. It is recommended to
32 use PostgreSQL or SQLite (default). If you choose a database other than the
33 default, ensure you properly adjust the database URL in your ``my.ini``
34 configuration file to use this other database. Kallithea currently supports
35 PostgreSQL, SQLite and MariaDB/MySQL databases. Create the database by running
36 the following command::
40 Next, you need to create the databases used by Kallithea. Kallithea currently
41 supports PostgreSQL, SQLite and MariaDB/MySQL databases. It is recommended to
42 start out using SQLite (the default) and move to PostgreSQL if it becomes a
43 bottleneck or to get a "proper" database. MariaDB/MySQL is also supported.
44
45 For PostgreSQL, run ``pip install psycopg2`` to get the database driver. Make
46 sure the PostgreSQL server is initialized and running. Make sure you have a
47 database user with password authentication with permissions to create databases
48 - for example by running::
49
50 sudo -u postgres createuser 'kallithea' --pwprompt --createdb
51
52 For MariaDB/MySQL, run ``pip install mysqlclient`` to get the ``MySQLdb``
53 database driver. Make sure the database server is initialized and running. Make
54 sure you have a database user with password authentication with permissions to
55 create the database - for example by running::
56
57 echo 'CREATE USER "kallithea"@"localhost" IDENTIFIED BY "password"' | sudo -u mysql mysql
58 echo 'GRANT ALL PRIVILEGES ON `kallithea`.* TO "kallithea"@"localhost"' | sudo -u mysql mysql
59
60 Check and adjust ``sqlalchemy.url`` in your ``my.ini`` configuration file to use
61 this database.
62
63 Create the database, tables, and initial content by running the following
64 command::
37 65
38 66 kallithea-cli db-create -c my.ini
39 67
40 68 This will first prompt you for a "root" path. This "root" path is the location
41 69 where Kallithea will store all of its repositories on the current machine. This
42 70 location must be writable for the running Kallithea application. Next,
43 71 ``db-create`` will prompt you for a username and password for the initial admin
44 72 account it sets up for you.
45 73
46 74 The ``db-create`` values can also be given on the command line.
47 75 Example::
48 76
49 77 kallithea-cli db-create -c my.ini --user=nn --password=secret --email=nn@example.com --repos=/srv/repos
50 78
51 79 The ``db-create`` command will create all needed tables and an
52 80 admin account. When choosing a root path you can either use a new
53 81 empty location, or a location which already contains existing
54 82 repositories. If you choose a location which contains existing
55 83 repositories Kallithea will add all of the repositories at the chosen
56 84 location to its database. (Note: make sure you specify the correct
57 85 path to the root).
58 86
59
60 87 Prepare front-end files
61 88 ^^^^^^^^^^^^^^^^^^^^^^^
62 89
63 90 Finally, the front-end files must be prepared. This requires ``npm`` version 6
64 91 or later, which needs ``node.js`` (version 12 or later). Prepare the front-end
65 92 by running::
66 93
67 94 kallithea-cli front-end-build
68 95
69 96 Running
70 97 ^^^^^^^
71 98
72 You are now ready to use Kallithea. To run it simply execute::
99 You are now ready to use Kallithea. To run it using a gearbox web server,
100 simply execute::
73 101
74 102 gearbox serve -c my.ini
75 103
76 104 - This command runs the Kallithea server. The web app should be available at
77 105 http://127.0.0.1:5000. The IP address and port is configurable via the
78 106 configuration file created in the previous step.
79 107 - Log in to Kallithea using the admin account created when running ``db-create``.
80 108 - The default permissions on each repository is read, and the owner is admin.
81 109 Remember to update these if needed.
82 110 - In the admin panel you can toggle LDAP, anonymous, and permissions
83 111 settings, as well as edit more advanced options on users and
84 112 repositories.
85 113
86 114
87 115 Internationalization (i18n support)
88 116 -----------------------------------
89 117
90 118 The Kallithea web interface is automatically displayed in the user's preferred
91 119 language, as indicated by the browser. Thus, different users may see the
92 120 application in different languages. If the requested language is not available
93 121 (because the translation file for that language does not yet exist or is
94 122 incomplete), English is used.
95 123
96 124 If you want to disable automatic language detection and instead configure a
97 125 fixed language regardless of user preference, set ``i18n.enabled = false`` and
98 126 specify another language by setting ``i18n.lang`` in the Kallithea
99 127 configuration file.
100 128
101 129
102 130 Using Kallithea with SSH
103 131 ------------------------
104 132
105 133 Kallithea supports repository access via SSH key based authentication.
106 134 This means:
107 135
108 136 - repository URLs like ``ssh://kallithea@example.com/name/of/repository``
109 137
110 138 - all network traffic for both read and write happens over the SSH protocol on
111 139 port 22, without using HTTP/HTTPS nor the Kallithea WSGI application
112 140
113 141 - encryption and authentication protocols are managed by the system's ``sshd``
114 142 process, with all users using the same Kallithea system user (e.g.
115 143 ``kallithea``) when connecting to the SSH server, but with users' public keys
116 144 in the Kallithea system user's `.ssh/authorized_keys` file granting each user
117 145 sandboxed access to the repositories.
118 146
119 147 - users and admins can manage SSH public keys in the web UI
120 148
121 149 - in their SSH client configuration, users can configure how the client should
122 150 control access to their SSH key - without passphrase, with passphrase, and
123 151 optionally with passphrase caching in the local shell session (``ssh-agent``).
124 152 This is standard SSH functionality, not something Kallithea provides or
125 153 interferes with.
126 154
127 155 - network communication between client and server happens in a bidirectional
128 156 stateful stream, and will in some cases be faster than HTTP/HTTPS with several
129 157 stateless round-trips.
130 158
131 159 .. note:: At this moment, repository access via SSH has been tested on Unix
132 160 only. Windows users that care about SSH are invited to test it and report
133 161 problems, ideally contributing patches that solve these problems.
134 162
135 163 Users and admins can upload SSH public keys (e.g. ``.ssh/id_rsa.pub``) through
136 164 the web interface. The server's ``.ssh/authorized_keys`` file is automatically
137 165 maintained with an entry for each SSH key. Each entry will tell ``sshd`` to run
138 166 ``kallithea-cli`` with the ``ssh-serve`` sub-command and the right Kallithea user ID
139 167 when encountering the corresponding SSH key.
140 168
141 169 To enable SSH repository access, Kallithea must be configured with the path to
142 170 the ``.ssh/authorized_keys`` file for the Kallithea user, and the path to the
143 171 ``kallithea-cli`` command. Put something like this in the ``.ini`` file::
144 172
145 173 ssh_enabled = true
146 174 ssh_authorized_keys = /home/kallithea/.ssh/authorized_keys
147 175 kallithea_cli_path = /srv/kallithea/venv/bin/kallithea-cli
148 176
149 177 The SSH service must be running, and the Kallithea user account must be active
150 178 (not necessarily with password access, but public key access must be enabled),
151 179 all file permissions must be set as sshd wants it, and ``authorized_keys`` must
152 180 be writeable by the Kallithea user.
153 181
154 182 .. note:: The ``authorized_keys`` file will be rewritten from scratch on
155 183 each update. If it already exists with other data, Kallithea will not
156 184 overwrite the existing ``authorized_keys``, and the server process will
157 185 instead throw an exception. The system administrator thus cannot ssh
158 186 directly to the Kallithea user but must use su/sudo from another account.
159 187
160 188 If ``/home/kallithea/.ssh/`` (the directory of the path specified in the
161 189 ``ssh_authorized_keys`` setting of the ``.ini`` file) does not exist as a
162 190 directory, Kallithea will attempt to create it. If that path exists but is
163 191 *not* a directory, or is not readable-writable-executable by the server
164 192 process, the server process will raise an exception each time it attempts to
165 193 write the ``authorized_keys`` file.
166 194
167 195 .. note:: It is possible to configure the SSH server to look for authorized
168 196 keys in multiple files, for example reserving ``ssh/authorized_keys`` to be
169 197 used for normal SSH and with Kallithea using
170 198 ``.ssh/authorized_keys_kallithea``. In ``/etc/ssh/sshd_config`` set
171 199 ``AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys_kallithea``
172 200 and restart sshd, and in ``my.ini`` set ``ssh_authorized_keys =
173 201 /home/kallithea/.ssh/authorized_keys_kallithea``. Note that this new
174 202 location will apply to all system users, and that multiple entries for the
175 203 same SSH key will shadow each other.
176 204
177 205 .. warning:: The handling of SSH access is steered directly by the command
178 206 specified in the ``authorized_keys`` file. There is no interaction with the
179 207 web UI. Once SSH access is correctly configured and enabled, it will work
180 208 regardless of whether the Kallithea web process is actually running. Hence,
181 209 if you want to perform repository or server maintenance and want to fully
182 210 disable all access to the repositories, disable SSH access by setting
183 211 ``ssh_enabled = false`` in the correct ``.ini`` file (i.e. the ``.ini`` file
184 212 specified in the ``authorized_keys`` file.)
185 213
186 214 The ``authorized_keys`` file can be updated manually with ``kallithea-cli
187 215 ssh-update-authorized-keys -c my.ini``. This command is not needed in normal
188 216 operation but is for example useful after changing SSH-related settings in the
189 217 ``.ini`` file or renaming that file. (The path to the ``.ini`` file is used in
190 218 the generated ``authorized_keys`` file).
191 219
192 220
193 221 Setting up Whoosh full text search
194 222 ----------------------------------
195 223
196 224 Kallithea provides full text search of repositories using `Whoosh`__.
197 225
198 226 .. __: https://whoosh.readthedocs.io/en/latest/
199 227
200 228 For an incremental index build, run::
201 229
202 230 kallithea-cli index-create -c my.ini
203 231
204 232 For a full index rebuild, run::
205 233
206 234 kallithea-cli index-create -c my.ini --full
207 235
208 236 The ``--repo-location`` option allows the location of the repositories to be overridden;
209 237 usually, the location is retrieved from the Kallithea database.
210 238
211 239 The ``--index-only`` option can be used to limit the indexed repositories to a comma-separated list::
212 240
213 241 kallithea-cli index-create -c my.ini --index-only=vcs,kallithea
214 242
215 243 To keep your index up-to-date it is necessary to do periodic index builds;
216 244 for this, it is recommended to use a crontab entry. Example::
217 245
218 246 0 3 * * * /path/to/virtualenv/bin/kallithea-cli index-create -c /path/to/kallithea/my.ini
219 247
220 248 When using incremental mode (the default), Whoosh will check the last
221 249 modification date of each file and add it to be reindexed if a newer file is
222 250 available. The indexing daemon checks for any removed files and removes them
223 251 from index.
224 252
225 253 If you want to rebuild the index from scratch, you can use the ``-f`` flag as above,
226 254 or in the admin panel you can check the "build from scratch" checkbox.
227 255
228 256
229 257 Integration with issue trackers
230 258 -------------------------------
231 259
232 260 Kallithea provides a simple integration with issue trackers. It's possible
233 261 to define a regular expression that will match an issue ID in commit messages,
234 262 and have that replaced with a URL to the issue.
235 263
236 264 This is achieved with following three variables in the ini file::
237 265
238 266 issue_pat = #(\d+)
239 267 issue_server_link = https://issues.example.com/{repo}/issue/\1
240 268 issue_sub =
241 269
242 270 ``issue_pat`` is the regular expression describing which strings in
243 271 commit messages will be treated as issue references. The expression can/should
244 272 have one or more parenthesized groups that can later be referred to in
245 273 ``issue_server_link`` and ``issue_sub`` (see below). If you prefer, named groups
246 274 can be used instead of simple parenthesized groups.
247 275
248 276 If the pattern should only match if it is preceded by whitespace, add the
249 277 following string before the actual pattern: ``(?:^|(?<=\s))``.
250 278 If the pattern should only match if it is followed by whitespace, add the
251 279 following string after the actual pattern: ``(?:$|(?=\s))``.
252 280 These expressions use lookbehind and lookahead assertions of the Python regular
253 281 expression module to avoid the whitespace to be part of the actual pattern,
254 282 otherwise the link text will also contain that whitespace.
255 283
256 284 Matched issue references are replaced with the link specified in
257 285 ``issue_server_link``, in which any backreferences are resolved. Backreferences
258 286 can be ``\1``, ``\2``, ... or for named groups ``\g<groupname>``.
259 287 The special token ``{repo}`` is replaced with the full repository path
260 288 (including repository groups), while token ``{repo_name}`` is replaced with the
261 289 repository name (without repository groups).
262 290
263 291 The link text is determined by ``issue_sub``, which can be a string containing
264 292 backreferences to the groups specified in ``issue_pat``. If ``issue_sub`` is
265 293 empty, then the text matched by ``issue_pat`` is used verbatim.
266 294
267 295 The example settings shown above match issues in the format ``#<number>``.
268 296 This will cause the text ``#300`` to be transformed into a link:
269 297
270 298 .. code-block:: html
271 299
272 300 <a href="https://issues.example.com/example_repo/issue/300">#300</a>
273 301
274 302 The following example transforms a text starting with either of 'pullrequest',
275 303 'pull request' or 'PR', followed by an optional space, then a pound character
276 304 (#) and one or more digits, into a link with the text 'PR #' followed by the
277 305 digits::
278 306
279 307 issue_pat = (pullrequest|pull request|PR) ?#(\d+)
280 308 issue_server_link = https://issues.example.com/\2
281 309 issue_sub = PR #\2
282 310
283 311 The following example demonstrates how to require whitespace before the issue
284 312 reference in order for it to be recognized, such that the text ``issue#123`` will
285 313 not cause a match, but ``issue #123`` will::
286 314
287 315 issue_pat = (?:^|(?<=\s))#(\d+)
288 316 issue_server_link = https://issues.example.com/\1
289 317 issue_sub =
290 318
291 319 If needed, more than one pattern can be specified by appending a unique suffix to
292 320 the variables. For example, also demonstrating the use of named groups::
293 321
294 322 issue_pat_wiki = wiki-(?P<pagename>\S+)
295 323 issue_server_link_wiki = https://wiki.example.com/\g<pagename>
296 324 issue_sub_wiki = WIKI-\g<pagename>
297 325
298 326 With these settings, wiki pages can be referenced as wiki-some-id, and every
299 327 such reference will be transformed into:
300 328
301 329 .. code-block:: html
302 330
303 331 <a href="https://wiki.example.com/some-id">WIKI-some-id</a>
304 332
305 333 Refer to the `Python regular expression documentation`_ for more details about
306 334 the supported syntax in ``issue_pat``, ``issue_server_link`` and ``issue_sub``.
307 335
308 336
309 337 Hook management
310 338 ---------------
311 339
312 340 Hooks can be managed in similar way to that used in ``.hgrc`` files.
313 341 To manage hooks, choose *Admin > Settings > Hooks*.
314 342
315 343 The built-in hooks cannot be modified, though they can be enabled or disabled in the *VCS* section.
316 344
317 345 To add another custom hook simply fill in the first textbox with
318 346 ``<name>.<hook_type>`` and the second with the hook path. Example hooks
319 347 can be found in ``kallithea.lib.hooks``.
320 348
321 349
322 350 Changing default encoding
323 351 -------------------------
324 352
325 353 By default, Kallithea uses UTF-8 encoding.
326 354 This is configurable as ``default_encoding`` in the .ini file.
327 355 This affects many parts in Kallithea including user names, filenames, and
328 356 encoding of commit messages. In addition Kallithea can detect if the ``chardet``
329 357 library is installed. If ``chardet`` is detected Kallithea will fallback to it
330 358 when there are encode/decode errors.
331 359
332 360 The Mercurial encoding is configurable as ``hgencoding``. It is similar to
333 361 setting the ``HGENCODING`` environment variable, but will override it.
334 362
335 363
336 364 Celery configuration
337 365 --------------------
338 366
339 367 Kallithea can use the distributed task queue system Celery_ to run tasks like
340 368 cloning repositories or sending emails.
341 369
342 370 Kallithea will in most setups work perfectly fine out of the box (without
343 371 Celery), executing all tasks in the web server process. Some tasks can however
344 372 take some time to run and it can be better to run such tasks asynchronously in
345 373 a separate process so the web server can focus on serving web requests.
346 374
347 375 For installation and configuration of Celery, see the `Celery documentation`_.
348 376 Note that Celery requires a message broker service like RabbitMQ_ (recommended)
349 377 or Redis_.
350 378
351 379 The use of Celery is configured in the Kallithea ini configuration file.
352 380 To enable it, simply set::
353 381
354 382 use_celery = true
355 383
356 384 and add or change the ``celery.*`` configuration variables.
357 385
358 386 Configuration settings are prefixed with 'celery.', so for example setting
359 387 `broker_url` in Celery means setting `celery.broker_url` in the configuration
360 388 file.
361 389
362 390 To start the Celery process, run::
363 391
364 392 kallithea-cli celery-run -c my.ini
365 393
366 394 Extra options to the Celery worker can be passed after ``--`` - see ``-- -h``
367 395 for more info.
368 396
369 397 .. note::
370 398 Make sure you run this command from the same virtualenv, and with the same
371 399 user that Kallithea runs.
372 400
373 401
374 402 HTTPS support
375 403 -------------
376 404
377 405 Kallithea will by default generate URLs based on the WSGI environment.
378 406
379 407 Alternatively, you can use some special configuration settings to control
380 408 directly which scheme/protocol Kallithea will use when generating URLs:
381 409
382 410 - With ``https_fixup = true``, the scheme will be taken from the
383 411 ``X-Url-Scheme``, ``X-Forwarded-Scheme`` or ``X-Forwarded-Proto`` HTTP header
384 412 (default ``http``).
385 413 - With ``force_https = true`` the default will be ``https``.
386 414 - With ``use_htsts = true``, Kallithea will set ``Strict-Transport-Security`` when using https.
387 415
388 416 .. _nginx_virtual_host:
389 417
390 418
391 419 Nginx virtual host example
392 420 --------------------------
393 421
394 422 Sample config for Nginx using proxy:
395 423
396 424 .. code-block:: nginx
397 425
398 426 upstream kallithea {
399 427 server 127.0.0.1:5000;
400 428 # add more instances for load balancing
401 429 #server 127.0.0.1:5001;
402 430 #server 127.0.0.1:5002;
403 431 }
404 432
405 433 ## gist alias
406 434 server {
407 435 listen 443;
408 436 server_name gist.example.com;
409 437 access_log /var/log/nginx/gist.access.log;
410 438 error_log /var/log/nginx/gist.error.log;
411 439
412 440 ssl on;
413 441 ssl_certificate gist.your.kallithea.server.crt;
414 442 ssl_certificate_key gist.your.kallithea.server.key;
415 443
416 444 ssl_session_timeout 5m;
417 445
418 446 ssl_protocols SSLv3 TLSv1;
419 447 ssl_ciphers DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:EDH-RSA-DES-CBC3-SHA:AES256-SHA:DES-CBC3-SHA:AES128-SHA:RC4-SHA:RC4-MD5;
420 448 ssl_prefer_server_ciphers on;
421 449
422 450 rewrite ^/(.+)$ https://kallithea.example.com/_admin/gists/$1;
423 451 rewrite (.*) https://kallithea.example.com/_admin/gists;
424 452 }
425 453
426 454 server {
427 455 listen 443;
428 456 server_name kallithea.example.com
429 457 access_log /var/log/nginx/kallithea.access.log;
430 458 error_log /var/log/nginx/kallithea.error.log;
431 459
432 460 ssl on;
433 461 ssl_certificate your.kallithea.server.crt;
434 462 ssl_certificate_key your.kallithea.server.key;
435 463
436 464 ssl_session_timeout 5m;
437 465
438 466 ssl_protocols SSLv3 TLSv1;
439 467 ssl_ciphers DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:EDH-RSA-DES-CBC3-SHA:AES256-SHA:DES-CBC3-SHA:AES128-SHA:RC4-SHA:RC4-MD5;
440 468 ssl_prefer_server_ciphers on;
441 469
442 470 ## uncomment root directive if you want to serve static files by nginx
443 471 ## requires static_files = false in .ini file
444 472 #root /srv/kallithea/kallithea/kallithea/public;
445 473 include /etc/nginx/proxy.conf;
446 474 location / {
447 475 try_files $uri @kallithea;
448 476 }
449 477
450 478 location @kallithea {
451 479 proxy_pass http://127.0.0.1:5000;
452 480 }
453 481
454 482 }
455 483
456 484 Here's the proxy.conf. It's tuned so it will not timeout on long
457 485 pushes or large pushes::
458 486
459 487 proxy_redirect off;
460 488 proxy_set_header Host $host;
461 489 ## needed for container auth
462 490 #proxy_set_header REMOTE_USER $remote_user;
463 491 #proxy_set_header X-Forwarded-User $remote_user;
464 492 proxy_set_header X-Url-Scheme $scheme;
465 493 proxy_set_header X-Host $http_host;
466 494 proxy_set_header X-Real-IP $remote_addr;
467 495 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
468 496 proxy_set_header Proxy-host $proxy_host;
469 497 proxy_buffering off;
470 498 proxy_connect_timeout 7200;
471 499 proxy_send_timeout 7200;
472 500 proxy_read_timeout 7200;
473 501 proxy_buffers 8 32k;
474 502 client_max_body_size 1024m;
475 503 client_body_buffer_size 128k;
476 504 large_client_header_buffers 8 64k;
477 505
478 506 .. _apache_virtual_host_reverse_proxy:
479 507
480 508
481 509 Apache virtual host reverse proxy example
482 510 -----------------------------------------
483 511
484 512 Here is a sample configuration file for Apache using proxy:
485 513
486 514 .. code-block:: apache
487 515
488 516 <VirtualHost *:80>
489 517 ServerName kallithea.example.com
490 518
491 519 <Proxy *>
492 520 # For Apache 2.4 and later:
493 521 Require all granted
494 522
495 523 # For Apache 2.2 and earlier, instead use:
496 524 # Order allow,deny
497 525 # Allow from all
498 526 </Proxy>
499 527
500 528 #important !
501 529 #Directive to properly generate url (clone url) for Kallithea
502 530 ProxyPreserveHost On
503 531
504 532 #kallithea instance
505 533 ProxyPass / http://127.0.0.1:5000/
506 534 ProxyPassReverse / http://127.0.0.1:5000/
507 535
508 536 #to enable https use line below
509 537 #SetEnvIf X-Url-Scheme https HTTPS=1
510 538 </VirtualHost>
511 539
512 540 Additional tutorial
513 541 http://pylonsbook.com/en/1.1/deployment.html#using-apache-to-proxy-requests-to-pylons
514 542
515 543 .. _apache_subdirectory:
516 544
517 545
518 546 Apache as subdirectory
519 547 ----------------------
520 548
521 549 Apache subdirectory part:
522 550
523 551 .. code-block:: apache
524 552
525 553 <Location /PREFIX >
526 554 ProxyPass http://127.0.0.1:5000/PREFIX
527 555 ProxyPassReverse http://127.0.0.1:5000/PREFIX
528 556 SetEnvIf X-Url-Scheme https HTTPS=1
529 557 </Location>
530 558
531 559 Besides the regular apache setup you will need to add the following line
532 560 into ``[app:main]`` section of your .ini file::
533 561
534 562 filter-with = proxy-prefix
535 563
536 564 Add the following at the end of the .ini file::
537 565
538 566 [filter:proxy-prefix]
539 567 use = egg:PasteDeploy#prefix
540 568 prefix = /PREFIX
541 569
542 570 then change ``PREFIX`` into your chosen prefix
543 571
544 572 .. _apache_mod_wsgi:
545 573
546 574
547 575 Apache with mod_wsgi
548 576 --------------------
549 577
550 578 Alternatively, Kallithea can be set up with Apache under mod_wsgi. For
551 579 that, you'll need to:
552 580
553 581 - Install mod_wsgi. If using a Debian-based distro, you can install
554 582 the package libapache2-mod-wsgi::
555 583
556 584 aptitude install libapache2-mod-wsgi
557 585
558 586 - Enable mod_wsgi::
559 587
560 588 a2enmod wsgi
561 589
562 590 - Add global Apache configuration to tell mod_wsgi that Python only will be
563 591 used in the WSGI processes and shouldn't be initialized in the Apache
564 592 processes::
565 593
566 594 WSGIRestrictEmbedded On
567 595
568 596 - Create a WSGI dispatch script, like the one below. Make sure you
569 597 check that the paths correctly point to where you installed Kallithea
570 598 and its Python Virtual Environment.
571 599
572 600 .. code-block:: python
573 601
574 602 import os
575 603 os.environ['PYTHON_EGG_CACHE'] = '/srv/kallithea/.egg-cache'
576 604
577 605 # sometimes it's needed to set the current dir
578 606 os.chdir('/srv/kallithea/')
579 607
580 608 import site
581 609 site.addsitedir("/srv/kallithea/venv/lib/python3.7/site-packages")
582 610
583 611 ini = '/srv/kallithea/my.ini'
584 612 from logging.config import fileConfig
585 613 fileConfig(ini, {'__file__': ini, 'here': '/srv/kallithea'})
586 614 from paste.deploy import loadapp
587 615 application = loadapp('config:' + ini)
588 616
589 617 Or using proper virtualenv activation:
590 618
591 619 .. code-block:: python
592 620
593 621 activate_this = '/srv/kallithea/venv/bin/activate_this.py'
594 622 execfile(activate_this, dict(__file__=activate_this))
595 623
596 624 import os
597 625 os.environ['HOME'] = '/srv/kallithea'
598 626
599 627 ini = '/srv/kallithea/kallithea.ini'
600 628 from logging.config import fileConfig
601 629 fileConfig(ini, {'__file__': ini, 'here': '/srv/kallithea'})
602 630 from paste.deploy import loadapp
603 631 application = loadapp('config:' + ini)
604 632
605 633 - Add the necessary ``WSGI*`` directives to the Apache Virtual Host configuration
606 634 file, like in the example below. Notice that the WSGI dispatch script created
607 635 above is referred to with the ``WSGIScriptAlias`` directive.
608 636 The default locale settings Apache provides for web services are often not
609 637 adequate, with `C` as the default language and `ASCII` as the encoding.
610 638 Instead, use the ``lang`` parameter of ``WSGIDaemonProcess`` to specify a
611 639 suitable locale. See also the :ref:`overview` section and the
612 640 `WSGIDaemonProcess documentation`_.
613 641
614 642 Apache will by default run as a special Apache user, on Linux systems
615 643 usually ``www-data`` or ``apache``. If you need to have the repositories
616 644 directory owned by a different user, use the user and group options to
617 645 WSGIDaemonProcess to set the name of the user and group.
618 646
619 647 Once again, check that all paths are correctly specified.
620 648
621 649 .. code-block:: apache
622 650
623 651 WSGIDaemonProcess kallithea processes=5 threads=1 maximum-requests=100 \
624 652 python-home=/srv/kallithea/venv lang=C.UTF-8
625 653 WSGIProcessGroup kallithea
626 654 WSGIScriptAlias / /srv/kallithea/dispatch.wsgi
627 655 WSGIPassAuthorization On
628 656
629 657 Or if using a dispatcher WSGI script with proper virtualenv activation:
630 658
631 659 .. code-block:: apache
632 660
633 661 WSGIDaemonProcess kallithea processes=5 threads=1 maximum-requests=100 lang=en_US.utf8
634 662 WSGIProcessGroup kallithea
635 663 WSGIScriptAlias / /srv/kallithea/dispatch.wsgi
636 664 WSGIPassAuthorization On
637 665
638 666
639 667 Other configuration files
640 668 -------------------------
641 669
642 670 A number of `example init.d scripts`__ can be found in
643 671 the ``init.d`` directory of the Kallithea source.
644 672
645 673 .. __: https://kallithea-scm.org/repos/kallithea/files/tip/init.d/ .
646 674
647 675
648 676 .. _python: http://www.python.org/
649 677 .. _Python regular expression documentation: https://docs.python.org/2/library/re.html
650 678 .. _Mercurial: https://www.mercurial-scm.org/
651 679 .. _Celery: http://celeryproject.org/
652 680 .. _Celery documentation: http://docs.celeryproject.org/en/latest/getting-started/index.html
653 681 .. _RabbitMQ: http://www.rabbitmq.com/
654 682 .. _Redis: http://redis.io/
655 683 .. _mercurial-server: http://www.lshift.net/mercurial-server.html
656 684 .. _PublishingRepositories: https://www.mercurial-scm.org/wiki/PublishingRepositories
657 685 .. _WSGIDaemonProcess documentation: https://modwsgi.readthedocs.io/en/develop/configuration-directives/WSGIDaemonProcess.html
@@ -1,618 +1,618 b''
1 1 ## -*- coding: utf-8 -*-
2 2 <%text>##</%text>#################################################################################
3 3 <%text>##</%text>#################################################################################
4 4 <%text>##</%text> Kallithea config file generated with kallithea-cli ${'%-27s' % version }##
5 5 <%text>##</%text> ##
6 6 <%text>##</%text> The %(here)s variable will generally be replaced with the parent directory of ##
7 7 <%text>##</%text> this file. Other use of % must be escaped as %% . ##
8 8 <%text>##</%text>#################################################################################
9 9 <%text>##</%text>#################################################################################
10 10
11 11 [DEFAULT]
12 12
13 13 <%text>##</%text>##############################################################################
14 14 <%text>##</%text> Email settings ##
15 15 <%text>##</%text> ##
16 16 <%text>##</%text> Refer to the documentation ("Email settings") for more details. ##
17 17 <%text>##</%text> ##
18 18 <%text>##</%text> It is recommended to use a valid sender address that passes access ##
19 19 <%text>##</%text> validation and spam filtering in mail servers. ##
20 20 <%text>##</%text>##############################################################################
21 21
22 22 <%text>##</%text> 'From' header for application emails. You can optionally add a name.
23 23 <%text>##</%text> Default:
24 24 #app_email_from = Kallithea
25 25 <%text>##</%text> Examples:
26 26 #app_email_from = Kallithea <kallithea-noreply@example.com>
27 27 #app_email_from = kallithea-noreply@example.com
28 28
29 29 <%text>##</%text> Subject prefix for application emails.
30 30 <%text>##</%text> A space between this prefix and the real subject is automatically added.
31 31 <%text>##</%text> Default:
32 32 #email_prefix =
33 33 <%text>##</%text> Example:
34 34 #email_prefix = [Kallithea]
35 35
36 36 <%text>##</%text> Recipients for error emails and fallback recipients of application mails.
37 37 <%text>##</%text> Multiple addresses can be specified, comma-separated.
38 38 <%text>##</%text> Only addresses are allowed, do not add any name part.
39 39 <%text>##</%text> Default:
40 40 #email_to =
41 41 <%text>##</%text> Examples:
42 42 #email_to = admin@example.com
43 43 #email_to = admin@example.com,another_admin@example.com
44 44 email_to =
45 45
46 46 <%text>##</%text> 'From' header for error emails. You can optionally add a name.
47 47 <%text>##</%text> Default: (none)
48 48 <%text>##</%text> Examples:
49 49 #error_email_from = Kallithea Errors <kallithea-noreply@example.com>
50 50 #error_email_from = kallithea_errors@example.com
51 51 error_email_from =
52 52
53 53 <%text>##</%text> SMTP server settings
54 54 <%text>##</%text> If specifying credentials, make sure to use secure connections.
55 55 <%text>##</%text> Default: Send unencrypted unauthenticated mails to the specified smtp_server.
56 56 <%text>##</%text> For "SSL", use smtp_use_ssl = true and smtp_port = 465.
57 57 <%text>##</%text> For "STARTTLS", use smtp_use_tls = true and smtp_port = 587.
58 58 smtp_server =
59 59 smtp_username =
60 60 smtp_password =
61 61 smtp_port =
62 62 smtp_use_ssl = false
63 63 smtp_use_tls = false
64 64
65 65 %if http_server != 'uwsgi':
66 66 <%text>##</%text> Entry point for 'gearbox serve'
67 67 [server:main]
68 68 host = ${host}
69 69 port = ${port}
70 70
71 71 %if http_server == 'gearbox':
72 72 <%text>##</%text> Gearbox serve uses the built-in development web server ##
73 73 use = egg:gearbox#wsgiref
74 74 <%text>##</%text> nr of worker threads to spawn
75 75 threadpool_workers = 1
76 76 <%text>##</%text> max request before thread respawn
77 77 threadpool_max_requests = 100
78 78 <%text>##</%text> option to use threads of process
79 79 use_threadpool = true
80 80
81 81 %elif http_server == 'gevent':
82 82 <%text>##</%text> Gearbox serve uses the gevent web server ##
83 83 use = egg:gearbox#gevent
84 84
85 85 %elif http_server == 'waitress':
86 86 <%text>##</%text> Gearbox serve uses the Waitress web server ##
87 87 use = egg:waitress#main
88 88 <%text>##</%text> avoid multi threading
89 89 threads = 1
90 90 <%text>##</%text> allow push of repos bigger than the default of 1 GB
91 91 max_request_body_size = 107374182400
92 92 <%text>##</%text> use poll instead of select, fixes fd limits, may not work on old
93 93 <%text>##</%text> windows systems.
94 94 #asyncore_use_poll = True
95 95
96 96 %elif http_server == 'gunicorn':
97 97 <%text>##</%text> Gearbox serve uses the Gunicorn web server ##
98 98 use = egg:gunicorn#main
99 99 <%text>##</%text> number of process workers. You must set `instance_id = *` when this option
100 100 <%text>##</%text> is set to more than one worker
101 101 workers = 4
102 102 <%text>##</%text> process name
103 103 proc_name = kallithea
104 104 <%text>##</%text> type of worker class, one of sync, eventlet, gevent, tornado
105 105 <%text>##</%text> recommended for bigger setup is using of of other than sync one
106 106 worker_class = sync
107 107 max_requests = 1000
108 108 <%text>##</%text> amount of time a worker can handle request before it gets killed and
109 109 <%text>##</%text> restarted
110 110 timeout = 3600
111 111
112 112 %endif
113 113 %else:
114 114 <%text>##</%text> UWSGI ##
115 115 [uwsgi]
116 116 <%text>##</%text> Note: this section is parsed by the uWSGI .ini parser when run as:
117 117 <%text>##</%text> uwsgi --venv /srv/kallithea/venv --ini-paste-logged my.ini
118 118 <%text>##</%text> Note: in uWSGI 2.0.18 or older, pastescript needs to be installed to
119 119 <%text>##</%text> get correct application logging. In later versions this is not necessary.
120 120 <%text>##</%text> pip install pastescript
121 121
122 122 <%text>##</%text> HTTP Basics:
123 123 http-socket = ${host}:${port}
124 124 buffer-size = 65535 ; Mercurial will use huge GET headers for discovery
125 125
126 126 <%text>##</%text> Scaling:
127 127 master = true ; Use separate master and worker processes
128 128 auto-procname = true ; Name worker processes accordingly
129 129 lazy = true ; App *must* be loaded in workers - db connections can't be shared
130 130 workers = 4 ; On demand scaling up to this many worker processes
131 131 cheaper = 1 ; Initial and on demand scaling down to this many worker processes
132 132 max-requests = 1000 ; Graceful reload of worker processes to avoid leaks
133 133
134 134 <%text>##</%text> Tweak defaults:
135 135 strict = true ; Fail on unknown config directives
136 136 enable-threads = true ; Enable Python threads (not threaded workers)
137 137 vacuum = true ; Delete sockets during shutdown
138 138 single-interpreter = true
139 139 die-on-term = true ; Shutdown when receiving SIGTERM (default is respawn)
140 140 need-app = true ; Exit early if no app can be loaded.
141 141 reload-on-exception = true ; Don't assume that the application worker can process more requests after a severe error
142 142
143 143 %endif
144 144 <%text>##</%text> middleware for hosting the WSGI application under a URL prefix
145 145 #[filter:proxy-prefix]
146 146 #use = egg:PasteDeploy#prefix
147 147 #prefix = /<your-prefix>
148 148
149 149 [app:main]
150 150 use = egg:kallithea
151 151 <%text>##</%text> enable proxy prefix middleware
152 152 #filter-with = proxy-prefix
153 153
154 154 full_stack = true
155 155 static_files = true
156 156
157 157 <%text>##</%text> Internationalization (see setup documentation for details)
158 158 <%text>##</%text> By default, the languages requested by the browser are used if available, with English as default.
159 159 <%text>##</%text> Set i18n.enabled=false to disable automatic language choice.
160 160 #i18n.enabled = true
161 161 <%text>##</%text> To Force a language, set i18n.enabled=false and specify the language in i18n.lang.
162 162 <%text>##</%text> Valid values are the names of subdirectories in kallithea/i18n with a LC_MESSAGES/kallithea.mo
163 163 #i18n.lang = en
164 164
165 165 cache_dir = %(here)s/data
166 166 index_dir = %(here)s/data/index
167 167
168 168 <%text>##</%text> uncomment and set this path to use archive download cache
169 169 archive_cache_dir = %(here)s/tarballcache
170 170
171 171 <%text>##</%text> change this to unique ID for security
172 172 app_instance_uuid = ${uuid()}
173 173
174 174 <%text>##</%text> cut off limit for large diffs (size in bytes)
175 175 cut_off_limit = 256000
176 176
177 177 <%text>##</%text> force https in Kallithea, fixes https redirects, assumes it's always https
178 178 force_https = false
179 179
180 180 <%text>##</%text> use Strict-Transport-Security headers
181 181 use_htsts = false
182 182
183 183 <%text>##</%text> number of commits stats will parse on each iteration
184 184 commit_parse_limit = 25
185 185
186 186 <%text>##</%text> Path to Python executable to be used for git hooks.
187 187 <%text>##</%text> This value will be written inside the git hook scripts as the text
188 188 <%text>##</%text> after '#!' (shebang). When empty or not defined, the value of
189 189 <%text>##</%text> 'sys.executable' at the time of installation of the git hooks is
190 190 <%text>##</%text> used, which is correct in many cases but for example not when using uwsgi.
191 191 <%text>##</%text> If you change this setting, you should reinstall the Git hooks via
192 192 <%text>##</%text> Admin > Settings > Remap and Rescan.
193 193 #git_hook_interpreter = /srv/kallithea/venv/bin/python3
194 194 %if git_hook_interpreter:
195 195 git_hook_interpreter = ${git_hook_interpreter}
196 196 %endif
197 197
198 198 <%text>##</%text> path to git executable
199 199 git_path = git
200 200
201 201 <%text>##</%text> git rev filter option, --all is the default filter, if you need to
202 202 <%text>##</%text> hide all refs in changelog switch this to --branches --tags
203 203 #git_rev_filter = --branches --tags
204 204
205 205 <%text>##</%text> RSS feed options
206 206 rss_cut_off_limit = 256000
207 207 rss_items_per_page = 10
208 208 rss_include_diff = false
209 209
210 210 <%text>##</%text> options for showing and identifying changesets
211 211 show_sha_length = 12
212 212 show_revision_number = false
213 213
214 214 <%text>##</%text> Canonical URL to use when creating full URLs in UI and texts.
215 215 <%text>##</%text> Useful when the site is available under different names or protocols.
216 216 <%text>##</%text> Defaults to what is provided in the WSGI environment.
217 217 #canonical_url = https://kallithea.example.com/repos
218 218
219 219 <%text>##</%text> gist URL alias, used to create nicer urls for gist. This should be an
220 220 <%text>##</%text> url that does rewrites to _admin/gists/<gistid>.
221 221 <%text>##</%text> example: http://gist.example.com/{gistid}. Empty means use the internal
222 222 <%text>##</%text> Kallithea url, ie. http[s]://kallithea.example.com/_admin/gists/<gistid>
223 223 gist_alias_url =
224 224
225 225 <%text>##</%text> default encoding used to convert from and to unicode
226 226 <%text>##</%text> can be also a comma separated list of encoding in case of mixed encodings
227 227 default_encoding = utf-8
228 228
229 229 <%text>##</%text> Set Mercurial encoding, similar to setting HGENCODING before launching Kallithea
230 230 hgencoding = utf-8
231 231
232 232 <%text>##</%text> issue tracker for Kallithea (leave blank to disable, absent for default)
233 233 #bugtracker = https://bitbucket.org/conservancy/kallithea/issues
234 234
235 235 <%text>##</%text> issue tracking mapping for commit messages, comments, PR descriptions, ...
236 236 <%text>##</%text> Refer to the documentation ("Integration with issue trackers") for more details.
237 237
238 238 <%text>##</%text> regular expression to match issue references
239 239 <%text>##</%text> This pattern may/should contain parenthesized groups, that can
240 240 <%text>##</%text> be referred to in issue_server_link or issue_sub using Python backreferences
241 241 <%text>##</%text> (e.g. \1, \2, ...). You can also create named groups with '(?P<groupname>)'.
242 242 <%text>##</%text> To require mandatory whitespace before the issue pattern, use:
243 243 <%text>##</%text> (?:^|(?<=\s)) before the actual pattern, and for mandatory whitespace
244 244 <%text>##</%text> behind the issue pattern, use (?:$|(?=\s)) after the actual pattern.
245 245
246 246 issue_pat = #(\d+)
247 247
248 248 <%text>##</%text> server url to the issue
249 249 <%text>##</%text> This pattern may/should contain backreferences to parenthesized groups in issue_pat.
250 250 <%text>##</%text> A backreference can be \1, \2, ... or \g<groupname> if you specified a named group
251 251 <%text>##</%text> called 'groupname' in issue_pat.
252 252 <%text>##</%text> The special token {repo} is replaced with the full repository name
253 253 <%text>##</%text> including repository groups, while {repo_name} is replaced with just
254 254 <%text>##</%text> the name of the repository.
255 255
256 256 issue_server_link = https://issues.example.com/{repo}/issue/\1
257 257
258 258 <%text>##</%text> substitution pattern to use as the link text
259 259 <%text>##</%text> If issue_sub is empty, the text matched by issue_pat is retained verbatim
260 260 <%text>##</%text> for the link text. Otherwise, the link text is that of issue_sub, with any
261 261 <%text>##</%text> backreferences to groups in issue_pat replaced.
262 262
263 263 issue_sub =
264 264
265 265 <%text>##</%text> issue_pat, issue_server_link and issue_sub can have suffixes to specify
266 266 <%text>##</%text> multiple patterns, to other issues server, wiki or others
267 267 <%text>##</%text> below an example how to create a wiki pattern
268 268 <%text>##</%text> wiki-some-id -> https://wiki.example.com/some-id
269 269
270 270 #issue_pat_wiki = wiki-(\S+)
271 271 #issue_server_link_wiki = https://wiki.example.com/\1
272 272 #issue_sub_wiki = WIKI-\1
273 273
274 274 <%text>##</%text> alternative return HTTP header for failed authentication. Default HTTP
275 275 <%text>##</%text> response is 401 HTTPUnauthorized. Currently Mercurial clients have trouble with
276 276 <%text>##</%text> handling that. Set this variable to 403 to return HTTPForbidden
277 277 auth_ret_code =
278 278
279 279 <%text>##</%text> allows to change the repository location in settings page
280 280 allow_repo_location_change = True
281 281
282 282 <%text>##</%text> allows to setup custom hooks in settings page
283 283 allow_custom_hooks_settings = True
284 284
285 285 <%text>##</%text> extra extensions for indexing, space separated and without the leading '.'.
286 286 #index.extensions =
287 287 # gemfile
288 288 # lock
289 289
290 290 <%text>##</%text> extra filenames for indexing, space separated
291 291 #index.filenames =
292 292 # .dockerignore
293 293 # .editorconfig
294 294 # INSTALL
295 295 # CHANGELOG
296 296
297 297 <%text>##</%text>##################################
298 298 <%text>##</%text> SSH CONFIG ##
299 299 <%text>##</%text>##################################
300 300
301 301 <%text>##</%text> SSH is disabled by default, until an Administrator decides to enable it.
302 302 ssh_enabled = false
303 303
304 304 <%text>##</%text> File where users' SSH keys will be stored *if* ssh_enabled is true.
305 305 #ssh_authorized_keys = /home/kallithea/.ssh/authorized_keys
306 306 %if user_home_path:
307 307 ssh_authorized_keys = ${user_home_path}/.ssh/authorized_keys
308 308 %endif
309 309
310 310 <%text>##</%text> Path to be used in ssh_authorized_keys file to invoke kallithea-cli with ssh-serve.
311 311 #kallithea_cli_path = /srv/kallithea/venv/bin/kallithea-cli
312 312 %if kallithea_cli_path:
313 313 kallithea_cli_path = ${kallithea_cli_path}
314 314 %endif
315 315
316 316 <%text>##</%text> Locale to be used in the ssh-serve command.
317 317 <%text>##</%text> This is needed because an SSH client may try to use its own locale
318 318 <%text>##</%text> settings, which may not be available on the server.
319 319 <%text>##</%text> See `locale -a` for valid values on this system.
320 320 #ssh_locale = C.UTF-8
321 321 %if ssh_locale:
322 322 ssh_locale = ${ssh_locale}
323 323 %endif
324 324
325 325 <%text>##</%text>##################################
326 326 <%text>##</%text> CELERY CONFIG ##
327 327 <%text>##</%text>##################################
328 328
329 329 <%text>##</%text> Note: Celery doesn't support Windows.
330 330 use_celery = false
331 331
332 332 <%text>##</%text> Celery config settings from https://docs.celeryproject.org/en/4.4.0/userguide/configuration.html prefixed with 'celery.'.
333 333
334 334 <%text>##</%text> Example: use the message queue on the local virtual host 'kallitheavhost' as the RabbitMQ user 'kallithea':
335 335 celery.broker_url = amqp://kallithea:thepassword@localhost:5672/kallitheavhost
336 336
337 337 celery.result.backend = db+sqlite:///celery-results.db
338 338
339 339 #celery.amqp.task.result.expires = 18000
340 340
341 341 celery.worker_concurrency = 2
342 342 celery.worker_max_tasks_per_child = 1
343 343
344 344 <%text>##</%text> If true, tasks will never be sent to the queue, but executed locally instead.
345 345 celery.task_always_eager = false
346 346
347 347 <%text>##</%text>##################################
348 348 <%text>##</%text> BEAKER CACHE ##
349 349 <%text>##</%text>##################################
350 350
351 351 beaker.cache.data_dir = %(here)s/data/cache/data
352 352 beaker.cache.lock_dir = %(here)s/data/cache/lock
353 353
354 354 beaker.cache.regions = long_term,long_term_file
355 355
356 356 beaker.cache.long_term.type = memory
357 357 beaker.cache.long_term.expire = 36000
358 358 beaker.cache.long_term.key_length = 256
359 359
360 360 beaker.cache.long_term_file.type = file
361 361 beaker.cache.long_term_file.expire = 604800
362 362 beaker.cache.long_term_file.key_length = 256
363 363
364 364 <%text>##</%text>##################################
365 365 <%text>##</%text> BEAKER SESSION ##
366 366 <%text>##</%text>##################################
367 367
368 368 <%text>##</%text> Name of session cookie. Should be unique for a given host and path, even when running
369 369 <%text>##</%text> on different ports. Otherwise, cookie sessions will be shared and messed up.
370 370 session.key = kallithea
371 371 <%text>##</%text> Sessions should always only be accessible by the browser, not directly by JavaScript.
372 372 session.httponly = true
373 373 <%text>##</%text> Session lifetime. 2592000 seconds is 30 days.
374 374 session.timeout = 2592000
375 375
376 376 <%text>##</%text> Server secret used with HMAC to ensure integrity of cookies.
377 377 session.secret = ${uuid()}
378 378 <%text>##</%text> Further, encrypt the data with AES.
379 379 #session.encrypt_key = <key_for_encryption>
380 380 #session.validate_key = <validation_key>
381 381
382 382 <%text>##</%text> Type of storage used for the session, current types are
383 383 <%text>##</%text> dbm, file, memcached, database, and memory.
384 384
385 385 <%text>##</%text> File system storage of session data. (default)
386 386 #session.type = file
387 387
388 388 <%text>##</%text> Cookie only, store all session data inside the cookie. Requires secure secrets.
389 389 #session.type = cookie
390 390
391 391 <%text>##</%text> Database storage of session data.
392 392 #session.type = ext:database
393 393 #session.sa.url = postgresql://postgres:qwe@localhost/kallithea
394 394 #session.table_name = db_session
395 395
396 396 <%text>##</%text>##################################
397 397 <%text>##</%text> ERROR HANDLING ##
398 398 <%text>##</%text>##################################
399 399
400 400 <%text>##</%text> Show a nice error page for application HTTP errors and exceptions (default true)
401 401 #errorpage.enabled = true
402 402
403 403 <%text>##</%text> Enable Backlash client-side interactive debugger (default false)
404 404 <%text>##</%text> WARNING: *THIS MUST BE false IN PRODUCTION ENVIRONMENTS!!!*
405 405 <%text>##</%text> This debug mode will allow all visitors to execute malicious code.
406 406 #debug = false
407 407
408 408 <%text>##</%text> Enable Backlash server-side error reporting (unless debug mode handles it client-side) (default true)
409 409 #trace_errors.enable = true
410 410 <%text>##</%text> Errors will be reported by mail if trace_errors.error_email is set.
411 411
412 412 <%text>##</%text> Propagate email settings to ErrorReporter of TurboGears2
413 413 <%text>##</%text> You do not normally need to change these lines
414 414 get trace_errors.smtp_server = smtp_server
415 415 get trace_errors.smtp_port = smtp_port
416 416 get trace_errors.from_address = error_email_from
417 417 get trace_errors.error_email = email_to
418 418 get trace_errors.smtp_username = smtp_username
419 419 get trace_errors.smtp_password = smtp_password
420 420 get trace_errors.smtp_use_tls = smtp_use_tls
421 421
422 422 %if error_aggregation_service == 'sentry':
423 423 <%text>##</%text>##############
424 424 <%text>##</%text> [sentry] ##
425 425 <%text>##</%text>##############
426 426
427 427 <%text>##</%text> sentry is a alternative open source error aggregator
428 428 <%text>##</%text> you must install python packages `sentry` and `raven` to enable
429 429
430 430 sentry.dsn = YOUR_DNS
431 431 sentry.servers =
432 432 sentry.name =
433 433 sentry.key =
434 434 sentry.public_key =
435 435 sentry.secret_key =
436 436 sentry.project =
437 437 sentry.site =
438 438 sentry.include_paths =
439 439 sentry.exclude_paths =
440 440
441 441 %endif
442 442
443 443 <%text>##</%text>################################
444 444 <%text>##</%text> LOGVIEW CONFIG ##
445 445 <%text>##</%text>################################
446 446
447 447 logview.sqlalchemy = #faa
448 448 logview.pylons.templating = #bfb
449 449 logview.pylons.util = #eee
450 450
451 451 <%text>##</%text>#######################
452 452 <%text>##</%text> DB CONFIG ##
453 453 <%text>##</%text>#######################
454 454
455 455 %if database_engine == 'sqlite':
456 456 sqlalchemy.url = sqlite:///%(here)s/kallithea.db?timeout=60
457 457 %else:
458 458 #sqlalchemy.url = sqlite:///%(here)s/kallithea.db?timeout=60
459 459 %endif
460 460 %if database_engine == 'postgres':
461 sqlalchemy.url = postgresql://user:pass@localhost/kallithea
461 sqlalchemy.url = postgresql://kallithea:password@localhost/kallithea
462 462 %else:
463 #sqlalchemy.url = postgresql://user:pass@localhost/kallithea
463 #sqlalchemy.url = postgresql://kallithea:password@localhost/kallithea
464 464 %endif
465 465 %if database_engine == 'mysql':
466 sqlalchemy.url = mysql://user:pass@localhost/kallithea?charset=utf8
466 sqlalchemy.url = mysql://kallithea:password@localhost/kallithea?charset=utf8
467 467 %else:
468 #sqlalchemy.url = mysql://user:pass@localhost/kallithea?charset=utf8
468 #sqlalchemy.url = mysql://kallithea:password@localhost/kallithea?charset=utf8
469 469 %endif
470 470 <%text>##</%text> Note: the mysql:// prefix should also be used for MariaDB
471 471
472 472 sqlalchemy.pool_recycle = 3600
473 473
474 474 <%text>##</%text>##############################
475 475 <%text>##</%text> ALEMBIC CONFIGURATION ##
476 476 <%text>##</%text>##############################
477 477
478 478 [alembic]
479 479 script_location = kallithea:alembic
480 480
481 481 <%text>##</%text>##############################
482 482 <%text>##</%text> LOGGING CONFIGURATION ##
483 483 <%text>##</%text>##############################
484 484
485 485 [loggers]
486 486 keys = root, routes, kallithea, sqlalchemy, tg, gearbox, beaker, templates, whoosh_indexer, werkzeug, backlash
487 487
488 488 [handlers]
489 489 keys = console, console_color, console_color_sql, null
490 490
491 491 [formatters]
492 492 keys = generic, color_formatter, color_formatter_sql
493 493
494 494 <%text>##</%text>###########
495 495 <%text>##</%text> LOGGERS ##
496 496 <%text>##</%text>###########
497 497
498 498 [logger_root]
499 499 level = NOTSET
500 500 handlers = console
501 501 <%text>##</%text> For coloring based on log level:
502 502 #handlers = console_color
503 503
504 504 [logger_routes]
505 505 level = WARN
506 506 handlers =
507 507 qualname = routes.middleware
508 508 <%text>##</%text> "level = DEBUG" logs the route matched and routing variables.
509 509
510 510 [logger_beaker]
511 511 level = WARN
512 512 handlers =
513 513 qualname = beaker.container
514 514
515 515 [logger_templates]
516 516 level = WARN
517 517 handlers =
518 518 qualname = pylons.templating
519 519
520 520 [logger_kallithea]
521 521 level = WARN
522 522 handlers =
523 523 qualname = kallithea
524 524
525 525 [logger_tg]
526 526 level = WARN
527 527 handlers =
528 528 qualname = tg
529 529
530 530 [logger_gearbox]
531 531 level = WARN
532 532 handlers =
533 533 qualname = gearbox
534 534
535 535 [logger_sqlalchemy]
536 536 level = WARN
537 537 handlers =
538 538 qualname = sqlalchemy.engine
539 539 <%text>##</%text> For coloring based on log level and pretty printing of SQL:
540 540 #level = INFO
541 541 #handlers = console_color_sql
542 542 #propagate = 0
543 543
544 544 [logger_whoosh_indexer]
545 545 level = WARN
546 546 handlers =
547 547 qualname = whoosh_indexer
548 548
549 549 [logger_werkzeug]
550 550 level = WARN
551 551 handlers =
552 552 qualname = werkzeug
553 553
554 554 [logger_backlash]
555 555 level = WARN
556 556 handlers =
557 557 qualname = backlash
558 558
559 559 <%text>##</%text>############
560 560 <%text>##</%text> HANDLERS ##
561 561 <%text>##</%text>############
562 562
563 563 [handler_console]
564 564 class = StreamHandler
565 565 args = (sys.stderr,)
566 566 formatter = generic
567 567
568 568 [handler_console_color]
569 569 <%text>##</%text> ANSI color coding based on log level
570 570 class = StreamHandler
571 571 args = (sys.stderr,)
572 572 formatter = color_formatter
573 573
574 574 [handler_console_color_sql]
575 575 <%text>##</%text> ANSI color coding and pretty printing of SQL statements
576 576 class = StreamHandler
577 577 args = (sys.stderr,)
578 578 formatter = color_formatter_sql
579 579
580 580 [handler_null]
581 581 class = NullHandler
582 582 args = ()
583 583
584 584 <%text>##</%text>##############
585 585 <%text>##</%text> FORMATTERS ##
586 586 <%text>##</%text>##############
587 587
588 588 [formatter_generic]
589 589 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
590 590 datefmt = %Y-%m-%d %H:%M:%S
591 591
592 592 [formatter_color_formatter]
593 593 class = kallithea.lib.colored_formatter.ColorFormatter
594 594 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
595 595 datefmt = %Y-%m-%d %H:%M:%S
596 596
597 597 [formatter_color_formatter_sql]
598 598 class = kallithea.lib.colored_formatter.ColorFormatterSql
599 599 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
600 600 datefmt = %Y-%m-%d %H:%M:%S
601 601
602 602 <%text>##</%text>###############
603 603 <%text>##</%text> SSH LOGGING ##
604 604 <%text>##</%text>###############
605 605
606 606 <%text>##</%text> The default loggers use 'handler_console' that uses StreamHandler with
607 607 <%text>##</%text> destination 'sys.stderr'. In the context of the SSH server process, these log
608 608 <%text>##</%text> messages would be sent to the client, which is normally not what you want.
609 609 <%text>##</%text> By default, when running ssh-serve, just use NullHandler and disable logging
610 610 <%text>##</%text> completely. For other logging options, see:
611 611 <%text>##</%text> https://docs.python.org/2/library/logging.handlers.html
612 612
613 613 [ssh_serve:logger_root]
614 614 level = CRITICAL
615 615 handlers = null
616 616
617 617 <%text>##</%text> Note: If logging is configured with other handlers, they might need similar
618 618 <%text>##</%text> muting for ssh-serve too.
General Comments 0
You need to be logged in to leave comments. Login now