Skip to content
Snippets Groups Projects
cozy-registry.md 1.5 KiB
Newer Older
  • Learn to ignore specific revisions
  • Bastien DUMONT's avatar
    Bastien DUMONT committed
    # Cozy registry
    
    
    Pilote Usager is linked to a registry to allow a TS to find and connect to a user Pilote app.
    A service is run every day to send instance information to the registry.
    
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    ## Service Flow summarized
    
    
    ```plantuml
      "Pilote Usager" -> "Cozy Registry": POST firstName, lastName, cozyURL, smsTriggerId
      "Pilote TS" -> "Cozy Registry": GET firstname, lastName
      "Pilote TS" <-- "Cozy Registry": cozyURL, smsTriggerId
      "Pilote TS" -> "Pilote Usager": trigger sharecode sending by SMS
      "Pilote Usager" --> "Pilote Usager": sharecode
      "Pilote TS" <- "Pilote Usager": read sharecode
      "Pilote TS" -> "Pilote Usager": connect to user Cozy
    ```
    
    ## Launch the service locally
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    
    
    - Switch to Node 16 (using nvm or n)
    
    Rémi PAILHAREY's avatar
    Rémi PAILHAREY committed
    - install local remote doctypes (details [here](/ecolyo/project_architecture/remote_doctypes/#local-remote-doctype)), add a folder named org.mps.registry.dev, inside it add a file named request with the following content :
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    
    
    ```
    POST https://cozy-registry.poc.self-data.alpha.grandlyon.com/api/pilote
    Authorization: Bearer {{secret_token}}
    Content-Type: application/json
    
    {{data}}
    ```
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    
    
    - in the database, if it doesn't exist, create a table named secrets/io-cozy-remote-secrets and add a document with the following content :
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    
    
    ```json
    {
      "_id": "org.mps.registry.dev",
      "token": "pilotecozytoken"
    }
    ```
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    
    
    - launch `docker-compose up` in a first terminal
    - launch `yarn build` in a second terminal
    - launch `yarn run cozy-konnector-dev -m ./manifest.webapp ./build/services/cozyRegistry/pilote.js` to execute the service