Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update documentation #44

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ jobs:
name: Create the screenshots folder
# TODO: Use latest version
- uses: nanasess/setup-chromedriver@v2
with:
chromedriver-version: "114.0.5735.90"
- run: bundle exec rake "test:run[exclude, spec/system/**/*_spec.rb, ${{ matrix.slice }}]"
name: RSpec
- run: ./.github/upload_coverage.sh decidim-app $GITHUB_EVENT_PATH
Expand Down Expand Up @@ -158,8 +156,6 @@ jobs:
name: Create the screenshots folder
# TODO: Use latest version
- uses: nanasess/setup-chromedriver@v2
with:
chromedriver-version: "114.0.5735.90"
- run: bundle exec rake "test:run[include, spec/system/**/*_spec.rb, ${{ matrix.slice }}]"
name: RSpec
- run: ./.github/upload_coverage.sh decidim-app $GITHUB_EVENT_PATH
Expand Down
662 changes: 662 additions & 0 deletions LICENSE-AGPLV3.txt

Large diffs are not rendered by default.

151 changes: 28 additions & 123 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,137 +1,42 @@
# Decidim app by OSP
# Decidim DSFR
![Tests](https://github.com/OpenSourcePolitics/decidim-ditp/actions/workflows/ci_cd.yml/badge.svg?branch=master)

Citizen Participation and Open Government application.
## Decidim
![](./docs/decidim-logo-claim.svg)

## Deploy with Terraform
[Decidim](https://github.com/decidim/decidim) is a digital platform for citizen participation. Related documentation can be found [here](https://docs.decidim.org).

Terraform is an open-source infrastructure as code software tool that provides an easy deployment of your infrastructure for installing Decidim.
This repository contains the code of the Decidim application implemented for the french institutions.

Many providers are available (**AWS**, **Heroku**, **DigitalOcean**...). Check the [Terraform registry to see how to use Terraform with your provider](https://registry.terraform.io/browse/providers)
It consists of the main application with modules developed by the community.

Each Terraform deployment are stored in the **deploy** folder and sorted by providers
It includes **official modules** supported by the community and **community-based modules** developed by us or [our partners](https://github.com/decidim-ice).

Feel free to add new deployments!
### List of our modules

## Availables deployments
You can find below an exhaustive list of modules with their repository links and latest version available :

- [Scaleway](https://github.com/OpenSourcePolitics/decidim-app/tree/develop/deploy/providers/scaleway)
- [DigitalOcean](https://github.com/OpenSourcePolitics/decidim-app/tree/develop/deploy/providers/digitalocean/)
| Decidim Module | Version | Brief description |
|-------------------------------------------------------------------------------------------------------------------------|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| decidim-core | v0.26.7 |
| [decidim-cache_cleaner](https://github.com/OpenSourcePolitics/decidim-module-cache_cleaner) | ✅ | Allow admins to clear cache of the application in the back-office |
| [decidim-decidim_awesome](https://github.com/decidim-ice/decidim-module-decidim_awesome) | ✅ | An awesome module that allows (among others) : adding extra-fields for proposals creation, fullscreen iframe component, image in rich text editor, customs redirections etc. |
| [decidim-homepage_interactive_map](https://github.com/OpenSourcePolitics/decidim-module-homepage_interactive_map) | ✅ | Module that allow the adding of a content-block on the homepage diplaying a map of assemblies in order to allow geo-located participation |
| [decidim-spam_detection](https://github.com/OpenSourcePolitics/decidim-spam_detection) | ✅ | Module adding a spam detection algorithm that runs periodically detecting spam accounts |
| [decidim-term_customizer](https://github.com/mainio/decidim-module-term_customizer) | ✅ | Module allowing the change of translated strings |

## Environment variables

Each provider will need a way to authenticate at their API. Make sure to set environment variables asked in the provider's documentation before using deployments.
Some non-official customizations can be found see [OVERLOADS.MD](./OVERLOADS.md).

- To use Scaleway's provider
## 🚀 Getting started
- See our [installation guide](./docs/GETTING_STARTED.md) to run a decidim-app by OSP locally
- See our [homepage interactive map module](./docs/HOMEPAGE_INTERACTIVE_MAP.md) to configure module (OSX/Ubuntu)

```bash
export SCW_ACCESS_KEY=<your_access_key>
export SCW_TOKEN=<your_scw_token>
export SCW_DEFAULT_PROJECT_ID=<id_of_your_project/organization>
```
## 👋 Contributing
- See our [contributing guide](./docs/CONTRIBUTING.md)

- To use DigitalOcean's provider
```bash
export DIGITALOCEAN_TOKEN=<your_do_token>
export SPACES_ACCESS_KEY_ID=<your_do_space_access_key>
export SPACES_SECRET_ACCESS_KEY=<your_do_space_secret_key>
```
## 🔒 Security
Security is very important to us. If you have any issue regarding security, please disclose the information responsibly by sending an email to **security[at]opensourcepolitics[dot]eu** and not by creating a Github issue.

## How to deploy with Terraform?

Check the list of make commands in the Makefile. Each command corresponds to a provider and a specific need.

- To deploy a new infrastructure with Scaleway

```make
make deploy-scw
```

## Setting up the application

You will need to do some steps before having the app working properly once you've deployed it:

1. Open a Rails console in the server: `bundle exec rails console`
2. Create a System Admin user:
```ruby
email = <your email>
password = <a secure password>
user = Decidim::System::Admin.new(email: email, password: password, password_confirmation: password)
user.save!
```
3. Visit `<your app url>/system` and login with your system admin credentials
4. Create a new organization. Check the locales you want to use for that organization, and select a default locale.
5. Set the correct default host for the organization, otherwise the app will not work properly. Note that you need to include any subdomain you might be using.
6. Fill the rest of the form and submit it.

You're good to go!

## Running tests

This application has a functional testing suite. You can easily run locally the tests as following :

Create test environment database

`bundle exec rake test:setup`

And then run tests using `rspec`

`bundle exec rspec spec/`

## Docker
### How to use it?
You can boot a Decidim environment in Docker using the Makefile taht will run docker-compose commands and the last built image from the Dockerfile.
Three context are available :

- **Clean Decidim**

An environment running the current Decidim version (from Gemfile) without any data.
```make
make start-clean-decidim
```

- **Seeded Decidim**

An environment running the current Decidim version (from Gemfile) with generated seeds
```make
make start-seeded-decidim
```

- **Dumped Decidim**

An environment running the current Decidim version (from Gemfile) with real data dumped from an existing platform to simulate a Decidim bump version before doing in the real production environment.
```make
make start-dumped-decidim
```
***Warning : you need to get a psql dump on your local machine to restore it in your containerized database***
***Warning2 : you need to set organization host to 0.0.0.0 with the rails console***


### How to stop and remove it?

To get rid off your Docker environmnent :

- Shut down Docker environmnent
```make
make stop
```

- Delete resources
```make
make delete
```
### Troubleshooting

Make commands are available to help you troubleshoot your Docker environment

- Start Rails console
```make
make rails-console
```
- Start bash session to app container
```make
make connect-app
```

## Database architecture (ERD)

![Architecture_decidim](https://user-images.githubusercontent.com/52420208/133789299-9458fc42-a5e7-4e3d-a934-b55c6afbc8aa.jpg)
## License
The decidim-app is licensed under the [AGPLv3](./LICENSE-AGPLV3.txt), same license as Decidim.
45 changes: 45 additions & 0 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# How to contribute to Decidim DSFR

We're really glad you're reading this, you might be interested by the code source of the Decidim DSFR.

If you haven't already, come find the Decidim community in [Matrix](https://app.element.io/#/room/#decidim:matrix.org). Community wants you working on things you're excited about 🔥.

## Did you find a bug?

* **Please, do not open up a GitHub issue if the bug is a security vulnerability**, and instead follow instructions in the dedicated [security guide](./SECURITY.md).

* **Ensure the bug was not already reported** by searching on GitHub under [Issues](https://github.com/OpenSourcePolitics/decidim-ditp/issues).

* If you're unable to find an open issue addressing the problem, [open a new one on the current repository](https://github.com/OpenSourcePolitics/decidim-ditp).

## Do you want to contribute on a patch or a feature ?
* [Fork this repository](https://github.com/OpenSourcePolitics/decidim-ditp/fork)
* Create a new branch on your fork
* Once your PR is ready, open a draft PR on our repository
* Once all checks are green (GG!), please mark your PR as "Ready for review".
* Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable.

## Do you intend to add a new feature or change an existing one?
* 🇫🇷 Please create a new feature proposal on our french open roadmap [here](https://club.decidim.opensourcepolitics.eu/assemblies/feuille-de-route/f/232/).
* 🌎 Create a proposal on the [Meta.decidim platform](https://meta.decidim.org/processes/roadmap/f/122/), to see if it can be accepted in the core of the software.

## Do you have questions about the Decidim's source code?

* Ask any question about how to use Decidim in [Matrix](https://app.element.io/#/room/#decidim:matrix.org).

## Do you want to contribute to Decidim documentation?

* Watch out the [Decidim Documentation repository](https://github.com/decidim/docs.decidim.org) and the [decidim.org](https://github.com/decidim/decidim.org) code website.
* 🇫🇷 For a translated guide of administration of our decidim-app, please refer to our open documentation [here](https://docs-decidim.opensourcepolitics.eu/).

## Do you want to contribute to Decidim design?

* Go to the [Decidim design folder](https://github.com/decidim/decidim/tree/master/decidim_app-design) and propose the changes that you want.

## Do you want to improve or add a new language for Decidim?
* Decidim use Crowdin as a translation tool, please check the project [here](https://crowdin.com/translate/decidim).
* If your language is not available (yet) 😱 , please create an issue for adding a new one on Crowndin ([example issue](https://github.com/decidim/decidim/issues/2073)).

Thanks! ❤️ ❤️ ❤️

Open Source Politics
54 changes: 54 additions & 0 deletions docs/GETTING_STARTED.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# 👋 Getting started with our decidim-app

### Requirements
- **Ruby** 2.7.5
- **Bundler** 2.3.13
- **PostgreSQL** 14+
- **Node** 16.9.1
- **npm** 7.21.1
- **yarn** 1.22.19
- **Imagemagick**
- **Chrome browser and chromedriver**

### Installation

1. Clone repository
```bash
git clone https://github.com/OpenSourcePolitics/decidim-ditp/
cd decidim-ditp
```

2. Install project dependencies

Install Ruby dependencies using `bundler` :

> bundle install

3. Setup database locally

Create the database, migrates and create seeds.

```
bundle exec rake db:create
bundle exec rake db:migrate
bundle exec rake db:seed
```

> **Warning**
> If rake command returns an error, ensure your PostgreSQL service is running : `lsof -i:5432`

4. Installing JS dependencies

We use `yarn` to install dependencies

> yarn install

5. **You should now be able to navigate locally !**

You can now start your server locally by executing `bundle exec rails s` and accessing URL http://localhost:3000/ 🎊

### Testing

Testing is very important, in the decidim-ditp we implement existing specs from Decidim to prevent regression. Then we update specs to match customizations made in repository.

If you want to execute specs you can setup your test environment `bundle exec rake test:setup` then use Rspec `bundle exec rspec spec`
42 changes: 42 additions & 0 deletions docs/HOMEPAGE_INTERACTIVE_MAP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Module Homepage Interactive Map

[This module](https://github.com/openSourcePolitics/decidim-module-homepage_interactive_map) displays an interactive map on homepage.

## Getting started

1. Install module
```
bundle install
```
2. Install webpacker dependencies

```
bundle exec rake decidim_homepage_interactive_map:webpacker:install
```

3. Install `proj` dependencies

**OSX using Homebrew**
```bash
brew install proj
bundle config set build.rgeo-proj4 --with-proj-dir="/opt/homebrew/"
bundle pristine rgeo-proj4
bundle install
```

**Ubuntu**
```bash
sudo apt update && sudo apt install libproj-dev proj-bin -y
PROJ_DIR=$(which proj) bundle config set build.rgeo-proj4 --with-proj-dir="${PROJ_DIR%proj}"
bundle pristine rgeo-proj4
bundle install
```

4. Repair data if already defined

```bash
bundle exec rake decidim_homepage_interactive_map:check_for_repair
bundle exec rake decidim_homepage_interactive_map:repair_data
```

🚀 Interactive map should be completely available in your Decidim application !
21 changes: 21 additions & 0 deletions docs/SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Security Policy

You found a potential vulnerability ? Please share with us following the steps below.

## Reporting a Vulnerability

Security is very important to us.

If you have any issue regarding security, please disclose the information
responsibly by sending an email to :

* security [at] opensourcepolitics [dot] eu

## Decidim is also concerned by this vulnerability ?

Please follow the [Decidim's security policy](https://github.com/decidim/decidim/blob/develop/SECURITY.adoc)

Thanks! :heart: :heart: :heart:

Open Source Politics

Loading