Skip to content

Configure Decidim Bulletin Board#6420

Merged
tramuntanal merged 10 commits intodevelopfrom
feature/configure-bulletin-board
Sep 30, 2020
Merged

Configure Decidim Bulletin Board#6420
tramuntanal merged 10 commits intodevelopfrom
feature/configure-bulletin-board

Conversation

@leio10
Copy link
Copy Markdown
Contributor

@leio10 leio10 commented Aug 18, 2020

🎩 What? Why?

This PR implements the first step needed to configure a connection to a Bulletin Board from Decidim. It generates an identification pair of keys to be able to sign all the requests sent to the Bulletin Board.

📌 Related Issues

📋 Subtasks

  • Add CHANGELOG upgrade notes, if required
  • If there's a new public field, add it to GraphQL API
  • Add documentation regarding the feature
  • Add tests

📷 Screenshots (optional)

  • Rake task call
    task private key
    task public key
  • Bulletin Board not set warning
    no bulletin board warning

@leio10 leio10 force-pushed the feature/configure-bulletin-board branch from bb6719a to 9e6aa87 Compare August 18, 2020 09:17
@leio10
Copy link
Copy Markdown
Contributor Author

leio10 commented Aug 18, 2020

@decidim/product I've some concerns about this implementation:

  • some Decidim instances, as Decidim Barcelona, are deployed to Heroku. This service uses ephemeral storage, meaning that all created files will be lost on each deploy. So, creating the files with the task seems a bit problematic, as we can't upload the private key to the repository nor create it directly on the server on those cases. That's why I've decided to print the keys on the screen and explain different options in the documentation.

  • as @tramuntanal points here, secure public keys are multiline and too lengthy to be used as parameters for rake tasks, even when it's possible. I can think of three options here:
    a. keep it as it is now, using quotes to call the add_authority task:

    $ export PK="-----BEGIN PUBLIC KEY-----
    MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA32d9tY44lfV6OdanXQ4B
    102oYFEYMouZUDHquD5yTNZZkTYJ71u9VCHtVf83rW+YUj8NZFtoCeo/g9TUwmKf
    nUl362MeNlrpbTUU2yD3rJjt5JDme4+gtFPjTneubJEOwwHBKJpDNqZB+HmxNqbz
    3nn4EoBqv8tSKFon8Mk1Nsj9aPW3jpHnVCjWUJ8wtB321TgYW2GMDv8aOkOZ/M7p
    z4pFk49Skp24knITeeKdzB2VvcRhEdAf8Lp5Jqtoh9za40Ky0AvPx/Ueh42xH9t+
    P9hfQFX5joSlCKMAPe1Xyji2gxiwWTBu60mOL7PbThiDxrOZxSVhhN21A4IrDfIN
    T2PJCDtYZUyqu6xYISPg6i3teXZrPWT4wWVcJ/dPEXJwSomuFpK7AZ07uhwSwLPw
    pZc/yUxDq3xNfyVCRfu9UoCvrKwKMK7BrXPzM6ljtD9KzjhqbXb1q+JQXDp6uxIH
    FV8TXJSZS7o2tU9G0AoXiKRIOS1t6IG19YhC6Yqn5raPjRlVO//suJS+WAV+j3tU
    SHFOHWo6HYXcS6WRHItkudXjwnyIhW06Zs+KuMKXQQmEkytcFi562pwvUH7kvAZ2
    8G0TR5G5wgRbrGQzM4WyMuemWbcFpG6RqwboffHNCkxSetDHY9WOF3EQ0pKqzaJB
    XbnNp1nB7AHiy2yxCQznpUMCAwEAAQ==
    -----END PUBLIC KEY-----"
    
    $ bin/rails "client:add_authority[Authority name, $PK]"

    b. dump the public key to a file and use it to send it to the Bulletin Board administrator, as @tramuntanal suggested
    c. add it to the graphql and change the Bulletin Board task to fetch all the Decidim instance from the graphql response, only needing the graphql endpoint, something like this:

    image

    I like this solution as it is pretty straightforward for administrators, but I'm not very convinced about adding a GraphQL client to the BB and adding a dependency to Decidim, which we currently don't have - but it may be needed in the future anyway.

  • As shown in the PR screenshots part, I've added a warning message to warn the administrators that the Elections module can't be used without a configured BB. This alert will appear on every visit to the elections list page until the identification keys are generated and the BB settings are set. I don't know if think that it's ok or if this could be too annoying for administrators.

That's all. As you can see, in this PR I've decided to implement the simplest approach to be able to iterate over it until we find the best solution for each concern.

@leio10 leio10 force-pushed the feature/configure-bulletin-board branch from 9e6aa87 to 83fe972 Compare August 18, 2020 15:26
@tramuntanal
Copy link
Copy Markdown
Contributor

I have to contradict myself but taking into account environments like Heroku that have ephemeral file systems it may be best to keep with the current implementation and pass the public key as a task parameter

@andreslucena
Copy link
Copy Markdown
Member

@leio10 I've reformated your answer (by giving a numbered alphabetical list), so it's easier to follow/discuss.

