Skip to content

octree-gva/docker

 
 

Repository files navigation

Docker Hub

Decidim

The participatory democracy framework

Free Open-Source participatory democracy, citizen participation and open government for cities and organizations.
Explore the docs »

Join our Matrix.org chat rooms.

Features · Roadmap · Decidim on Docker: Report Bug · Propose New Features · Decidim main repository

Dockerhub

We publish daily three images, based on ubuntu:25.04.

Tag Description
latest Unstable development version. (alias for 0.31.0.dev)
0.30.0 Last version
0.29.3 Stable version, security and bug fixes only

Ready to mount a Decidim installation locally in 5min? Follow our 5min tutorial to setup Decidim with Docker locally.

Eject you decidim instance

You want to publish your instance on a git? You can copy all files of your decidim container in your local environment with docker cp

docker-compose up -d
docker cp decidim:/home/decidim ready-to-publish # Wait the command finishes!
cd ready-to-publish && git init
# Follow your git client instructions to upload this repo to github

Once ejected, you will have a Dockerfile and docker-compose ready to use on your ejected application.

Environments configurations

🔐: be sure to read the good practices ;)

Env Name Description Default
DECIDIM_SYSTEM_EMAIL Email use to access /system [email protected]
DECIDIM_SYSTEM_PASSWORD Password use to access /system my_insecure_password
SECRET_KEY_BASE 🔐 Secret used to initialize application's key generator my_insecure_password
RAILS_MASTER_KEY 🔐 Used to decrypt credentials file my_insecure_password
RAILS_FORCE_SSL If rails should force SSL false
RAILS_MAX_THREADS How many threads rails can use 5
RAILS_SERVE_STATIC_FILES If rails should be accountable to serve assets false
RAILS_ASSET_HOST If set, define the assets are loaded from (S3?) ``
SIDEKIQ_CONCURRENCY Concurrency for sidekiq worker. MUST be <= DATABASE_MAX_POOL_SIZE RAILS_MAX_THREADS
DATABASE_MAX_POOL_SIZE Max pool size for the database. RAILS_MAX_THREADS
DATABASE_URL Host for the postgres database. pg
TZ Timezone used Europe/Madrid
REDIS_URL Redis url for sidekiq redis
SMTP_AUTHENTICATION How rails should authenticate to SMTP plain, none
SMTP_USERNAME Username for SMTP [email protected]
SMTP_PASSWORD 🔐 Password for SMTP my_insecure_password
SMTP_ADDRESS SMTP address smtp.iredmail.org
SMTP_DOMAIN SMTP HELO Domain iredmail
SMTP_PORT SMTP address port 587
SMTP_STARTTLS_AUTO If TLS should start automatically enabled
SMTP_VERIFY_MODE How smtp certificates are verified none

All the DECIDIM_ variables are available. See the documentation on default environments variables.

Cron configurations

Cron is configured to run scripts every 15min, 1hour, daily, weekly, monthly. When the times comes, it will execute all scripts present in the /etc/periodic directory. By default, the following scripts are executed:

├── daily
│   └── change_active_steps.sh
│   ├── daily_digest.sh
│   ├── open_data_export.sh
│   └── reminders_all.sh
├── hourly
│   ├── compute_metrics.sh
│   └── delete_download_your_data_files.sh
├── monthly
└── weekly
    ├── clean_registration_forms.sh
    └── weekly_digest.sh

To configure this, you can copy this cron.d directory, change the scripts and map a volume. Carefull, these scripts need permission to be executed, don't forget to chmod +x any new scripts.

# Copy the container directory locally
docker cp decidim:/home/decidim/crontab.d crontab.d

And update your docker-compose:

    container_name: decidim
    image: decidim/decidim:latest
    ports:
      - 3000:3000
    volumes:
      - storage:/home/decidim/storage
+     - ./crontab.d:/etc/decidim/crontab.d
+   environment:
-   environment:    

If you don't use docker image to run your cron and prefer using a schedulder, you can get the commands in the crontab file

Entrypoints

Before running the docker command, we go through entrypoints scripts. Theses commands will run on each container restart:

  • 10_remove_pids: Remove old puma pids if exists.
  • 15_wait_for_it: Run a wait-for-it for dependancies: REDIS_URL, DATABASE_URL and MEMCACHE_SERVERS are supported.
  • 35_bundle_check: Check if all your gems are installed.
  • 36_db_check: Check if your database is up, and if not, try to migrate it.
  • 45_template: Set the motd file to have a welcome message that display current setup.
  • 50_upsert-sysadmin: From environment variables DECIDIM_SYSTEM_EMAIL and DECIDIM_SYSTEM_PASSWORD, update the first /system administrator.

Command

You can update your docker-compose command to whatever you want. It is common to see one of these:

  • bundle exec rails server -b 0.0.0.0: start a puma server.
  • bundle exec sidekiq: start a sidekiq worker.
  • cron start -f: start cron in forground.
  • sleep infinity: do nothing, and let you exec processes in the container with docker exec decidim.

Contribute

See CONTRIBUTING.md for more informations. PR are Welcome ❤️

Understand how it works

This repository automates publishing Decidim versions as Docker containers and generates documentation for using them.

Decidim Version Management

  • lib/decidim/decidim_version.rb: For a specific Decidim version, retrieve dependencies (Ruby, Node.js, Bundler) versions.
  • lib/docker/docker_image.rb: Match dependencies with the right ruby docker image.
  • lib/docker.rb: Provides Docker-related tasks and helpers.
  • lib/: Other supporting files and modules.

Docker Image Automation

  • bundle exec rake docker:build[version]: Builds Decidim Docker images for a given version (dev, last, or prev), using the Rake task.

Documentation Generation

  • bundle exec rake docker:docs: Automatically generates documentation from templates/ files.

DockerHub API ruby client

  • yarn dockerhub:update: Download last version of the DockerHub API definition and build a ruby client in contrib/.

Repository Structure

  • contrib/: Supporting files for nginx and docker-hub apis.
  • docker/: Docker context files, old aditional scripts like cron and entrypoints
  • docker/Dockerfile: Main dockerfile
  • lib/: Contains core classes and modules for version management and Docker image creation.
  • templates/: Holds ERB templates for Docker configurations and documentation.
  • Rakefile: Define the rake tasks of this repo.

License

This repository is under GNU AFFERO GENERAL PUBLIC LICENSE, V3.

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 97.9%
  • Other 2.1%