doc/book/admin/cubicweb-ctl.rst
author Sylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 28 Jan 2016 18:17:30 +0100
changeset 11090 b4b854c25de5
parent 10491 c67bcee93248
child 11689 213f60272d49
permissions -rw-r--r--
[repository] set .eid on eschema when schema is loaded from the filesystem enforcing the contract that a repository's schema should have .eid attribute of entity schema set to the eid of the entity used to serialize them in the db. Before this cset, this was not true during tests or for some c-c commands where 'quick_start' is set (eg db-restore, i18ncube...). The change in server __init__ makes this assumption true during instance creation: the serializing code was actually setting eid on schema object, but a reference to a previously built schema was given instead of the one for the latest created repository. Closes #10450092
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
     1
.. -*- coding: utf-8 -*-
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
     2
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
     3
.. _cubicweb-ctl:
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
     4
100
e4d0fd06da7f [doc] Initial translation of cubicweb-tool section.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 93
diff changeset
     5
``cubicweb-ctl`` tool
e4d0fd06da7f [doc] Initial translation of cubicweb-tool section.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 93
diff changeset
     6
=====================
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
     7
2175
16d3c37c5d28 [doc] improvements
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2172
diff changeset
     8
`cubicweb-ctl` is the swiss knife to manage *CubicWeb* instances.
100
e4d0fd06da7f [doc] Initial translation of cubicweb-tool section.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 93
diff changeset
     9
The general syntax is ::
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    10
100
e4d0fd06da7f [doc] Initial translation of cubicweb-tool section.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 93
diff changeset
    11
  cubicweb-ctl <command> [options command] <arguments commands>
e4d0fd06da7f [doc] Initial translation of cubicweb-tool section.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 93
diff changeset
    12
e4d0fd06da7f [doc] Initial translation of cubicweb-tool section.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 93
diff changeset
    13
To view available commands ::
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    14
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    15
  cubicweb-ctl
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    16
  cubicweb-ctl --help
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    17
2175
16d3c37c5d28 [doc] improvements
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2172
diff changeset
    18
Please note that the commands available depends on the *CubicWeb* packages
100
e4d0fd06da7f [doc] Initial translation of cubicweb-tool section.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 93
diff changeset
    19
and cubes that have been installed.
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    20
100
e4d0fd06da7f [doc] Initial translation of cubicweb-tool section.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 93
diff changeset
    21
To view the help menu on specific command ::
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    22
100
e4d0fd06da7f [doc] Initial translation of cubicweb-tool section.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 93
diff changeset
    23
  cubicweb-ctl <command> --help
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    24
4752
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    25
Listing available cubes and instance
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    26
-------------------------------------
100
e4d0fd06da7f [doc] Initial translation of cubicweb-tool section.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 93
diff changeset
    27
4752
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    28
* ``list``, provides a list of the available configuration, cubes
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    29
  and instances.
2172
cf8f9180e63e delete-trailing-whitespace
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 1898
diff changeset
    30
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    31
4752
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    32
Creation of a new cube
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    33
-----------------------
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    34
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    35
Create your new cube cube ::
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    36
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    37
   cubicweb-ctl newcube
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    38
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    39
This will create a new cube in
9917
a98e60464c26 [book] stop talking about the hg `forest` extension
Julien Cristau <julien.cristau@logilab.fr>
parents: 8603
diff changeset
    40
``/path/to/grshell-cubicweb/cubes/<mycube>`` for a Mercurial
4752
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    41
installation, or in ``/usr/share/cubicweb/cubes`` for a debian
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    42
packages installation.
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    43
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    44
Create an instance
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    45
-------------------
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    46
8603
544ce5dd863c [doc] fix of personnal etc directory in book
Arthur Lutz <arthur.lutz@logilab.fr>
parents: 8032
diff changeset
    47
You must ensure `~/etc/cubicweb.d/` exists prior to this. On windows, the
4752
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    48
'~' part will probably expand to 'Documents and Settings/user'.
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    49
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    50
To create an instance from an existing cube, execute the following
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    51
command ::
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    52
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    53
   cubicweb-ctl create <cube_name> <instance_name>
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    54
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    55
This command will create the configuration files of an instance in
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    56
``~/etc/cubicweb.d/<instance_name>``.
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    57
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    58
The tool ``cubicweb-ctl`` executes the command ``db-create`` and
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    59
``db-init`` when you run ``create`` so that you can complete an
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    60
instance creation in a single command. But of course it is possible
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    61
to issue these separate commands separately, at a later stage.
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    62
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    63
Command to create/initialize an instance database
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    64
-------------------------------------------------
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    65
100
e4d0fd06da7f [doc] Initial translation of cubicweb-tool section.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 93
diff changeset
    66
* ``db-create``, creates the system database of an instance (tables and
e4d0fd06da7f [doc] Initial translation of cubicweb-tool section.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 93
diff changeset
    67
  extensions only)
