Skip to content

Commit

Permalink
chore: Update README and schema.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentinchampenois committed Jun 10, 2024
1 parent b49adfc commit 15d12a9
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 124 deletions.
152 changes: 29 additions & 123 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,137 +1,43 @@
# Decidim app by OSP
# Decidim Lyon by OSP
[![codecov](https://codecov.io/gh/OpenSourcePolitics/decidim-app/branch/master/graph/badge.svg?token=VDQ3ORQLN6)](https://codecov.io/gh/OpenSourcePolitics/decidim-app)
[![Maintainability](https://api.codeclimate.com/v1/badges/f5abcda931760d6ee65d/maintainability)](https://codeclimate.com/github/OpenSourcePolitics/decidim-app/maintainability)
![Tests](https://github.com/OpenSourcePolitics/decidim-app/actions/workflows/deploy_production.yml/badge.svg?branch=master)
![Tests](https://github.com/OpenSourcePolitics/decidim-app/actions/workflows/tests.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.
## [Open Source Politics](https://opensourcepolitics.eu/)
![Open Source Politics](./docs/open-source-politics.svg)

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)
This repository contains the code of the **decidim-app** implemented for our customers.

Each Terraform deployment are stored in the **deploy** folder and sorted by providers
It consists of the main application with modules developed by the community that we often use.

Feel free to add new deployments!
It includes **official modules** supported by the community and **community-based modules** developed by us our [our partners](https://github.com/decidim-ice)

## Availables deployments
## 🚀 Getting started
- See our [installation guide](./docs/GETTING_STARTED.md) to run a decidim-lyon by OSP locally
- See our [Docker installation guide](./docs/GETTING_STARTED_DOCKER.md) to run a decidim-lyon by OSP locally with Docker
- See our [homepage interactive map module](./docs/HOMEPAGE_INTERACTIVE_MAP.md) to configure module (OSX/Ubuntu)

- [Scaleway](https://github.com/OpenSourcePolitics/decidim-app/tree/develop/deploy/providers/scaleway)
- [DigitalOcean](https://github.com/OpenSourcePolitics/decidim-app/tree/develop/deploy/providers/digitalocean/)
## Modules

## 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.

- To use Scaleway's provider

```bash
export SCW_ACCESS_KEY=<your_access_key>
export SCW_TOKEN=<your_scw_token>
export SCW_DEFAULT_PROJECT_ID=<id_of_your_project/organization>
```

- 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>
```

## 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
* Paper ballots
You can test it by creating a CSV file like :
```csv
id;paper_ballots_to_import
6;550
```
### 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
```
## 👋 Contributing
- See our [contributing guide](./docs/CONTRIBUTING.md)

## Database architecture (ERD)
## 🔒 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.

![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.
11 changes: 10 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2024_06_05_102503) do
ActiveRecord::Schema.define(version: 2024_06_10_143056) do

# These are extensions that must be enabled in order to support this database
enable_extension "ltree"
Expand Down Expand Up @@ -395,6 +395,14 @@
t.index ["decidim_user_id"], name: "index_decidim_budgets_orders_on_decidim_user_id"
end

create_table "decidim_budgets_paper_ballot_results", force: :cascade do |t|
t.integer "votes", null: false
t.bigint "decidim_project_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["decidim_project_id"], name: "index_decidim_paper_ballot_on_project"
end

create_table "decidim_budgets_projects", id: :serial, force: :cascade do |t|
t.jsonb "title"
t.jsonb "description"
Expand Down Expand Up @@ -1870,6 +1878,7 @@
add_foreign_key "decidim_awesome_editor_images", "decidim_users", column: "decidim_author_id"
add_foreign_key "decidim_budgets_budgets", "decidim_scopes"
add_foreign_key "decidim_budgets_orders", "decidim_budgets_budgets"
add_foreign_key "decidim_budgets_paper_ballot_results", "decidim_budgets_projects", column: "decidim_project_id"
add_foreign_key "decidim_budgets_projects", "decidim_budgets_budgets"
add_foreign_key "decidim_categorizations", "decidim_categories"
add_foreign_key "decidim_comparative_stats_endpoints", "decidim_organizations"
Expand Down

0 comments on commit 15d12a9

Please sign in to comment.