comparison docs/setup.rst @ 6554:2c3d30095d5e

gearbox: replace paster with something TurboGears2-ish that still works with the Pylons stack This is a step towards moving away from the Pylons stack to TurboGears2, but still independent of it. Some notes from the porting - it could perhaps be the missing(?) documentation for migrating from paster to gearbox: Note: 'gearbox' without parameters will crash - specify '-h' to get started testing. Replace paster summary = 'yada yada' with the first line of the docstring of the Command class ... or override get_description. Note: All newlines in the docstring will be collapsed and mangle the long help text. Grouping of commands is not possible. Standard commands (for development) can't be customized under the same name or hidden. (Like for paster, the conceptual model also assumes that the sub-command naming is namespaced so commands from other packages won't conflict.) The usage help is fully automated from the declared options. For all deprecated Commands, replace paster hidden = True with gearbox deprecated = True Note: config_file, takes_config_file, min_args and max_args are not available / relevant. The gearbox parser is customized by overriding get_parser - there is nothing like paster update_parser. Gearbox is using argparse instead of optparse ... but argparse add_argument is mostly backwards compatible with optparse add_option. Instead of overriding command or run as in paster, override take_action in gearbox. The parsed arguments are passed to take_action, not available on the command instance. Paster BadCommand is not available and must be handled manually, terminating with sys.exit(1). There is no standard make-config command in gearbox. Paster appinstall has been replaced by the somewhat different setup_app module in gearbox. There is still no clean way to pass parameters to SetupAppCommand and it relies on websetup and other apparently unnecessary complexity. Instead, implement setup-db from scratch. Minor change by Thomas De Schampheleire: add gearbox logging configuration. Because we use logging.config.fileConfig(.inifile) during gearbox command execution, the logging settings need to be correct and contain a block for gearbox logging itself. Otherwise, errors in command processing are not even visible and the command exits silently.
author Mads Kiilerich <madski@unity3d.com>
date Tue, 25 Oct 2016 21:32:24 +0200
parents d0f6bd6190c8
children 213085032127
comparison
equal deleted inserted replaced
6553:e9ac5698281d 6554:2c3d30095d5e
9 -------------------- 9 --------------------
10 10
11 First, you will need to create a Kallithea configuration file. Run the 11 First, you will need to create a Kallithea configuration file. Run the
12 following command to do so:: 12 following command to do so::
13 13
14 paster make-config Kallithea my.ini 14 TODO make-config Kallithea my.ini
15 15
16 This will create the file ``my.ini`` in the current directory. This 16 This will create the file ``my.ini`` in the current directory. This
17 configuration file contains the various settings for Kallithea, e.g. 17 configuration file contains the various settings for Kallithea, e.g.
18 proxy port, email settings, usage of static files, cache, Celery 18 proxy port, email settings, usage of static files, cache, Celery
19 settings, and logging. 19 settings, and logging.
23 default, ensure you properly adjust the database URL in your ``my.ini`` 23 default, ensure you properly adjust the database URL in your ``my.ini``
24 configuration file to use this other database. Kallithea currently supports 24 configuration file to use this other database. Kallithea currently supports
25 PostgreSQL, SQLite and MySQL databases. Create the database by running 25 PostgreSQL, SQLite and MySQL databases. Create the database by running
26 the following command:: 26 the following command::
27 27
28 paster setup-db my.ini 28 gearbox setup-db -c my.ini
29 29
30 This will prompt you for a "root" path. This "root" path is the location where 30 This will prompt you for a "root" path. This "root" path is the location where
31 Kallithea will store all of its repositories on the current machine. After 31 Kallithea will store all of its repositories on the current machine. After
32 entering this "root" path ``setup-db`` will also prompt you for a username 32 entering this "root" path ``setup-db`` will also prompt you for a username
33 and password for the initial admin account which ``setup-db`` sets 33 and password for the initial admin account which ``setup-db`` sets
34 up for you. 34 up for you.
35 35
36 The ``setup-db`` values can also be given on the command line. 36 The ``setup-db`` values can also be given on the command line.
37 Example:: 37 Example::
38 38
39 paster setup-db my.ini --user=nn --password=secret --email=nn@example.com --repos=/srv/repos 39 gearbox setup-db -c my.ini --user=nn --password=secret --email=nn@example.com --repos=/srv/repos
40 40
41 The ``setup-db`` command will create all needed tables and an 41 The ``setup-db`` command will create all needed tables and an
42 admin account. When choosing a root path you can either use a new 42 admin account. When choosing a root path you can either use a new
43 empty location, or a location which already contains existing 43 empty location, or a location which already contains existing
44 repositories. If you choose a location which contains existing 44 repositories. If you choose a location which contains existing
52 but when trying to do a push it will fail with permission 52 but when trying to do a push it will fail with permission
53 denied errors unless it has write access. 53 denied errors unless it has write access.
54 54
55 You are now ready to use Kallithea. To run it simply execute:: 55 You are now ready to use Kallithea. To run it simply execute::
56 56
57 paster serve my.ini 57 gearbox serve -c my.ini
58 58
59 - This command runs the Kallithea server. The web app should be available at 59 - This command runs the Kallithea server. The web app should be available at
60 http://127.0.0.1:5000. The IP address and port is configurable via the 60 http://127.0.0.1:5000. The IP address and port is configurable via the
61 configuration file created in the previous step. 61 configuration file created in the previous step.
62 - Log in to Kallithea using the admin account created when running ``setup-db``. 62 - Log in to Kallithea using the admin account created when running ``setup-db``.
109 109
110 .. __: https://pythonhosted.org/Whoosh/ 110 .. __: https://pythonhosted.org/Whoosh/
111 111
112 For an incremental index build, run:: 112 For an incremental index build, run::
113 113
114 paster make-index my.ini 114 gearbox make-index -c my.ini
115 115
116 For a full index rebuild, run:: 116 For a full index rebuild, run::
117 117
118 paster make-index my.ini -f 118 gearbox make-index -c my.ini -f
119 119
120 The ``--repo-location`` option allows the location of the repositories to be overridden; 120 The ``--repo-location`` option allows the location of the repositories to be overridden;
121 usually, the location is retrieved from the Kallithea database. 121 usually, the location is retrieved from the Kallithea database.
122 122
123 The ``--index-only`` option can be used to limit the indexed repositories to a comma-separated list:: 123 The ``--index-only`` option can be used to limit the indexed repositories to a comma-separated list::
124 124
125 paster make-index my.ini --index-only=vcs,kallithea 125 gearbox make-index -c my.ini --index-only=vcs,kallithea
126 126
127 To keep your index up-to-date it is necessary to do periodic index builds; 127 To keep your index up-to-date it is necessary to do periodic index builds;
128 for this, it is recommended to use a crontab entry. Example:: 128 for this, it is recommended to use a crontab entry. Example::
129 129
130 0 3 * * * /path/to/virtualenv/bin/paster make-index /path/to/kallithea/my.ini 130 0 3 * * * /path/to/virtualenv/bin/gearbox make-index -c /path/to/kallithea/my.ini
131 131
132 When using incremental mode (the default), Whoosh will check the last 132 When using incremental mode (the default), Whoosh will check the last
133 modification date of each file and add it to be reindexed if a newer file is 133 modification date of each file and add it to be reindexed if a newer file is
134 available. The indexing daemon checks for any removed files and removes them 134 available. The indexing daemon checks for any removed files and removes them
135 from index. 135 from index.
590 Celery. So for example setting `BROKER_HOST` in Celery means setting 590 Celery. So for example setting `BROKER_HOST` in Celery means setting
591 `broker.host` in the configuration file. 591 `broker.host` in the configuration file.
592 592
593 To start the Celery process, run:: 593 To start the Celery process, run::
594 594
595 paster celeryd <configfile.ini> 595 gearbox celeryd -c <configfile.ini>
596
597 Extra options to the Celery worker can be passed after ``--`` - see ``-- -h``
598 for more info.
596 599
597 .. note:: 600 .. note::
598 Make sure you run this command from the same virtualenv, and with the same 601 Make sure you run this command from the same virtualenv, and with the same
599 user that Kallithea runs. 602 user that Kallithea runs.
600 603