90f74a88b3139246d55aed3cefd6f4dc38f3417f — Jochen Kupperschmidt 2 years ago 6e7a430
Document creation and initial population of database tables
1 files changed, 47 insertions(+), 0 deletions(-)

M docs/installation.rst
M docs/installation.rst => docs/installation.rst +47 -0
@@ 145,6 145,10 @@ Create a database user named ``byceps``:

You should be prompted to enter a password. Do that.

Create a copy of ``config/development_admin.py`` and, in the copy,
replace the example password in the value of
``SQLALCHEMY_DATABASE_URI`` with the one you just entered.

Create a schema, also named ``byceps``:

.. code-block:: sh

@@ 184,3 188,46 @@ Expected result (the actual UUID hopefully is different!):
    (1 row)

Database Tables

Scripts are provided to create and populate database tables. Change the
path to be able to call them:

.. code-block:: sh

   $ cd scripts

Create the necessary tables:

.. code-block:: sh

   $ PYTHONPATH=.. BYCEPS_CONFIG=../config/yourconfig.py ./create_database_tables.py
   Creating database tables ... done.

An initial set of authorization permissions and roles is provided as a
JSON file. Import it into the database:

.. code-block:: sh

   $ PYTHONPATH=.. BYCEPS_CONFIG=../config/yourconfig.py ./import_permissions_and_roles.py data/permissions_and_roles.json
   Importing 75 permissions ... done.
   Importing 29 roles ... done.

With the authorization data in place, create the initial user (which
will get all available roles assigned):

.. code-block:: sh

   $ PYTHONPATH=.. BYCEPS_CONFIG=../config/yourconfig.py ./create_initial_admin_user.py                                                  ~/projects/byceps/scripts
   Screen name: Flynn
   Email address: flynn@flynns-arcade.net
   Creating user "Flynn" ... done.
   Enabling user "Flynn" ... done.
   Assigning 29 roles to user "Flynn" ... done.

Those roles allow the user to log in to the admin backend and make all
administrative functionality available.