103 lines
3.8 KiB
ReStructuredText
103 lines
3.8 KiB
ReStructuredText
Decidim
|
|
=======
|
|
|
|
Overview
|
|
--------
|
|
|
|
Decidim is a participatory democracy platform for cities and organizations. Decidim is written
|
|
and runs on Ruby 2.7, where it is installed as Ruby Gem (i.e. not compiled from source).
|
|
Incoming HTTP requests are handled via passenger nginx plugin.
|
|
|
|
Upstream URL: https://github.com/decidim/decidim
|
|
|
|
|
|
Custom fonts
|
|
------------
|
|
|
|
The image is distributed with custom version of *Source Sans Pro* font support for latin-ext
|
|
characters included (i.e. diactitics). The original upstream version of the font omits
|
|
these characters in order ta minimize the load times in web browsers.
|
|
|
|
|
|
Database upgrades
|
|
-----------------
|
|
|
|
Decidim creates a series of database migration scripts under ``db/migrate`` directory.
|
|
Unfortunately, these script are not created deterministically as their file names are always
|
|
created with current build's timestamp. The same script using the same Decidim version therefore
|
|
always ends up with different database migration scripts. Newly added scripts in a new
|
|
version of Decidim are not sorted at the end, so it's impossible to determine which scripts
|
|
need to applied from the filenames alone. The ``db/migrate`` directory is therefore stored
|
|
on a persisten sotrage outside of the container to ensure that only the new database migration
|
|
will be applied whenever the container is upgraded to a newer version of Decidim image.
|
|
|
|
|
|
Additional site creation
|
|
------------------------
|
|
|
|
Decidim allows to create managed sites using the superadmin interface on
|
|
``https://<Decidim URL>/system/``. The sites require their own (sub)domains,therefore some
|
|
additional considerations must be taken when setting up HTTP reverse proxies and TLS certificates.
|
|
|
|
|
|
Rails environment
|
|
-----------------
|
|
|
|
Rails ``RAILS_ENV`` environment variable is set to ``production`` by default.
|
|
This requires connection via HTTPS as there are redirects hardcoded in the Decidim application
|
|
or its dependencies with enforce this behavior whenewer the ``RAILS_ENV`` is ``production``.
|
|
The varaible can be changed to ``development`` in the docker-compose ``.env`` file, however
|
|
the full development environment experience is not ensured by the current setup and some additional
|
|
manual steps may be needed in order to use full potential of the development the environment.
|
|
|
|
The application offers a console accessible via
|
|
|
|
.. code-block:: bash
|
|
|
|
cd /srv/decidim-app
|
|
bin/rails console
|
|
|
|
The console loads the application environment and allows to work with Decidim via CLI. This is used
|
|
by the docker entrypoint to ensure the superadmin credentials are always set according to
|
|
the respective environment variables.
|
|
|
|
.. code-block:: ruby
|
|
|
|
Decidim::System::Admin.find_or_initialize_by(id: 1).update!(
|
|
email: ENV["DECIDIM_ADMIN_USER"],
|
|
password: ENV["DECIDIM_ADMIN_PASSWORD"],
|
|
password_confirmation: ENV["DECIDIM_ADMIN_PASSWORD"]
|
|
)
|
|
|
|
|
|
Development without docker-compose
|
|
----------------------------------
|
|
|
|
.. code-block:: bash
|
|
|
|
rm -rf ~/postgres_data
|
|
mkdir ~/postgres_data
|
|
podman run -it --rm \
|
|
--env "POSTGRES_USER=decidim" \
|
|
--env "POSTGRES_PASSWORD=decidim" \
|
|
--env "POSTGRES_DB=decidim" \
|
|
--volume ~/postgres_data:/var/lib/postgresql/data \
|
|
--ip 10.88.0.2 \
|
|
docker.io/postgres:14-alpine
|
|
|
|
.. code-block:: bash
|
|
|
|
podman build -t decidim:latest decidim
|
|
|
|
rm -rf ~/decidim_{migrate,storage,uploads}
|
|
mkdir ~/decidim_{migrate,storage,uploads}
|
|
podman run -it --rm \
|
|
--env-file .env \
|
|
--env "DATABASE_URL=postgres://decidim:decidim@decidim-postgres/decidim" \
|
|
--volume ~/decidim_migrate:/srv/decidim-app/db/migrate \
|
|
--volume ~/decidim_storage:/srv/decidim-app/storage \
|
|
--volume ~/decidim_uploads:/srv/decidim-app/public/uploads \
|
|
--add-host decidim-postgres:10.88.0.2 \
|
|
--ip 10.88.0.3 \
|
|
decidim:latest
|