major: startinblox-feature-requests#181

This commit is contained in:
Jean-Baptiste Pasquier
2021-02-22 21:27:58 +01:00
parent 5cc3e9b7f4
commit e28af8a048
97 changed files with 2166 additions and 1625 deletions

574
README.md
View File

@ -4,7 +4,7 @@
<br>
</h1>
<h4 align="center">A magic tool that allows the Freelance Network to thrive in a decentralized way, built on top of <a href="https://startinblox.com/" target="_blank">Startin'blox</a>.</h4>
<h4 align="center">A magic orchestrator that allows the Freelance Network to thrive in a decentralized way, built on top of <a href="https://startinblox.com/" target="_blank">Startin'blox</a>.</h4>
<hr>
@ -22,24 +22,20 @@ These instructions will get you a copy of the project up and running on your loc
To install Hubl, you'll need:
* A [Hubl Server](https://git.startinblox.com/djangoldp-packages/server-manager/) (djangoldp>1)
* A [Prosody Server](https://prosody.im/) (with [appropriate modules](https://git.startinblox.com/infra/prosody-modules/))
* A [Hubl Server](https://git.startinblox.com/djangoldp-packages/server-manager/) (djangoldp>2)
* A [Prosody Server](https://prosody.im/) (with [appropriate modules](https://git.startinblox.com/infra/prosody-modules/)) (optional)
* A SMTP Server (optional)
* NodeJS on your machine
Before diving in you have to check your Hubl Server supports the following LDP packages:
* djangoldp_account
* djangoldp_community
* djangoldp_notification
* djangoldp_profile
* djangoldp_skill
* djangoldp_uploader
* oidc_provider: django-webidoidc-provider
* an oidc_provider (eg: [django-webidoidc-provider](https://git.startinblox.com/djangoldp-packages/django-webidoidc-provider))
Those packages are given with the last stable version tested.
Refer to the [documentation to install a Hubl Server](https://docs.startinblox.com/import_documentation/install-sib-server.html) with this configuration.
Refer to the [documentation to install a Hubl Server](https://docs.startinblox.com/import_documentation/install-djangoldp-server.html) with this configuration.
## Build the application
@ -71,6 +67,8 @@ Serve, watch files & rebuild on change with this command:
npm run watch
```
Notice that you may have to restart the watcher for the config.json and for locales files.
### Multiple config.json
You can have as many `config.*.json` as you need.
@ -87,114 +85,208 @@ Build with a custom config file:
CONFIG_PATH='config.customName.json' npm run build
```
### Theme checker
The [Hubl theme manager](https://cdn.startinblox.com/hubl/theme/) is very handy for customer to easily customize the main colors they want to use.
But developers should verify that their development use those colors to fit the customer wishes. The theme checker make this task easier :
just add `"themeChecker": true` to the config.json to display the color picker tool in the header bar. Changing the color will set them on the
whole app so that you can verify that your development take them into account correctly.
## Mandatory modules
By default, a Hubl includes only individual chat modules.
On Server: `djangoldp_account`, `djangoldp_profile`, `djangoldp_notification`, `djangoldp_skill`, `djangoldp_upload`, `oidc_provider` packages
On Server: `djangoldp_account`, `djangoldp_upload`, `django-webidoidc-provider` packages
On `config.json`:
```json
{
"xmppWebsocket": "wss://jabber.happy-dev.fr/xmpp-websocket",
"clientName": "My local Hubl",
"clientLogo": "/images/logo.webp",
"authority": "http://localhost:8000/",
"endpoints": {
"get": {
"communities": "http://server.url/open-communities/",
"skills": "http://server.url/skills/",
"users": "http://server.url/users/"
},
"post": {
"uploads": "http://server.url/upload/"
}
"client": {
"name": "Localhost",
"logo": "/images/logo.webp"
}
"components": []
}
```
Where:
* `clientName` is the name of your Hubl
* `clientLogo` is an URL to an image file
* `xmppWebsocket` is your [Prosody](https://prosody.im/) with [appropriate modules](https://git.startinblox.com/infra/prosody-modules/) configured on.
* `authority` is the OpenID Provider. Usually, if you use `djangoldp-account` it's the same as your djangoldp server.
* `endpoints.*.communities` is the API endpoints for Open Communities on your djangoldp server. (djangoldp-community)
* `endpoints.*.users` is the API endpoints for Users on your djangoldp server. (djangoldp-account)
* `endpoints.*.skills` is the API endpoints for Skills on your djangoldp server. (djangoldp-skill)
* `endpoints.*.uploads` is the API endpoints for Uploads on your djangoldp server. (djangoldp-upload)
### Communities
Communities are mandatory to have an Hubl. If you're upgrading an existion Hubl, you can assign all your local users to a community this way:
```bash
./manage.py create_community --name="My community"
```
Don't forget to set some users as admin from the Django Admin if you want to allow them to create new users from app.
If you set `allow_self_registration` on your community, it'll disable the auto-login feature of Hubl and allow your users to self register on your application.
* `client.name` is the name of your Hubl
* `client.logo` is an URL to an image file
* `components` is your modules declaration registry
### Optional personalisation
On `config.json`:
```json
"clientFavicon": "/images/favicon.webp",
"clientLogoHeight": "32px",
"clientCSS": "/path/to/custom.css",
"authorityName": "djangoldp-server-name"
{
"client": {
"favicon": "/images/favicon.webp",
"css": "/path/to/custom.css",
}
}
```
Where:
* `clientFavicon` is an URL to a distant favicon
* `clientLogoHeight` allow a quick fix to manage different height logos
* `clientCSS` is an URL to a distant CSS that'll be the last one loaded by the Hubl
* `authorityName` is a visual name of your OpenID Provider
* `client.avicon` is an URL to a distant favicon
* `client.css` is an URL to a distant CSS that'll be the last one loaded by the Hubl
### Allow to login to your application
Most of other modules will need to have an user logged in, if you want to use communities, then scroll back to the User Registration module, else you'll need to activate the Auto Login module:
```json
{
"type": "autoLogin",
"parameters": {
"authority": "http://server.url/"
}
}
```
Where:
* `authority` is the OpenID Provider. Usually, if you use `djangoldp_account` it's the same as your djangoldp server.
## Optional modules
### Adding modules
You can append any module listed bellow to your `components` entry on your `config.json`
Eg. to add the `notification` module:
```json
{
"components": [
{
"type": "notification",
"route": false
}
]
}
```
### About
About is a short page about the technology behind Hubl.
To activate about on Hubl, add this module declaration your `config.json`:
```json
{
"type": "about",
"route": false
}
```
### Administration
Administration is a minimal modulable admin module for all other ones.
To activate administration on Hubl, add this module declaration your `config.json`:
```json
{
"type": "admin",
"route": false
}
```
### Analytics
Hubl support Google or Matomo as analytics trackers. To use them, add to your `config.json`:
```json
"analytics": [
{
"type": "matomo", //Or "google"
"url": "https://my-personal.matomo.cloud/",
"id": "1"
"type": "analytics",
"parameters": {
"type": "matomo",
"url": "https://my-personal.matomo.cloud/",
"id": "1"
},
"route": false
}
]
```
### Circles
Circles are a public group chat. To activate them, you need:
Circles define group of users that can chat & share documents togethers.
On Server: `djangoldp_circle` packages
Community module is mandatory.
On `config.json`:
To activate them, you need:
On Server: `djangoldp_circle`, `djangoldp_communities`, `djangoldp_notifications` packages
Module declaration, on `config.json`:
```json
"endpoints": {
"get": {
"circle": "http://server.url/circles/"
},
"post": {
"circle": "http://server.url/circles/"
},
}
{
"type": "circles",
"endpoints": {
"get": "http://server.url/circles/",
"post": "http://server.url/circles/",
"owners": "http://server.url/users/",
"users": "http://server.url/users/",
"xmpp": "wss://xmpp-dev.startinblox.com/xmpp-websocket"
}
}
```
Where:
* `owners`: is your users container which contains valid owners
* `users`: is your users container
* `xmpp` is your [Prosody](https://prosody.im/) with [appropriate modules](https://git.startinblox.com/infra/prosody-modules/) configured on.
#### Circles extensions
You can extend circles with other components, the same way you would add them to your modules.
Actually it support: Events, Resources & Polls.
Eg.:
```json
{
"type": "circles",
"endpoints": {
"get": "http://server.url/circles/",
"post": "http://server.url/circles/",
"owners": "http://server.url/users/",
"users": "http://server.url/users/",
"xmpp": "wss://xmpp-dev.startinblox.com/xmpp-websocket"
},
"extensions": [
{
"type": "events",
"endpoints": {
"get": "http://server.url/events/",
"post": "http://server.url/events/",
"typeevents": "http://server.url/typeevents/",
"postTypeevents": "http://server.url/typeevents/"
}
}
]
}
```
### Communities
Communities are an optional layer to add on an Hubl. They add a SOLID representation of one to many group of users on your data server.
If you're upgrading an existion Hubl, you can assign all your local users to a community this way:
```bash
./manage.py create_community --name="My community"
```
Don't forget to set some users as admin of the community from the Django Admin if you want to allow them to create new users from app.
To activate community on Hubl, add this module declaration your `config.json`:
```json
{
"type": "communities",
"route": false
}
```
### Dashboard
@ -203,168 +295,274 @@ Dashboard includes card generation from HTML. To activate them, you need:
On Server: `djangoldp_dashboard` packages
On `config.json`:
Module declaration, on `config.json`:
```json
"endpoints": {
"get": {
"dashboard": "http://server.url/dashboard/"
{
"type": "dashboard",
"endpoints": {
"get": "http://server.url/dashboards/"
}
}
}
```
A [sample fixture](https://git.startinblox.com/djangoldp-packages/djangoldp-dashboard/blob/master/djangoldp_dashboard/fixtures/sample.json) can be loaded with `./manage.py loaddata sample`.
You can have multiple dashboard module, see the [related documentation](https://git.startinblox.com/components/solid-dashboard#having-multiple-dashboard).
### Events
The events module includes a listing of upcoming events and the capability to create new ones.
To activate it, you need:
On Server: `djangoldp_event` packages
Module declaration, on `config.json`:
```json
{
"type": "events",
"endpoints": {
"get": "http://server.url/events/",
"post": "http://server.url/events/",
"typeevents": "http://server.url/typeevents/",
"postTypeevents": "http://server.url/typeevents/"
}
}
```
You can get only future events by using:
```json
"get": "http://server.url/events/future/",
```
### Job Offers
Job Offers includes a job board with conversation. To activate them, you need:
Job Offers includes a job board with conversation. To activate them
Community module is mandatory.
You'll need:
On Server: `djangoldp_joboffer`, `djangoldp_skill`, `djangoldp_upload`, `djangoldp_conversation` packages
Module declaration, on `config.json`:
```json
{
"type": "jobBoard",
"endpoints": {
"get": "http://server.url/job-offers/",
"post": "http://server.url/job-offers/",
"skills": "http://server.url/skills/"
}
}
```
### Notifications
The notification module adds a bell with user's notification list and a badge on each menus with how much notifications are related to this resource. You'll need:
On Server: `djangoldp_notifications` packages
On `config.json`:
```json
"endpoints": {
"get": {
"joboffers": "http://server.url/job-offers/"
{
"type": "notification",
"route": false
}
```
### One-to-one chat
One-to-one chat allow your users to chat together on a private channel.
Community & User Directory modules are mandatory.
You'll need:
Module declaration, on `config.json`:
```json
{
"type": "chat",
"endpoints": {
"xmpp": "wss://xmpp-dev.startinblox.com/xmpp-websocket"
}
}
```
Where:
* `xmpp` is your [Prosody](https://prosody.im/) with [appropriate modules](https://git.startinblox.com/infra/prosody-modules/) configured on.
### Polls
The polls module allows user to create polls. To activate it, you need:
On Server: `djangoldp_polls`, `djangoldp_conversation` packages
On `config.json`:
```json
{
"type": "polls",
"endpoints": {
"get": "http://server.url/polls/",
"post": "http://server.url/polls/"
}
}
}
```
### Project
Project are a private group chat including Customer and Business Provider management. To activate them, you need:
Project are a private group chat including Customer and Business Provider management.
Community module is mandatory.
To activate them, you need:
On Server: `djangoldp_project` packages
On `config.json`:
Module declaration, on `config.json`:
```json
"endpoints": {
"get": {
"projects": "http://server.url/projects/"
},
"post": {
"projects": "http://server.url/projects/"
{
"type": "projects",
"endpoints": {
"get": "http://server.url/projects/",
"post": "http://server.url/projects/",
"captains": "http://server.url/users/",
"xmpp": "wss://xmpp-dev.startinblox.com/xmpp-websocket"
}
}
}
```
Where:
* `captains`: is your users container which contains valid captains
* `xmpp` is your [Prosody](https://prosody.im/) with [appropriate modules](https://git.startinblox.com/infra/prosody-modules/) configured on.
### Resources
The resources module includes a listing of indexed resources and the capability to index new ones.
To activate it, you need:
On Server: `djangoldp_resource`, `djangoldp_conversation` packages
Module declaration, on `config.json`:
```json
{
"type": "events",
"endpoints": {
"get": "http://server.url/resources/",
"post": "http://server.url/resources/",
"types": "http://server.url/keywords/",
"keywords": "http://server.url/types/",
"postTypes": "http://server.url/keywords/",
"postKeywords": "http://server.url/types/"
}
}
```
### User registration
The user registration module allows users to self-register.
Community module is mandatory.
If you set `allow_self_registration` on a community, it'll disable the auto-login feature of Hubl and allow your users to self register on your application.
To activate it, you need:
Module declaration, on `config.json`:
```json
{
"type": "registering",
"parameters": {
"authority": "http://server.url/",
"authorityName": "your-authority-indentifier"
},
"endpoints": {
"get": "http://server.url/open-communities/"
}
}
```
Where:
* `authority` is the OpenID Provider. Usually, if you use `djangoldp_account` it's the same as your djangoldp server.
* `authorityName` is a visual name of your OpenID Provider
### Theme checker
The [Hubl theme manager](https://cdn.startinblox.com/hubl/theme/) is very handy for customer to easily customize the main colors they want to use.
But developers should verify that their development use those colors to fit the customer wishes.
Module declaration, on `config.json`:
```json
{
"type": "themeChecker",
"route": false
}
```
Then you'll find the color picker tool in the header bar.
Changing the color will set them on the whole app so that you can verify that your development take them into account correctly.
### Users Directory
Directory includes a listing of each users of your app and editable individual profile. To activate them, you need:
On Server: `djangoldp_skill`, `djangoldp_upload` packages
On Server: `djangoldp_skill` packages
On `config.json`:
Community module is mandatory.
Module declaration, on `config.json`:
```json
"publicDirectory": true
```
## Optional community modules
### Events
The events module includes a listing of upcoming events and the capability to create new ones.
This module will also work inside the circles.
To activate it, you need:
On Server: `djangoldp_event`, `djangoldp_upload` packages
On `config.json`:
```json
"endpoints": {
"get": {
"events":"http://server.url/events/",
"typeevents":"http://server.url/typeevents/"
},
"post": {
"events":"http://server.url/events/",
"typeevents":"http://server.url/typeevents/"
}
}
```
You can get only future events by using
```json
"get": {
"events":"http://server.url/events/future/",
{
"type": "profileDirectory",
"endpoints": {
"get": "http://server.url/users/",
"skills": "http://server.url/skills/",
"uploads": "http://server.url/upload/"
}
}
```
### Resources
### Route generation
The resources module includes a listing of indexed resources and the capability to index new ones.
This module will also work inside the circles.
To activate it, you need:
Hubl will, by default, generate an unique route for every of your module. You can customize this route by setting a `route` attribute on your module declaration.
On Server: `djangoldp_resource`, `djangoldp_upload`, `djangoldp_conversation` packages
On `config.json`:
Eg. for the Users Directory:
```json
"endpoints": {
"get": {
"resources":"http://server.url/resources/",
"resourceskeywords":"http://server.url/keywords/",
"resourcestypes":"http://server.url/types/"
},
"post": {
"resources":"http://server.url/resources/",
"resourceskeywords":"http://server.url/keywords/",
"resourcestypes":"http://server.url/types/"
{
"type": "profileDirectory",
"endpoints": {
"get": "http://server.url/users/",
"skills": "http://server.url/skills/",
"uploads": "http://server.url/upload/"
},
"route": "directory"
}
}
```
### Polls
Will lead to `http://client.url/directory` as URL to reach the module instead of the default `http://client.url/profileDirectory`.
The polls module allows user to create polls related (or not) to circles. To activate it, you need:
If you provide no `route`, then Hubl will use the `type` as route view name. If two modules share the same `route`, they'll get suffixed with a random unique id.
On Server: `djangoldp_polls`, `djangoldp_upload`, `djangoldp_conversation` packages
Some module don't need any route to be active, set `route` to `false` so.
On `config.json`:
```json
"endpoints": {
"get": {
"polls":"http://server.url/polls/"
},
"post": {
"polls":"http://server.url/polls/"
}
}
```
## Use with docker
### Multi services
Run with a local binding on localhost:
```bash
docker-compose build
docker-compose up -d client server
```
Use in CI context:
```bash
docker-compose -f docker-compose.yml build
docker-compose -f docker-compose.yml up -d client server
docker-compose -f docker-compose.yml run --rm e2e
```
Build and push the server to registry:
```bash
docker build -f docker/djangoldp.docker --build-arg serve="http://localhost:8000" -t registry.startinblox.com/applications/hubl/server:0.1 .
docker push registry.startinblox.com/applications/hubl/server:0.1
```
Note: within a Kubernetes pod all services are bound to `localhost`.
Components can get the route of a module with `window.hubl.getRoute('componentName')`.
## Troubleshooting