# HG changeset patch # User Thomas De Schampheleire # Date 1592423536 -7200 # Node ID a04d6926d694adc06e66a4555de3c79445793557 # Parent cc909683116c8733a2bdadd349027a53c582b2be# Parent 0bca9e828db247730518cbb4fd9225ea42592faf merge stable diff -r cc909683116c -r a04d6926d694 development.ini --- a/development.ini Thu Jun 11 21:07:24 2020 +0200 +++ b/development.ini Wed Jun 17 21:52:16 2020 +0200 @@ -362,6 +362,7 @@ sqlalchemy.url = sqlite:///%(here)s/kallithea.db?timeout=60 #sqlalchemy.url = postgresql://user:pass@localhost/kallithea #sqlalchemy.url = mysql://user:pass@localhost/kallithea?charset=utf8 +## Note: the mysql:// prefix should also be used for MariaDB sqlalchemy.pool_recycle = 3600 diff -r cc909683116c -r a04d6926d694 docs/overview.rst --- a/docs/overview.rst Thu Jun 11 21:07:24 2020 +0200 +++ b/docs/overview.rst Wed Jun 17 21:52:16 2020 +0200 @@ -22,8 +22,8 @@ 3. **Create low level configuration file.** Use ``kallithea-cli config-create`` to create a ``.ini`` file with database - connection info, mail server information, some web server configuration, - etc. + connection info, mail server information, configuration for the specified + web server, etc. 4. **Populate the database.** Use ``kallithea-cli db-create`` with the ``.ini`` file to create the @@ -141,9 +141,11 @@ but build the Kallithea package itself locally instead of downloading it.) .. note:: - Kallithea includes front-end code that needs to be processed first. - The tool npm_ is used to download external dependencies and orchestrate the - processing. The ``npm`` binary must thus be available. + Kallithea includes front-end code that needs to be processed to prepare + static files that can be served at run time and used on the client side. The + tool npm_ is used to download external dependencies and orchestrate the + processing. The ``npm`` binary must thus be available at install time but is + not used at run time. Web server @@ -166,19 +168,24 @@ Actual use in production might have different requirements and need extra work to make it manageable as a scalable system service. - Gearbox comes with its own built-in web server but Kallithea defaults to use - Waitress_. Gunicorn_ is also an option. These web servers have different - limited feature sets. + Gearbox comes with its own built-in web server for development but Kallithea + defaults to using Waitress_. Gunicorn_ and Gevent_ are also options. These + web servers have different limited feature sets. - The web server used by ``gearbox`` is configured in the ``.ini`` file passed - to it. The entry point for the WSGI application is configured - in ``setup.py`` as ``kallithea.config.application:make_app``. + The web server used by ``gearbox serve`` is configured in the ``.ini`` file. + Create it with ``config-create`` using for example ``http_server=waitress`` + to get a configuration starting point for your choice of web server. + + (Gearbox will do like ``paste`` and use the WSGI application entry point + ``kallithea.config.middleware:make_app`` as specified in ``setup.py``.) - `Apache httpd`_ can serve WSGI applications directly using mod_wsgi_ and a simple Python file with the necessary configuration. This is a good option if Apache is an option. -- uWSGI_ is also a full web server with built-in WSGI module. +- uWSGI_ is also a full web server with built-in WSGI module. Use + ``config-create`` with ``http_server=uwsgi`` to get a ``.ini`` file with + uWSGI configuration. - IIS_ can also server WSGI applications directly using isapi-wsgi_. @@ -197,9 +204,18 @@ also often used inside organizations with a limited amount of users and thus no continuous hammering from the internet. +.. note:: + Kallithea, the libraries it uses, and Python itself do in several places use + simple caching in memory. Caches and memory are not always released in a way + that is suitable for long-running processes. They might appear to be leaking + memory. The worker processes should thus regularly be restarted - for + example after 1000 requests and/or one hour. This can usually be done by the + web server or the tool used for running it as a system service. + .. _Python: http://www.python.org/ .. _Gunicorn: http://gunicorn.org/ +.. _Gevent: http://www.gevent.org/ .. _Waitress: http://waitress.readthedocs.org/en/latest/ .. _Gearbox: http://turbogears.readthedocs.io/en/latest/turbogears/gearbox.html .. _PyPI: https://pypi.python.org/pypi diff -r cc909683116c -r a04d6926d694 docs/setup.rst --- a/docs/setup.rst Thu Jun 11 21:07:24 2020 +0200 +++ b/docs/setup.rst Wed Jun 17 21:52:16 2020 +0200 @@ -24,7 +24,7 @@ use PostgreSQL or SQLite (default). If you choose a database other than the default, ensure you properly adjust the database URL in your ``my.ini`` configuration file to use this other database. Kallithea currently supports -PostgreSQL, SQLite and MySQL databases. Create the database by running +PostgreSQL, SQLite and MariaDB/MySQL databases. Create the database by running the following command:: kallithea-cli db-create -c my.ini @@ -54,7 +54,9 @@ but when trying to do a push it will fail with permission denied errors unless it has write access. -Finally, prepare the front-end by running:: +Finally, the front-end files must be prepared. This requires ``npm`` version 6 +or later, which needs ``node.js`` (version 12 or later). Prepare the front-end +by running:: kallithea-cli front-end-build diff -r cc909683116c -r a04d6926d694 docs/upgrade.rst --- a/docs/upgrade.rst Thu Jun 11 21:07:24 2020 +0200 +++ b/docs/upgrade.rst Wed Jun 17 21:52:16 2020 +0200 @@ -51,7 +51,7 @@ If using PostgreSQL, please consult the documentation for the ``pg_dump`` utility. -If using MySQL, please consult the documentation for the ``mysqldump`` +If using MariaDB/MySQL, please consult the documentation for the ``mysqldump`` utility. Look for ``sqlalchemy.url`` in your configuration file to determine diff -r cc909683116c -r a04d6926d694 docs/usage/performance.rst --- a/docs/usage/performance.rst Thu Jun 11 21:07:24 2020 +0200 +++ b/docs/usage/performance.rst Wed Jun 17 21:52:16 2020 +0200 @@ -40,7 +40,7 @@ locking issues with SQLite, it is not recommended to use it for larger deployments. -Switching to MySQL or PostgreSQL will result in an immediate performance +Switching to PostgreSQL or MariaDB/MySQL will result in an immediate performance increase. A tool like SQLAlchemyGrate_ can be used for migrating to another database platform. diff -r cc909683116c -r a04d6926d694 kallithea/lib/paster_commands/template.ini.mako --- a/kallithea/lib/paster_commands/template.ini.mako Thu Jun 11 21:07:24 2020 +0200 +++ b/kallithea/lib/paster_commands/template.ini.mako Wed Jun 17 21:52:16 2020 +0200 @@ -467,6 +467,7 @@ %else: #sqlalchemy.url = mysql://user:pass@localhost/kallithea?charset=utf8 %endif +<%text>## Note: the mysql:// prefix should also be used for MariaDB sqlalchemy.pool_recycle = 3600 diff -r cc909683116c -r a04d6926d694 kallithea/lib/vcs/backends/hg/changeset.py --- a/kallithea/lib/vcs/backends/hg/changeset.py Thu Jun 11 21:07:24 2020 +0200 +++ b/kallithea/lib/vcs/backends/hg/changeset.py Wed Jun 17 21:52:16 2020 +0200 @@ -329,7 +329,7 @@ #vals = url,rev,type loc = vals[0] cs = vals[1] - dirnodes.append(SubModuleNode(k, url=loc, changeset=cs, + dirnodes.append(SubModuleNode(safe_str(k), url=safe_str(loc), changeset=cs, alias=als)) nodes = dirnodes + filenodes for node in nodes: diff -r cc909683116c -r a04d6926d694 kallithea/lib/vcs/backends/hg/repository.py --- a/kallithea/lib/vcs/backends/hg/repository.py Thu Jun 11 21:07:24 2020 +0200 +++ b/kallithea/lib/vcs/backends/hg/repository.py Wed Jun 17 21:52:16 2020 +0200 @@ -230,7 +230,7 @@ return {} return OrderedDict(sorted( - ((safe_str(n), ascii_str(h)) for n, h in self._repo._bookmarks.items()), + ((safe_str(n), ascii_str(mercurial.node.hex(h))) for n, h in self._repo._bookmarks.items()), reverse=True, key=lambda x: x[0], # sort by name )) diff -r cc909683116c -r a04d6926d694 kallithea/lib/vcs/nodes.py --- a/kallithea/lib/vcs/nodes.py Thu Jun 11 21:07:24 2020 +0200 +++ b/kallithea/lib/vcs/nodes.py Wed Jun 17 21:52:16 2020 +0200 @@ -603,4 +603,4 @@ then only last part is returned. """ org = self.path.rstrip('/').rsplit('/', 1)[-1] - return '%s @ %s' % (org, self.changeset.short_id) + return '%s @ %s' % (org, safe_str(self.changeset.short_id))