e4d0fd06da7f [doc] Initial translation of cubicweb-tool section.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 93
diff changeset
    68
* ``db-init``, initializes the system database of an instance
e4d0fd06da7f [doc] Initial translation of cubicweb-tool section.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 93
diff changeset
    69
  (schema, groups, users, workflows...)
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    70
1440
4fc48f2a1748 [doc] Typos and minor changes.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 282
diff changeset
    71
Commands to control instances
4fc48f2a1748 [doc] Typos and minor changes.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 282
diff changeset
    72
-----------------------------
4752
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    73
100
e4d0fd06da7f [doc] Initial translation of cubicweb-tool section.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 93
diff changeset
    74
* ``start``, starts one or more or all instances
4752
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    75
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    76
of special interest::
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    77
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    78
  start -D
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    79
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    80
will start in debug mode (under windows, starting without -D will not
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    81
work; you need instead to setup your instance as a service).
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    82
100
e4d0fd06da7f [doc] Initial translation of cubicweb-tool section.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 93
diff changeset
    83
* ``stop``, stops one or more or all instances
e4d0fd06da7f [doc] Initial translation of cubicweb-tool section.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 93
diff changeset
    84
* ``restart``, restarts one or more or all instances
4752
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    85
* ``status``, returns the status of the instance(s)
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    86
100
e4d0fd06da7f [doc] Initial translation of cubicweb-tool section.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 93
diff changeset
    87
Commands to maintain instances
e4d0fd06da7f [doc] Initial translation of cubicweb-tool section.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 93
diff changeset
    88
------------------------------
4752
2c2a9c53aea3 [book/cwctl] reorganize a bit this page (very messy)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2476
diff changeset
    89
100
e4d0fd06da7f [doc] Initial translation of cubicweb-tool section.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 93
diff changeset
    90
* ``upgrade``, launches the existing instances migration when a new version
2175
16d3c37c5d28 [doc] improvements
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2172
diff changeset
    91
  of *CubicWeb* or the cubes installed is available
6744
db1e9e733a16 [doc/book] mention that the shell is a python shell
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 4936
diff changeset
    92
* ``shell``, opens a (Python based) migration shell for manual maintenance of the instance
100
e4d0fd06da7f [doc] Initial translation of cubicweb-tool section.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 93
diff changeset
    93
* ``db-dump``, creates a dump of the system database
e4d0fd06da7f [doc] Initial translation of cubicweb-tool section.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 93
diff changeset
    94
* ``db-restore``, restores a dump of the system database
e4d0fd06da7f [doc] Initial translation of cubicweb-tool section.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 93
diff changeset
    95
* ``db-check``, checks data integrity of an instance. If the automatic correction
e4d0fd06da7f [doc] Initial translation of cubicweb-tool section.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 93
diff changeset
    96
  is activated, it is recommanded to create a dump before this operation.
e4d0fd06da7f [doc] Initial translation of cubicweb-tool section.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 93
diff changeset
    97
* ``schema-sync``, synchronizes the persistent schema of an instance with
2476
1294a6bdf3bf application -> instance where it makes sense
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    98
  the instance schema. It is recommanded to create a dump before this operation.
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    99
100
e4d0fd06da7f [doc] Initial translation of cubicweb-tool section.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 93
diff changeset
   100
Commands to maintain i18n catalogs
e4d0fd06da7f [doc] Initial translation of cubicweb-tool section.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 93
diff changeset
   101
----------------------------------
2175
16d3c37c5d28 [doc] improvements
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2172
diff changeset
   102
* ``i18ncubicweb``, regenerates messages catalogs of the *CubicWeb* library
1898
39b37f90a8a4 [cw-ctl] rename i18n commands (see #342889)
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 1714
diff changeset
   103
* ``i18ncube``, regenerates the messages catalogs of a cube
2172
cf8f9180e63e delete-trailing-whitespace
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 1898
diff changeset
   104
* ``i18ninstance``, recompiles the messages catalogs of an instance.
100
e4d0fd06da7f [doc] Initial translation of cubicweb-tool section.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 93
diff changeset
   105
  This is automatically done while upgrading.
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   106
4936
a4b772a0d801 Fixed some of the documentation warnings when building the book with sphinx.
Adrien Chauve <adrien.chauve@logilab.fr>
parents: 4752
diff changeset
   107
See also chapter :ref:`internationalization`.
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   108
100
e4d0fd06da7f [doc] Initial translation of cubicweb-tool section.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 93
diff changeset
   109
Other commands
e4d0fd06da7f [doc] Initial translation of cubicweb-tool section.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 93
diff changeset
   110
--------------
e4d0fd06da7f [doc] Initial translation of cubicweb-tool section.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 93
diff changeset
   111
* ``delete``, deletes an instance (configuration files and database)