What I was thinking initially regarding the key with the add_authority task is to have something like the one you have in ssh (ie .ssh/id_rsa.pub), that'd be less error-prone for commands IMHO.

Also in the future, after we have the first working implementation, we should make a step by step tutorial with examples of format, as this could be an issue. For instance in your c. example there are newline escape sequences (\n)

@tramuntanal
Copy link
Copy Markdown
Contributor

@leio10 what's the state of this PR?

title: Edit election
update: Update election
index:
no_bulletin_board: There is no Bulletin Board server configured, which is needed to use this module. This task should be done by the System Administrator.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@leio10 leio10 force-pushed the feature/configure-bulletin-board branch from 85a81cb to 3533b36 Compare September 10, 2020 17:35
@leio10
Copy link
Copy Markdown
Contributor Author

leio10 commented Sep 11, 2020

@andreslucena I've addressed your comments. Regarding the link you asked to add in the warning message, it was shown inside a callout, that wasn't prepared to show links. So, I've added some styling for that. You can check it here.

Copy link
Copy Markdown
Member

@andreslucena andreslucena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@leio10
Copy link
Copy Markdown
Contributor Author

leio10 commented Sep 22, 2020

@decidim/core this was approved by Product and is ready to be reviewed

@tramuntanal tramuntanal self-assigned this Sep 30, 2020
Copy link
Copy Markdown
Contributor

@tramuntanal tramuntanal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @leio10 !

Comment on lines +27 to +31
@identification_private_key_content ||= if identification_private_key.starts_with?("-----")
identification_private_key
else
File.read(Rails.application.root.join(identification_private_key))
end
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good, two ways to set the private key. I see it is also documented 👏

@tramuntanal tramuntanal merged commit f61b6c9 into develop Sep 30, 2020
@tramuntanal tramuntanal deleted the feature/configure-bulletin-board branch September 30, 2020 10:40
andreslucena added a commit that referenced this pull request Oct 6, 2020
roxanaopr pushed a commit to i-need-another-coffee/decidim that referenced this pull request Oct 15, 2020
* doc: add Bulletin Board connection setup guide

* feat: add identification keys generation task

* feat: include bulletin board settings in the applications generator

* feat: make the bulletin board client read the connection settings

* feat: warn administrator users about the missing Bulletin Board setup

* refactor: move rake tasks test helpers from core to dev to reuse them

* test: add tests for the rake task and the bulletin board client

* style: fix lint issues

* doc: apply requested changes

* feat: fix style for links inside admin callouts
andreslucena added a commit that referenced this pull request Nov 19, 2020
Leusev pushed a commit that referenced this pull request Dec 2, 2020
* Remove Markdown doc

* Add documentation with Antora (AsciiDoc format - .adoc)

Adds sections:
* configure
* customize
* develop
* install
* services

Also adds:
* a README explaining the relationship with the documentation repository
available in https://github.com/decidim/documentation
* antora metadata file so we can build these sections in the same website

* Fix Antora name for docs

* Rename advanced pages to Concerns

* Add Authorizations customize from module's README

* Move 'add_authorizable_action' to 'permissions'

* Move 'adding_fixtures_aka_dummy_content' to 'components'

* Move 'how_to_create_a_module' to 'components'

* Remove 'upgrading', now it's in 'update'

* Install guide: fix error in 'whatever' gem (it's 'whenever')

* Install guide: fix error in RAILS_ENV order in commands

* Install guide: fix command for open_data export

* Install guide: fix link to Contribution guide

* Develop guide: add example apps

* Architecture docs

Add first version of c4model diagrams with PlantUML

* https://c4model.com/
* https://plantuml.com/
* https://github.com/RicardoNiepel/C4-PlantUML

* Add some explanation of modules types (with Components link)

* Configure: ENV VARS and Initializer

This moves ENV VARS configuration docs to its own page.
We also create a new page for explaining Decidim's initializer settings
(config/initializer/decidim.rb). For the moment is mostly a copy paste with
nice formating, but the idea is to expand it.

* Sync "Make maps actually configurable" by @ahukkanen

Extracted from #6340

* Sync "Templates module" by @verarojman

Extracted from #6247

* Sync "Configure Decidim Bulletin Board" by @leio10

Extracted from #6420

* Sync "Add a task to fix locale issues" by @microstudi

Extracted from #6510

* Update versions in SECURITY.adoc

* Convert CONTRIBUTING.md to AsciiDoc

* Convert README.md to AsciiDoc

* Clarify CONTRIBUTING and links to docs site

* Remove Markdown linter CI

* Sync "Update documentation for `decidim` OAuth social provider" by @tramuntanal

Extracted from #6607

* Sync "Generate changelog entries" by @tramuntanal

Extracted from #6794

* Fix link in oauth.adoc

* Sync "Improve moderation panel" by @beagleknight

Extracted from #6677

* Removes trailing whitespaces

Co-authored-by: Oliver Valls <199462+tramuntanal@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Configure Decidim with the Bulletin Board

3 participants