|
|
|
# How to install a SIB server
|
|
|
|
|
|
|
|
`SIB` application capabilities relies on:
|
|
|
|
|
|
|
|
* Servers with `LDP packages` able to serve the data
|
|
|
|
* Clients with `components` able to manipulate the data
|
|
|
|
|
|
|
|
## Requirements
|
|
|
|
|
|
|
|
The SIB server requires:
|
|
|
|
|
|
|
|
* python 3.6
|
|
|
|
* postgresql database (for production)
|
|
|
|
|
|
|
|
Note: This setup can be tested a docker container: `docker run --rm -p 127.0.0.1:8000:8000 -it python:3.6 bash`
|
|
|
|
|
|
|
|
## Initiate the server
|
|
|
|
|
|
|
|
From a fresh environment, get the last version of the `sib-manager`:
|
|
|
|
```
|
|
|
|
$ pip install --user -U sib-manager
|
|
|
|
```
|
|
|
|
|
|
|
|
Create a project structure from a development template:
|
|
|
|
```
|
|
|
|
$ sib startproject sib_server --production
|
|
|
|
$ cd sib_server
|
|
|
|
```
|
|
|
|
|
|
|
|
For a development server remove the `--production` flag.
|
|
|
|
|
|
|
|
## Configure your LDP packages
|
|
|
|
|
|
|
|
LDP packages represent capabilites the server could support. Each may have it's own configuration depending of what mission it fulfills. There is no limit of what a LDP package can do.
|
|
|
|
|
|
|
|
You can use [the ones maintained by the Startin'Blox team](https://git.happy-dev.fr/startinblox/djangoldp-packages) or you can [write your own](fixme) !
|
|
|
|
|
|
|
|
The configuration of the packages goes in `packages.yml` file in the `ldppackages` section. Those are the ones used by the [SIB App](https://git.happy-dev.fr/startinblox/applications/sib-app):
|
|
|
|
|
|
|
|
```
|
|
|
|
ldppackages:
|
|
|
|
djangoldp_project: djangoldp_project
|
|
|
|
djangoldp_uploader: djangoldp_uploader
|
|
|
|
djangoldp_circle: djangoldp_circle
|
|
|
|
djangoldp_notification: djangoldp_notification
|
|
|
|
djangoldp_account: djangoldp_account
|
|
|
|
djangoldp_skill: djangoldp_skill
|
|
|
|
djangoldp_joboffer: djangoldp_joboffer
|
|
|
|
djangoldp_conversation: djangoldp_conversation
|
|
|
|
djangoldp_profile: djangoldp_profile
|
|
|
|
djangoldp_invoice: djangoldp_invoice
|
|
|
|
oidc_provider: 'git+https://github.com/jblemee/django-oidc-provider.git@develop'
|
|
|
|
```
|
|
|
|
|
|
|
|
FIXME: make a note or link to the detail explanation of the format
|
|
|
|
|
|
|
|
## Configure your server parameters
|
|
|
|
|
|
|
|
The `packages.yml` files is also use to provide parameters to the server itself.
|
|
|
|
|
|
|
|
Configure the server parameters in the `packages.yml`:
|
|
|
|
```
|
|
|
|
server:
|
|
|
|
site_url: 'http://localhost:8000'
|
|
|
|
admin_email: admin@example.org
|
|
|
|
admin_name: admin
|
|
|
|
admin_pass: admin
|
|
|
|
```
|
|
|
|
|
|
|
|
This configuration works for a local development server but for a production instance you need to setup a postgresql database and configure dependent services:
|
|
|
|
```
|
|
|
|
server:
|
|
|
|
site_url: 'https://api.batman.happy-dev.fr'
|
|
|
|
allowed_hosts:
|
|
|
|
- api.batman.happy-dev.fr
|
|
|
|
db_host: postgresql-batman.happy-dev.fr
|
|
|
|
db_name: batman_db
|
|
|
|
db_user: batman
|
|
|
|
db_pass: changeit
|
|
|
|
smtp_host: smtp-batman.happy-dev.fr
|
|
|
|
smtp_user: batman
|
|
|
|
smtp_pass: changeit
|
|
|
|
admin_email: admin@example.org
|
|
|
|
admin_name: Admin
|
|
|
|
admin_pass: changeit
|
|
|
|
xmpp_url: 'https://jabber.happy-dev.fr'
|
|
|
|
jabber_host: 'happy-dev.fr'
|
|
|
|
```
|
|
|
|
|
|
|
|
## Launch the installation
|
|
|
|
|
|
|
|
Install/update the project:
|
|
|
|
```
|
|
|
|
$ sib install sib_server
|
|
|
|
```
|
|
|
|
|
|
|
|
## Launch the server
|
|
|
|
|
|
|
|
Run the server in development:
|
|
|
|
```
|
|
|
|
$ python manage.py runserver 0.0.0.0:8000
|
|
|
|
```
|
|
|
|
|
|
|
|
To *launch the server in production*:
|
|
|
|
|
|
|
|
* you have to install the static files with `python manage.py collectstatic`
|
|
|
|
* and you have to configure your python server to server the script: `sib_server/sib_server/wsgi.py` on the URL `api.batman.happy-dev.fr/`.
|
|
|
|
|
|
|
|
## Tips & tricks
|
|
|
|
|
|
|
|
#### Activate debug mode
|
|
|
|
|
|
|
|
To activate the debug mode (default in development) you can override manually the `DEBUG` variable in the `settings.py`
|
|
|
|
|
|
|
|
#### Install the server as a subfolder URL
|
|
|
|
|
|
|
|
This method isn't officially supported and requires to change values in the core configuration.
|
|
|
|
|
|
|
|
To setup the SIB server on a subfolder `https://batman.happy-dev.fr/api` you have to manually override the configuration in the `settings.py`:
|
|
|
|
```
|
|
|
|
BASE_URL = 'https://batman.happy-dev.fr'
|
|
|
|
SITE_URL = 'https://batman.happy-dev.fr/api'
|
|
|
|
STATIC_URL = '/api/static/'
|
|
|
|
```
|
|
|
|
|
|
|
|
and URLs in `urls.py`:
|
|
|
|
```
|
|
|
|
urlpatterns = [
|
|
|
|
url(r'^api/', include('djangoldp.urls')),
|
|
|
|
url(r'^api/admin/', admin.site.urls),
|
|
|
|
]
|
|
|
|
```
|
|
|
|
|
|
|
|
Note: Alwaysdata static config `/api/static/=/static/` |