Compare commits
13 Commits
6976c15a4d
...
main
Author | SHA1 | Date | |
---|---|---|---|
20a0cd882e | |||
e9e2c77d26 | |||
600eaa2c47 | |||
e36d688eed | |||
c31c410827 | |||
8ddaba773b | |||
495db314e4 | |||
d2f9470ca4 | |||
ea0520e681 | |||
6191009bc9 | |||
e60c544989 | |||
6937dd6ba0 | |||
4fee460ea5 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
settings.yml
|
settings.yml
|
||||||
static/
|
static/
|
||||||
**/__pycache__
|
**/__pycache__
|
||||||
|
/db.sqlite3
|
||||||
|
205
README.md
205
README.md
@ -6,42 +6,176 @@
|
|||||||
2. Add your SSH key here: https://git.startinblox.com/profile/keys
|
2. Add your SSH key here: https://git.startinblox.com/profile/keys
|
||||||
3. Create a project folder, I'll use `export PROJECT_FOLDER=~/Projects/Autonomic/StartinBlox/` -- all subsequent steps are run from `$PROJECT_FOLDER`
|
3. Create a project folder, I'll use `export PROJECT_FOLDER=~/Projects/Autonomic/StartinBlox/` -- all subsequent steps are run from `$PROJECT_FOLDER`
|
||||||
4. (Optional) Create a Python virtual environment using your preferred method,
|
4. (Optional) Create a Python virtual environment using your preferred method,
|
||||||
or e.g.
|
or e.g.
|
||||||
```
|
```
|
||||||
$ python3 -m venv $PROJECT_FOLDER/venv
|
$ python3 -m venv $PROJECT_FOLDER/venv
|
||||||
$ source $PROJECT_FOLDER/venv/bin/activate
|
$ source $PROJECT_FOLDER/venv/bin/activate
|
||||||
```
|
```
|
||||||
5. Check out the `djangoldp` code:
|
5. Check out the `djangoldp` code:
|
||||||
```
|
```
|
||||||
$ git clone git@git.startinblox.com:djangoldp-packages/djangoldp.git
|
$ git clone git@git.startinblox.com:djangoldp-packages/djangoldp.git
|
||||||
```
|
```
|
||||||
and install it:
|
and install it:
|
||||||
```
|
```
|
||||||
$ cd $PROJECT_FOLDER/djangoldp
|
$ cd $PROJECT_FOLDER/djangoldp
|
||||||
$ pip install -e .
|
$ pip install -e .
|
||||||
$ pip install psycopg2 pycryptodomex # is this still needed?
|
$ pip install psycopg2 pycryptodomex # is this still needed?
|
||||||
```
|
```
|
||||||
|
|
||||||
|
HERE, we probs want to checkout https://git.startinblox.com/djangoldp-packages/djangoldp-webpushnotification right? And then `pip install -e` it?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
6. Check out this very repository:
|
6. Check out this very repository:
|
||||||
```
|
```
|
||||||
$ git clone https://git.autonomic.zone/decentral1se/startinblox-startinoff
|
$ git clone https://git.autonomic.zone/decentral1se/startinblox-startinoff
|
||||||
|
$ cd startinblox-startinoff
|
||||||
|
```
|
||||||
|
and copy example settings to `settings.yml`:
|
||||||
|
```
|
||||||
|
$ cp example-settings.yml settings.yml
|
||||||
```
|
```
|
||||||
7. Install dependencies:
|
7. Install dependencies:
|
||||||
```
|
```
|
||||||
$ djangoldp install
|
$ djangoldp install
|
||||||
```
|
```
|
||||||
8. Run database migrations:
|
8. Run database migrations:
|
||||||
```
|
```
|
||||||
$ python manage.py migrate
|
$ python manage.py migrate
|
||||||
```
|
```
|
||||||
|
9. Create an RSA key for OAuth:
|
||||||
|
```
|
||||||
|
$ python manage.py creatersakey
|
||||||
|
```
|
||||||
|
10. Create super user
|
||||||
|
```
|
||||||
|
$ python manage.py createsuperuser
|
||||||
|
```
|
||||||
|
|
||||||
9. Launch the development server:
|
9. Launch the development server:
|
||||||
```
|
```
|
||||||
$ python manage.py runserver
|
$ python manage.py runserver
|
||||||
$ # Or, alternatively:
|
$ # Or, alternatively:
|
||||||
$ djangoldp runserver
|
$ djangoldp runserver
|
||||||
```
|
```
|
||||||
|
|
||||||
## Quick start 2: this time, it's Hubl!
|
## Quick start 2: this time, it's Hubl!
|
||||||
|
|
||||||
|
_(in another terminal, don't need to load virtualenv)_
|
||||||
|
|
||||||
|
```
|
||||||
|
git clone https://git.startinblox.com/applications/hubl
|
||||||
|
cd hubl
|
||||||
|
npm install
|
||||||
|
```
|
||||||
|
|
||||||
|
OR use our repo of it https://git.autonomic.zone/autonomic-cooperative/hubl
|
||||||
|
|
||||||
|
|
||||||
|
Then, add the following as `config.json` in your hubl folder.
|
||||||
|
|
||||||
|
```
|
||||||
|
{
|
||||||
|
"client": {
|
||||||
|
"name": "Sample of a functional Hubl",
|
||||||
|
"logo": "https://cdn.startinblox.com/logos/webp/hubl.webp"
|
||||||
|
},
|
||||||
|
"components": [{
|
||||||
|
"type": "registering",
|
||||||
|
"parameters": {
|
||||||
|
"authority": "http://localhost:8000/",
|
||||||
|
"authorityName": "dataserver"
|
||||||
|
},
|
||||||
|
"endpoints": {
|
||||||
|
"get": "http://localhost:8000/open-communities/"
|
||||||
|
},
|
||||||
|
"route": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "notification",
|
||||||
|
"route": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "admin",
|
||||||
|
"route": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "about"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "communities",
|
||||||
|
"route": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "dashboard",
|
||||||
|
"endpoints": {
|
||||||
|
"get": "http://localhost:8000/dashboards/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "profileDirectory",
|
||||||
|
"endpoints": {
|
||||||
|
"get": "http://localhost:8000/users/",
|
||||||
|
"skills": "http://localhost:8000/skills/",
|
||||||
|
"uploads": "http://localhost:8000/upload/"
|
||||||
|
},
|
||||||
|
"route": "members"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "jobBoard",
|
||||||
|
"endpoints": {
|
||||||
|
"get": "http://localhost:8000/job-offers/",
|
||||||
|
"post": "http://localhost:8000/job-offers/",
|
||||||
|
"skills": "http://localhost:8000/skills/"
|
||||||
|
},
|
||||||
|
"route": "job-offers"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "projects",
|
||||||
|
"endpoints": {
|
||||||
|
"get": "http://localhost:8000/projects/",
|
||||||
|
"post": "http://localhost:8000/projects/",
|
||||||
|
"captains": "http://localhost:8000/users/",
|
||||||
|
"users": "http://localhost:8000/users/",
|
||||||
|
"xmpp": "wss://xmpp-dev.startinblox.com/xmpp-websocket"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "circles",
|
||||||
|
"endpoints": {
|
||||||
|
"get": "http://localhost:8000/circles/",
|
||||||
|
"post": "http://localhost:8000/circles/",
|
||||||
|
"owners": "http://localhost:8000/users/",
|
||||||
|
"users": "http://localhost:8000/users/",
|
||||||
|
"xmpp": "wss://xmpp-dev.startinblox.com/xmpp-websocket"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "chat",
|
||||||
|
"endpoints": {
|
||||||
|
"xmpp": "wss://xmpp-dev.startinblox.com/xmpp-websocket"
|
||||||
|
},
|
||||||
|
"route": "messages"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "analytics",
|
||||||
|
"parameters": {
|
||||||
|
"type": "matomo",
|
||||||
|
"url": "https://matomo.startinblox.com/",
|
||||||
|
"id": "2"
|
||||||
|
},
|
||||||
|
"route": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Then launch the server with:
|
||||||
|
|
||||||
|
```
|
||||||
|
npm run watch
|
||||||
|
```
|
||||||
|
|
||||||
## Architecture 🏗
|
## Architecture 🏗
|
||||||
|
|
||||||
@ -69,20 +203,31 @@ In the early days, we were using PostgreSQL, and we may yet need to return to
|
|||||||
its warm embrace. To do so:
|
its warm embrace. To do so:
|
||||||
|
|
||||||
1. Install and start Postgres
|
1. Install and start Postgres
|
||||||
- Mac OSX: https://www.postgresql.org/download/macosx/, or `brew install postgresql`, then `brew services start postgresql`
|
- Mac OSX: https://www.postgresql.org/download/macosx/, or `brew install postgresql`, then `brew services start postgresql`
|
||||||
- Fedora: `dnf install postgresql-server && sudo systemctl enable postgresql.service && sudo systemctl start postgresql.service`
|
- Fedora: `dnf install postgresql-server && sudo systemctl enable postgresql.service && sudo systemctl start postgresql.service`
|
||||||
2. Create a user and a database:
|
2. Create a user and a database:
|
||||||
```
|
```
|
||||||
$ createuser djangoldp
|
$ createuser djangoldp
|
||||||
$ createdb -O djangoldp djangoldp
|
$ createdb -O djangoldp djangoldp
|
||||||
```
|
```
|
||||||
(you may need `sudo -u postgres` or `-U postgres` on both of these commands,
|
(you may need `sudo -u postgres` or `-U postgres` on both of these commands,
|
||||||
depending on your local security set-up)
|
depending on your local security set-up)
|
||||||
3. Edit `settings.yml` if you need to remove the postgres user or change the
|
3. Edit `settings.yml` if you need to remove the postgres user or change the
|
||||||
password
|
password
|
||||||
|
|
||||||
## Troubleshooting / top tips
|
## Troubleshooting / top tips
|
||||||
|
|
||||||
* Remember to activate your virtual environment, if you're using one, before
|
* Remember to activate your virtual environment, if you're using one, before
|
||||||
running any Python / `manage.py` / `djangoldp` commands
|
running any Python / `manage.py` / `djangoldp` commands
|
||||||
|
|
||||||
|
* `django.db.migrations.exceptions.InconsistentMigrationHistory: Migration guardian.0001_initial is applied before its dependency djangoldp_account.0001_initial on database 'default'.`
|
||||||
|
* try `rm db.sqlite3` in your hublserver folder.
|
||||||
|
|
||||||
|
* `ImportError: cannot import name 'base64url_decode' from 'jwt.utils'`
|
||||||
|
* try `pip uninstall jwt` and `pip install pyjwt`
|
||||||
|
|
||||||
|
* `No module named 'oidc_provider.lib.utils.dpop'`
|
||||||
|
* Make sure you're in the right virtualenv!
|
||||||
|
|
||||||
|
* Database broken!
|
||||||
|
* Run `python manage.py reset_db` to reset it
|
||||||
|
@ -1,36 +1,97 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
- djangoldp_account
|
- djangoldp-i18n
|
||||||
- djangoldp_notification
|
- djangoldp-account
|
||||||
- django-webpush
|
- djangoldp-notification
|
||||||
|
- djangoldp-dashboard
|
||||||
|
- djangoldp-profile
|
||||||
|
- djangoldp-community
|
||||||
|
- djangoldp-joboffer
|
||||||
|
- djangoldp-event
|
||||||
|
- djangoldp-project
|
||||||
|
# - djangoldp-invoice
|
||||||
|
- djangoldp-contact
|
||||||
|
- djangoldp-circle
|
||||||
|
- djangoldp-conversation
|
||||||
|
- djangoldp-uploader
|
||||||
|
- djangoldp-skill
|
||||||
|
- django-cors-headers
|
||||||
|
|
||||||
ldppackages:
|
ldppackages:
|
||||||
- djangoldp_account
|
- djangoldp_i18n
|
||||||
- djangoldp_notification
|
- djangoldp_account
|
||||||
|
- djangoldp_notification
|
||||||
|
- djangoldp_dashboard
|
||||||
|
- djangoldp_profile
|
||||||
|
- djangoldp_community
|
||||||
|
- djangoldp_joboffer
|
||||||
|
- djangoldp_event
|
||||||
|
- djangoldp_project
|
||||||
|
# - djangoldp_invoice
|
||||||
|
- djangoldp_contact
|
||||||
|
- djangoldp_circle
|
||||||
|
- djangoldp_conversation
|
||||||
|
- djangoldp_uploader
|
||||||
|
- djangoldp_skill
|
||||||
|
- djangoldp_webpushnotification
|
||||||
|
|
||||||
server:
|
server:
|
||||||
DEBUG: true
|
|
||||||
ALLOWED_HOSTS:
|
|
||||||
- "*"
|
|
||||||
SECRET_KEY: "ak$t4x@9pcs$ypwt_m38)vcg^m=q@j7*2rs2gu7%h0wwcv)(y2"
|
SECRET_KEY: "ak$t4x@9pcs$ypwt_m38)vcg^m=q@j7*2rs2gu7%h0wwcv)(y2"
|
||||||
DATABASES:
|
ALLOWED_HOSTS:
|
||||||
default:
|
- http://localhost
|
||||||
ENGINE: django.db.backends.postgresql_psycopg2
|
- http://localhost:8000
|
||||||
NAME: djangoldp
|
- "*"
|
||||||
USER: postgres
|
BASE_URL: http://localhost:8000
|
||||||
LDP_RDF_CONTEXT: https://cdn.happy-dev.fr/owl/hdcontext.jsonld
|
SITE_URL: http://localhost:8000
|
||||||
|
DEBUG: True
|
||||||
|
|
||||||
|
EMAIL_BACKEND: django.core.mail.backends.console.EmailBackend
|
||||||
|
INSTANCE_DEFAULT_CLIENT: http://localhost:9000
|
||||||
|
DEFAULT_REQUEST_TIMEOUT: 120
|
||||||
|
DEFAULT_BACKOFF_FACTOR: 2
|
||||||
|
MAX_ACTIVITY_RESCHEDULES: 4
|
||||||
|
USE_I18N: True
|
||||||
|
|
||||||
|
# defaults to SQLite if not provided
|
||||||
|
#DATABASES:
|
||||||
|
# default:
|
||||||
|
# ENGINE: django.db.backends.postgresql_psycopg2
|
||||||
|
# NAME: djangoldp
|
||||||
|
# USER: postgres
|
||||||
|
|
||||||
|
JABBER_DEFAULT_HOST: licoornes.startinblox.com
|
||||||
|
MEDIA_ROOT: media
|
||||||
|
PROSODY_HTTP_URL: https://jabber.happy-dev.fr
|
||||||
|
REGISTRATION_OPEN: true
|
||||||
ROOT_URLCONF: server.urls
|
ROOT_URLCONF: server.urls
|
||||||
STATIC_ROOT: static
|
STATIC_ROOT: static
|
||||||
# STATIC_URL: = '/static/'
|
|
||||||
# STATICFILES_DIRS: = '/Users/trav/Documents/gitnsurge/autonomic/startinblox/startinblox-startinoff'
|
|
||||||
MEDIA_ROOT: media
|
|
||||||
INSTALLED_APPS:
|
INSTALLED_APPS:
|
||||||
- server
|
- server
|
||||||
- djangoldp_crypto # only needed by decentral1se for #236
|
|
||||||
- webpush
|
|
||||||
- django_extensions
|
|
||||||
|
|
||||||
|
EMAIL_ON_ACCOUNT_CREATION: True
|
||||||
|
DEFAULT_SUPERUSER_PERMS: []
|
||||||
|
OIDC_ACCESS_CONTROL_ALLOW_HEADERS: 'authorization, Content-Type, if-match, accept, sentry-trace, DPoP'
|
||||||
|
|
||||||
WEBPUSH_SETTINGS:
|
WEBPUSH_SETTINGS:
|
||||||
VAPID_PUBLIC_KEY: "BIDVJ0sd4Cyycf_aGCxhQ_SmXBneWboI3wGO-Iyj3ofeGkvYyNp5o6W9eTf13YkJSz6NlRwiCHA08m8e82n5WXI"
|
VAPID_ADMIN_EMAIL: "test@example.com"
|
||||||
VAPID_PRIVATE_KEY: "zQ-Apj3yLGvcq-l_YNFMFgNVBxQ5_JYEsUbZA36Yhes"
|
|
||||||
VAPID_ADMIN_EMAIL: "trav@teafry.me"
|
MIDDLEWARE:
|
||||||
|
- 'corsheaders.middleware.CorsMiddleware'
|
||||||
|
|
||||||
|
CORS_ALLOWED_ORIGINS:
|
||||||
|
- "http://localhost:1234"
|
||||||
|
|
||||||
|
CORS_ALLOW_HEADERS:
|
||||||
|
- 'accept'
|
||||||
|
- 'accept-encoding'
|
||||||
|
- 'authorization'
|
||||||
|
- 'content-type'
|
||||||
|
- 'dnt'
|
||||||
|
- 'origin'
|
||||||
|
- 'user-agent'
|
||||||
|
- 'x-csrftoken'
|
||||||
|
- 'x-requested-with'
|
||||||
|
- 'dpop'
|
||||||
|
|
||||||
|
CORS_ALLOW_CREDENTIALS: True
|
||||||
|
|
||||||
|
BIN
media/netscape-throbber.gif
Normal file
BIN
media/netscape-throbber.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 364 KiB |
74
settings.yml.old
Normal file
74
settings.yml.old
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
dependencies:
|
||||||
|
- djangoldp-dashboard
|
||||||
|
- djangoldp_invoice
|
||||||
|
- djangoldp_contact
|
||||||
|
- djangoldp-account
|
||||||
|
- djangoldp-circle
|
||||||
|
- djangoldp-conversation
|
||||||
|
- djangoldp-joboffer
|
||||||
|
- djangoldp-notification
|
||||||
|
- djangoldp-profile
|
||||||
|
- djangoldp-project
|
||||||
|
- djangoldp-uploader
|
||||||
|
- djangoldp-skill
|
||||||
|
- djangoldp-i18n
|
||||||
|
- djangoldp-community
|
||||||
|
- django-webidoidc-provider
|
||||||
|
- djangoldp-event
|
||||||
|
- djangoldp-resource
|
||||||
|
- djangoldp-polls
|
||||||
|
- djangoldp-digest
|
||||||
|
|
||||||
|
ldppackages:
|
||||||
|
- djangoldp_i18n
|
||||||
|
- djangoldp_dashboard
|
||||||
|
- djangoldp_account
|
||||||
|
- djangoldp_invoice
|
||||||
|
- djangoldp_contact
|
||||||
|
- djangoldp_community
|
||||||
|
- djangoldp_circle
|
||||||
|
- djangoldp_conversation
|
||||||
|
- djangoldp_joboffer
|
||||||
|
- djangoldp_notification
|
||||||
|
- djangoldp_profile
|
||||||
|
- djangoldp_project
|
||||||
|
- djangoldp_uploader
|
||||||
|
- djangoldp_skill
|
||||||
|
- djangoldp_event
|
||||||
|
- djangoldp_resource
|
||||||
|
- djangoldp_polls
|
||||||
|
- djangoldp_digest
|
||||||
|
- djangoldp_webpushnotification
|
||||||
|
|
||||||
|
server:
|
||||||
|
# DjangoLDP required settings
|
||||||
|
DEBUG: true
|
||||||
|
ALLOWED_HOSTS:
|
||||||
|
- '*'
|
||||||
|
SECRET_KEY: 'some-random'
|
||||||
|
DATABASES:
|
||||||
|
default:
|
||||||
|
ENGINE: django.db.backends.sqlite3
|
||||||
|
NAME: db.sqlite3
|
||||||
|
LDP_RDF_CONTEXT: https://cdn.happy-dev.fr/owl/hdcontext.jsonld
|
||||||
|
ROOT_URLCONF: server.urls
|
||||||
|
STATIC_ROOT: static
|
||||||
|
MEDIA_ROOT: media
|
||||||
|
USE_I18N: True
|
||||||
|
BASE_URL: http://localhost:8000
|
||||||
|
SITE_URL: http://localhost:8000
|
||||||
|
EMAIL_BACKEND: django.core.mail.backends.console.EmailBackend
|
||||||
|
PROSODY_HTTP_URL: http://localhost:4848
|
||||||
|
JABBER_DEFAULT_HOST: no.jabber
|
||||||
|
REGISTRATION_OPEN: True
|
||||||
|
INSTANCE_DEFAULT_CLIENT: http://localhost:1234
|
||||||
|
EMAIL_ON_ACCOUNT_CREATION: False
|
||||||
|
DEFAULT_REQUEST_TIMEOUT: 120
|
||||||
|
DEFAULT_BACKOFF_FACTOR: 1
|
||||||
|
MAX_ACTIVITY_RESCHEDULES: 4
|
||||||
|
OIDC_ACCESS_CONTROL_ALLOW_HEADERS: 'authorization, Content-Type, if-match, accept, sentry-trace, DPoP'
|
||||||
|
DEFAULT_SUPERUSER_PERMS: []
|
||||||
|
DCS_SESSION_COOKIE_SAMESITE: 'None'
|
||||||
|
DCS_SESSION_COOKIE_SECURE: False
|
||||||
|
CSRF_COOKIE_SAMESITE: 'lax'
|
||||||
|
CSRF_COOKIE_SECURE: False
|
Reference in New Issue
Block a user