-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split installation and user_guide from index.rst
- Loading branch information
Showing
3 changed files
with
190 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
.. _installation: | ||
|
||
============ | ||
Installation | ||
============ | ||
|
||
Architecture | ||
============ | ||
|
||
BEMServer is made of several software bricks. | ||
|
||
BEMServer Core | ||
-------------- | ||
|
||
BEMServer Core is the central part. It is responsible for the connection with | ||
the database and the authorization and authorization layer. | ||
|
||
It exposes objects that can be used by other blocks. | ||
|
||
It is meant to be imported and used by trusted code as it gives direct acces to | ||
the database. | ||
|
||
It is used internally by BEMServer API. | ||
|
||
BEMServer API | ||
------------- | ||
|
||
BEMServer API is a web REST API that exposes the core. It can be exposed over | ||
the Internet to be accessed by external modules. | ||
|
||
It exposes its own documentation in the OpenAPI format for module developers. | ||
|
||
BEMServer UI | ||
------------ | ||
|
||
BEMServer UI is the web interface to BEMServer. It communicates with the core | ||
via BEMServer API. | ||
|
||
This is the interface that is meant to be exposed to final users. | ||
|
||
It provides an interface for both administrative tasks (user management,...) | ||
and data analysis (data visualization). | ||
|
||
|
||
Install BEMServer | ||
================= | ||
|
||
To get BEMServer up and running, one needs to run both BEMServer API and | ||
BEMServer UI. | ||
|
||
All BEMServer blocks are written in Python and require Python 3.9+. | ||
|
||
The instructions that follow are tested on a Debian 11 (Bullseye) system. | ||
|
||
Prerequisites | ||
------------- | ||
|
||
BEMServer relies on PostgreSQL and the TimescaleDB extension. | ||
|
||
First, install PostgreSQL 13:: | ||
|
||
$ aptitude install postgresql | ||
|
||
TimescaleDB is not in the Debian repositories. Follow instructions in | ||
https://docs.timescale.com/latest/getting-started/setup | ||
|
||
.. note:: | ||
There is no need to install PostgreSQL from external repositories as | ||
suggested in TimescaleDB docs. | ||
|
||
Create a database and install TimescaleDB extension (should be done after each | ||
TimescaleDB update). | ||
|
||
Assuming the user has database creation permission::: | ||
|
||
$ createdb bemserver | ||
$ psql -U $USER -d bemserver -c "CREATE EXTENSION IF NOT EXISTS timescaledb" | ||
|
||
Install prerequisites for psycopg2 compilation (used by BEMServer Core):: | ||
|
||
$ aptitude install python3-dev libpq-dev | ||
|
||
BEMServer API | ||
------------- | ||
|
||
.. note:: | ||
It is advised to work in a dedicated virtual environment. | ||
|
||
Install bemserver_api:: | ||
|
||
$ pip install bemserver_core | ||
|
||
Database setup | ||
^^^^^^^^^^^^^^ | ||
|
||
Set DB URI in an environment variable (adapt line with actual values):: | ||
|
||
$ export SQLALCHEMY_DATABASE_URI="postgresql+psycopg2://user:password@localhost:5432/bemserver" | ||
|
||
Use `setup_db` command to initialize a clean database:: | ||
|
||
$ bemserver_setup_db | ||
|
||
Create an admin user:: | ||
|
||
$ bemserver_create_user --name chuck --email chuck@norris.com --admin | ||
|
||
API setup | ||
^^^^^^^^^ | ||
|
||
Create a configuration file (e.g. bemserver-api.cfg). Add API parameters: | ||
|
||
.. code-block:: | ||
SQLALCHEMY_DATABASE_URI="postgresql+psycopg2://user:password@localhost:5432/bemserver" | ||
Set an environment variable to point to that file:: | ||
|
||
$ export FLASK_SETTINGS_FILE="/path/to/bemserver-api.cfg" | ||
|
||
At this point, the web API can be launched from the command line:: | ||
|
||
$ flask run | ||
|
||
It can be accessed in a local browser at http://localhost:5000. | ||
|
||
.. warning:: | ||
While this is fine in development mode, production setups should use a real | ||
webserver such as Apache or Nginx. | ||
|
||
|
||
BEMServer UI | ||
------------ | ||
|
||
.. note:: | ||
It is advised to work in a dedicated virtual environment. | ||
|
||
Install bemserver_ui:: | ||
|
||
$ pip install bemserver_ui | ||
|
||
UI setup | ||
^^^^^^^^ | ||
|
||
Create a configuration file (e.g. bemserver-ui.cfg). Add UI parameters: | ||
|
||
.. code-block:: | ||
BEMSERVER_API_HOST = "localhost:5000" | ||
BEMSERVER_API_USE_SSL = False | ||
Set an environment variable to point to that file:: | ||
|
||
$ export FLASK_SETTINGS_FILE="/path/to/bemserver-ui.cfg" | ||
|
||
At this point, the web UI can be launched from the command line:: | ||
|
||
$ flask run -p 5001 | ||
|
||
.. note:: | ||
Flask uses port 5000 by default. Be sure to specify another port for either | ||
bemserver_api or bemserver_ui to avoid a conflict. | ||
|
||
.. warning:: | ||
While this is fine in development mode, production setups should use a real | ||
webserver such as Apache or Nginx. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
.. _user_guide: | ||
|
||
========== | ||
User guide | ||
========== | ||
|
||
Basic concepts | ||
============== | ||
|
||
The high-level entity for a project is the campaign. A campaign may span on | ||
several sites and buildings. It has beginning and end dates, although the end | ||
date may be left open to let the campaign last indefinitely. | ||
|
||
Users are associated to user groups. User groups provide access to campaigns. | ||
|
||
Timeseries and events data in a campaign may be split into separate scopes. | ||
Campaign scopes are used to organize data and to provide more fine-grained | ||
permissions. |