feature: added docker image for LDP server

This commit is contained in:
plup 2019-10-27 14:57:27 +01:00
parent 6a7edb1a6c
commit 401a000e5f
3 changed files with 36 additions and 106 deletions

114
README.md
View File

@ -17,67 +17,17 @@ To install SiB App, you'll need to have:
### Installing
#### At first, you'll need to deploy a `sib-manager` server, then configure it.
#### `sib-manager` installation or update
[Install a server and a client application](https://git.happy-dev.fr/startinblox/devops/doc/wikis/deploy_a_sib_application)
Or build the docker images and run it:
```
$ pip3 install -U sib-manager
$ docker build -t sibapp docker/
$ docker run --rm -p 127.0.0.1:8000:8000 -it sibapp
```
#### `sib-manager` deploy
## FIXME
```
$ 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
```
We're using
- `djangoldp_project`,
- `django-oidc-provider`,
- `djangoldp_circle`,
- `djangoldp_joboffer`,
- `djangoldp_profile`,
- `djangoldp_skill`,
- `djangoldp_account`,
- `djangoldp_notification`,
- `djangoldp_conversation`
As dependencies, if you don't want them, just remove the `-m packagename`.
`sibserver` is the name of the folder that `sib-manager` will create, choose it wisely.
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)
#### `sibserver` configuration
You'll have to change some settings on the `sibserver` files.
- Add your server name to `ALLOWED_HOSTS`
- In `settings.py`, add your hostname on `ALLOWED_HOSTS`, eg:
```
ALLOWED_HOSTS = ['api.myserver.com', 'localhost']
```
- Around line `96-97` of `settings.py` set your `PROSODY_HTTP_URL`, `JABBER_DEFAULT_HOST`, eg:
```
PROSODY_HTTP_URL = 'https://jabber.happy-dev.fr'
JABBER_DEFAULT_HOST = 'happy-dev.fr'
```
#### `sib-manager` launching
On the first `sibserver` folder
```
$ ./manage.py runserver
```
#### Create a Client ID for Prosody & Client
Create a Client ID for Prosody & Client
- Go to `localhost:8000/admin/`
- Login with previously created account.
@ -96,26 +46,7 @@ $ ./manage.py runserver
```
- 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`
Configure `config.json`:
On the newly created `./src/config.json` change the `dev` configuration like this:
```
@ -127,35 +58,6 @@ On the newly created `./src/config.json` change the `dev` configuration like thi
},
```
#### That's all! Now let's run it!
```
# For dev
$ make watch
$ npm run serve
# Or for prod
$ make build
# Then publish the www folder
```
## 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!
@ -178,4 +80,4 @@ We may add a `LICENSE.md`
* Maybe some thanks too
* Inspiration
* etc
--->
--->

10
docker/Dockerfile Normal file
View File

@ -0,0 +1,10 @@
FROM happydev1/sib:3.6
RUN pip install --user -U sib-manager
RUN sudo chown -R sib /opt
WORKDIR /opt
RUN cd /opt/ && sib startproject sib_server
ADD packages.yml /opt/sib_server/packages.yml
RUN cd /opt/sib_server && sib install sib_server
EXPOSE 8000
CMD cd /opt/sib_server && python manage.py runserver 0.0.0.0:8000

18
docker/packages.yml Normal file
View File

@ -0,0 +1,18 @@
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'
server:
site_url: 'http://localhost:8000'
admin_email: admin@example.org
admin_name: admin
admin_pass: admin