hubl/README.md

181 lines
4.3 KiB
Markdown
Raw Normal View History

2019-04-29 12:46:13 +00:00
# SiB App
2018-11-07 18:05:32 +00:00
2019-04-29 12:46:13 +00:00
SiB App is the magic tool that allows the Happy Dev network to thrive in a decentralized way.
2018-09-28 19:24:25 +00:00
2019-04-29 12:46:13 +00:00
## Getting Started
2018-11-14 12:50:38 +00:00
2019-04-29 12:46:13 +00:00
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
2018-11-14 12:50:38 +00:00
2019-04-29 12:46:13 +00:00
### Prerequisites
2018-11-14 12:50:38 +00:00
2019-04-29 12:46:13 +00:00
To install SiB App, you'll need to have:
2018-11-14 12:50:38 +00:00
2019-04-29 12:46:13 +00:00
- Python3 & Pip
- NodeJS & NPM
- A Prosody Server
- (Optional) A SMTP Server
2018-11-14 12:50:38 +00:00
2019-04-29 12:46:13 +00:00
### Installing
2018-11-14 12:50:38 +00:00
2019-04-29 12:46:13 +00:00
#### At first, you'll need to deploy a `sib-manager` server, then configure it.
2018-11-14 12:50:38 +00:00
2019-04-29 12:46:13 +00:00
#### `sib-manager` installation or update
2018-11-14 12:50:38 +00:00
2019-04-29 12:46:13 +00:00
```
$ pip3 install -U sib-manager
```
2018-11-14 12:50:38 +00:00
2019-04-29 12:46:13 +00:00
#### `sib-manager` deploy
2018-11-14 12:50:38 +00:00
2019-04-29 12:46:13 +00:00
```
2019-05-09 13:05:33 +00:00
$ sib startproject newserver -m djangoldp_project -m oidc_provider@django-oidc-provider -m djangoldp_circle -m djangoldp_joboffer -m djangoldp_profile -m djangoldp_skill -m djangoldp_account -m djangoldp_notification -m djangoldp_conversation
$ sib initproject newserver
2019-04-29 12:46:13 +00:00
```
2018-11-14 12:50:38 +00:00
2019-04-29 12:46:13 +00:00
We're using
- `djangoldp_project`,
- `django-oidc-provider`,
- `djangoldp_circle`,
- `djangoldp_joboffer`,
- `djangoldp_profile`,
- `djangoldp_skill`,
- `djangoldp_account`,
- `djangoldp_notification`,
- `djangoldp_conversation`
2018-11-14 12:50:38 +00:00
2019-04-29 12:46:13 +00:00
As dependencies, if you don't want them, just remove the `-m packagename`.
2018-11-14 12:50:38 +00:00
2019-04-29 12:46:13 +00:00
`sibserver` is the name of the folder that `sib-manager` will create, choose it wisely.
2018-11-14 12:50:38 +00:00
2019-05-09 13:05:33 +00:00
In addition to the `startproject` you can add :
- `--site-url "http://localhost:8000"`
- `--production` to use postgresql instead of sqlite
- `--db-host`, `--db-name`, `--db-user` and `--db-pass` are used to configure the database (mandatory with `--production`)
- `--smtp-host`, `--smtp-user` and `--smtp-pass` are used to configure the SMTP (optional)
2019-04-29 12:46:13 +00:00
#### `sibserver` configuration
2018-11-14 12:50:38 +00:00
2019-04-29 12:46:13 +00:00
You'll have to change some settings on the `sibserver` files.
2018-11-14 12:50:38 +00:00
2019-04-29 12:46:13 +00:00
- Add your server name to `ALLOWED_HOSTS`
- In `settings.py`, add your hostname on `ALLOWED_HOSTS`, eg:
```
ALLOWED_HOSTS = ['api.myserver.com', 'localhost']
```
2019-05-09 13:05:33 +00:00
- Around line `96-97` of `settings.py` set your `PROSODY_HTTP_URL`, `JABBER_DEFAULT_HOST`, eg:
2019-04-29 12:46:13 +00:00
```
PROSODY_HTTP_URL = 'https://jabber.happy-dev.fr'
JABBER_DEFAULT_HOST = 'happy-dev.fr'
```
2018-11-07 18:05:32 +00:00
2019-04-29 12:46:13 +00:00
#### `sib-manager` launching
2018-09-28 19:24:25 +00:00
2019-04-29 12:46:13 +00:00
On the first `sibserver` folder
2018-09-28 19:24:25 +00:00
2019-04-29 12:46:13 +00:00
```
2019-05-14 16:24:23 +00:00
$ ./manage.py runserver
2019-04-29 12:46:13 +00:00
```
2018-09-28 19:24:25 +00:00
2019-04-29 12:46:13 +00:00
#### Create a Client ID for Prosody & Client
2018-09-28 19:24:25 +00:00
2019-04-29 12:46:13 +00:00
- Go to `localhost:8000/admin/`
- Login with previously created account.
- If needed you can create another admin account with `./manage.py createsuperadmin`
- Add a `Clients` on `OpenID Connect Provider` section
- Name it as you wish
- `Client type`: `Public`
- `Response types`: `id_token token (Implicit Flow)`
- `Redirect URIs`:
```
http://localhost:3000
http://127.0.0.1:3000
http://0.0.0.0:3000
http://localhost:8000
https://myserver.com
```
- Keep the `6-digits` newly create `Client ID` somewhere
#### Then, you'll have to install the client.
#### Clone this repository
```
# With SSH
$ git clone git@git.happy-dev.fr:startinblox/applications/sib-app.git
# Or with HTTPS
$ git clone https://git.happy-dev.fr/startinblox/applications/sib-app.git
```
#### Install dependencies
```
$ cd sib-app
$ npm install
```
#### Configure `config.json`
On the newly created `./src/config.json` change the `dev` configuration like this:
```
"dev": {
"sdn": "http://api.myserver.com", # Or localhost:8000
"cdn": "https://cdn.happy-dev.fr",
"xmpp": "https://prosody.myserver.com/http-bind/",
"client_id": "000000" # <- Here goes your previously created Client ID
},
```
#### That's all! Now let's run it!
```
# For dev
$ make watch
2019-05-14 16:24:23 +00:00
$ npm run serve
2019-04-29 12:46:13 +00:00
# Or for prod
$ make build
2019-05-14 16:24:23 +00:00
# Then publish the www folder
2019-04-29 12:46:13 +00:00
```
## Deployment
Deployment will need a registered RSA Key on production servers.
### On Alpha
```
$ make syncprod
```
### On Staging
```
$ make sync
```
## Built With
* [Sib-Core](https://git.happy-dev.fr/startinblox/framework/sib-core/) - An awesome new framework!
### Architecture
Some general schema of the existing StartinBlox applications architecture can be found [here](https://docs.google.com/presentation/d/1iCRGaJpFvZjhjIUnpsn6lRTJJ31ES6n94BNkJygzUwM/edit?usp=sharing).
<!---
## Contributing
We may add a `CONTRIBUTING.md`
## License
We may add a `LICENSE.md`
## Acknowledgments
* Maybe some thanks too
* Inspiration
* etc
--->