Some code to help kick off things
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
trav 20a0cd882e moved post-save hook for notifs 4 weeks ago
media some readme updates 2 months ago
server Update README, remove __pycache__, 2 months ago
.gitignore Git ignore database 2 months ago
README.md some readme updates 2 months ago
example-settings.yml Add missing MIDDLEWARE to example settings 2 months ago
manage.py Init hacking 5 months ago
settings.yml.old moved post-save hook for notifs 4 weeks ago

README.md

startinblox-startinoff

Quick-start: Gettin' started with Startin'blox

  1. Sign up for an account on https://git.startinblox.com
  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
  4. (Optional) Create a Python virtual environment using your preferred method, or e.g.
    $ python3 -m venv $PROJECT_FOLDER/venv
    $ source $PROJECT_FOLDER/venv/bin/activate
    
  5. Check out the djangoldp code:
    $ git clone git@git.startinblox.com:djangoldp-packages/djangoldp.git
    

    and install it:

    $ cd $PROJECT_FOLDER/djangoldp
    $ pip install -e .
    $ 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?

  1. Check out this very repository:

    $ 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
    
  2. Install dependencies:

    $ djangoldp install
    
  3. Run database migrations:

    $ python manage.py migrate
    
  4. Create an RSA key for OAuth:

    $ python manage.py creatersakey
    
  5. Create super user

    $ python manage.py createsuperuser
    
  6. Launch the development server:

    $ python manage.py runserver
    $ # Or, alternatively:
    $ djangoldp runserver
    

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 🏗

djangoldp is a Django app which you plug into a Django project. So, if you're hacking on djangoldp or related apps, then you need a Django project to test it.

When you follow this setup guide, you get asked to run djangoldp initserver myldpserver (where I changed myldpserver to startinblox-startinoff) and what spits out is what you also see in this repository but with a working settings.yml file.

user@machine:/path/to/startinblox$  tree -L 1
.
├── djangoldp
└── startinblox-startinoff (run ./manage.py commands here which uses your djangoldp code)

2 directories, 0 files

Using Postgres instead of SQLite

In the early days, we were using PostgreSQL, and we may yet need to return to its warm embrace. To do so:

  1. Install and start Postgres
  • 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
  1. Create a user and a database:
    $ createuser djangoldp
    $ createdb -O djangoldp djangoldp
    

    (you may need sudo -u postgres or -U postgres on both of these commands, depending on your local security set-up)

  2. Edit settings.yml if you need to remove the postgres user or change the password

Troubleshooting / top tips

  • Remember to activate your virtual environment, if you're using one, before 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