doc/book/en/Z012-create-instance.en.txt
changeset 575 437aacfc0d89
child 1464 09afa1f808c4
equal deleted inserted replaced
574:a6308ea5fb15 575:437aacfc0d89
       
     1 .. -*- coding: utf-8 -*-
       
     2 
       
     3 Creation of your first instance
       
     4 ===============================
       
     5 
       
     6 What is an instance?
       
     7 --------------------
       
     8 
       
     9 A `CubicWeb` instance is a container that
       
    10 refers to cubes and configuration parameters for your web application.
       
    11 Each instance is stored as a directory in ``~/etc/cubicweb.d`` which enables 
       
    12 us to run your application.
       
    13 
       
    14 What is a cube?
       
    15 ---------------
       
    16 
       
    17 Cubes represent data and basic building bricks of your web applications :
       
    18 blogs, person, date, addressbook and a lot more.
       
    19 
       
    20 .. XXX They related to each other by a 'Schema' which is also the PostGres representation.
       
    21 
       
    22 Each cube defines entities, their views, their schemas and workflows
       
    23 in an independant directory located in ``/path/to/forest/cubicweb/cubes/``
       
    24 for a Mercurial installation or in ``/usr/share/cubicweb/cubes`` for
       
    25 a debian package installation. For example, the 'blog' cube defines the entities 
       
    26 blogs and blogentries.
       
    27 
       
    28 When an `CubicWeb` instance is created, you list the cubes that you want to use. 
       
    29 Using a cube means having the entities defined in your cube's schema
       
    30 available in your instance as well as their views and workflows.
       
    31 
       
    32 
       
    33 Creating a basic `CubicWeb` Instance 
       
    34 ------------------------------------
       
    35 
       
    36 We can create an instance to view our
       
    37 application in a web browser. ::
       
    38 
       
    39   cubicweb-ctl create blog myblog
       
    40 
       
    41 .. XXX or ::
       
    42   
       
    43 .. XXX cubicweb-ctl create forge myforge
       
    44 
       
    45 
       
    46 .. note::
       
    47    The commands used below are more detailled in the section dedicated to 
       
    48    :ref:`cubicweb-ctl`.
       
    49 
       
    50 A series of questions will be prompted to you, the default answer is usually
       
    51 sufficient. You can allways modify the parameters later by editing
       
    52 configuration files. When a user/psswd is requested to access the database
       
    53 please use the login you create at the time you configured the database
       
    54 (:ref:`ConfigurationPostgres`).
       
    55 
       
    56 It is important to distinguish here the user used to access the database and
       
    57 the user used to login to the cubicweb application. When a `CubicWeb` application
       
    58 starts, it uses the login/psswd for the database to get the schema and handle
       
    59 low level transaction. But, when ``cubicweb-ctl create`` asks for
       
    60 a manager login/psswd of `CubicWeb`, it refers to an application user
       
    61 to administrate your web application. 
       
    62 The configuration files are stored in *~/etc/cubicweb.d/myblog/*. 
       
    63 
       
    64 To launch the web application, you just type ::
       
    65 
       
    66   cubicweb-ctl start myblog
       
    67 
       
    68 You can see how it looks by
       
    69 visiting the URL `http://localhost:8080`. 
       
    70 To login, please use the cubicweb administrator login/psswd you 
       
    71 defined when you created the instance.
       
    72 
       
    73 To shutdown the instance ::
       
    74 
       
    75   cubicweb-ctl stop myinstance
       
    76 
       
    77 .. XXX something like `cubicweb-ctl live-server intra` would be nice
       
    78 
       
    79