OpenSourcePolitics / decidim-nyc

Decidim instance for New York City
https://www.participate.nyc.gov/
GNU Affero General Public License v3.0
1 stars 2 forks source link
hacktoberfest

Decidim app by OSP

Citizen Participation and Open Government application based on Decidim.

This application is maintained by Open Source Politics. Some non official customizations can be found see OVERLOADS.MD.

Installation guide

Once repository is cloned, you can now install dependencies, fetch external migrations and migrate

We created a rake task to install automatically the dependencies

Execute command :

bundle exec rake decidim_app:setup

Otherwise follow these steps :

  1. Install dependencies
bundle install
  1. Install Decidim Awesome dependencies

    bundle exec rails decidim_decidim_awesome:install:migrations
    bundle exec rails decidim_decidim_awesome:webpacker:install
  2. Install Homepage Interactive Map dependencies

    bundle exec rake decidim_homepage_interactive_map:install:migrations
  3. Install Term Customizer dependencies

    bundle exec rails decidim_term_customizer:install:migrations
  4. Install migrations

bundle exec rake db:migrate

All dependencies should be now installed and ready-to-use !

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

IMPORTANT! : You must ensure all environnement variables are defined, see .env-example

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 :

An environment running the current Decidim version (from Gemfile) without any data.

make start-clean-decidim

An environment running the current Decidim version (from Gemfile) with generated seeds

make start-seeded-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 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 :

Make commands are available to help you troubleshoot your Docker environment

Deploy with Terraform

Terraform is an open-source infrastructure as code software tool that provides an easy deployment of your infrastructure for installing Decidim.

Many providers are available (AWS, Heroku, DigitalOcean...). Check the Terraform registry to see how to use Terraform with your provider

Each Terraform deployment are stored in the deploy folder and sorted by providers

Feel free to add new deployments!

Availables deployments

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.

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

How to deploy with Terraform?

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

make deploy-scw

Database architecture (ERD)

Architecture_decidim