Skip to content

octree-gva/docker

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

Stable tags

:0.27,:0.28,:0.29

Development tags

:nightly

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/app 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:

├── 15min
│   └── change_active_steps.sh
├── daily
│   ├── 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:/etc/periodic crontab.d

And update your docker-compose:

    container_name: decidim
    image: decidim/decidim:latest
    ports:
      - 3000:3000
    volumes:
      - storage:/home/decidim/app/storage
+     - ./crontab.d:/etc/periodic
+   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:

  • 05_clean_history: Clean all bash and irb history from the container.
  • 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, and your migrations are up.
  • 45_template: Set the motd file to have a nice welcome message.
  • 50_upsert-sysadmin: Check your DECIDIM_SYSTEM_EMAIL and DECIDIM_SYSTEM_PASSWORD and 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.

Extend Decidim Images

Let say you want to use official image, but a binary is missing. For the sake of the example, let's add restic a binary to manage encrypted backups.

# Your new custom image
FROM decidim:0.29.1-onbuild
RUN apk --update --no-cache restic
# You are done, restic is now available in your image.

Run Decidim in development/test mode

The docker-compose docker-compose.NAME_YOUR_VERSION.dev.yml allows you to run decidim in development or test mode. They are larger images, and are not suited for production usage.

Contribute

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

How Does It Works

This repository is designed to automate the publication of Decidim versions using Docker containers, along with generating documentation to use these containers.

Decidim Version Management

  • lib/decidim_version.rb: For a specific Decidim version, retrieve dependancies (Ruby, Node.js, Bundler) versions.
  • lib/docker_image.rb: Match dependancies with the right ruby docker image

Docker Image Automation

  • update-registry.rb: Manages Docker images by building, tagging, and optionally pushing them to a Docker registry. It utilizes ERB templates to generate Docker-related files dynamically.
  • lib/helpers.rb: Utility function to manage images.

Documentation Generation

  • update-documentation.rb: Automatically generates documentation for each supported Decidim version. It uses ERB templates to create version-specific docker-compose files and a README.md, outlining available Docker images and setup instructions.

Repository Structure

  • lib/: Contains core classes and modules for version management and Docker image creation.
  • templates/: Holds ERB templates for Docker configurations and documentation.
  • Scripts: update-registry.rb and update-documentation.rb automate Docker image management and documentation generation.

License

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

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 39.9%
  • HTML 28.3%
  • Dockerfile 18.7%
  • Shell 13.1%