GithubHelp home page GithubHelp logo

larueli / decidim-nonroot Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 3.0 59 KB

Decidim container - nonroot / suitable for OpenShift, all decidim modules installed + initatives, conferences consultations

License: MIT License

Dockerfile 66.86% Shell 33.14%
openshift okd kubernetes decidim democracy docker nginx ssl smtp oauth2 container hacktoberfest

decidim-nonroot's Introduction

Build Status

Decidim on Docker

You'll find here the files used to build my Docker image for decidim, free Open-Source participatory democracy for cities and organizations.

Features

  • All official decidim modules installed

including optional decidim-consultations and decidim-initiatives and decidim-conferences

  • Able to run as non root user (must be root group), so works in OKD/OpenShift
  • Latest decidim version (check tags)
  • Various omniauth strategies added (facebook, twitter, twitter, keycloak, openid, saml)
  • Ability to run your init scripts before starting the server
  • Bundled with docker-compose-wait which allow to wait for db to start

How does it work ?

You can use the provided docker-compose.yml file to see how the container works. Make sure to set the env var RAILS_SERVE_STATIC_FILES to true and the RAILS_ENV to production !

This image exposes port 3000 (no ssl, you have to provide SSL by yourself with a reverse proxy), and has two volumes /decidim-app/config and /decidim-app/public/uploads. You can simply edit your config inside your container and restart it in order to take effect.

You can put your scripts with a volume mounted on /docker-entrypoint-initdecidim.d

After deployment

  1. You can create an admin from the terminal
bin/rails console
> email = "[email protected]"
> password = "mystrongpassword"
> user = Decidim::System::Admin.new(email: email, password: password, password_confirmation: password)
> user.save!
  1. You can configure it as you wish ! The decidim doc about installation and configuration is very complete.

FAQ

ERROR Access denied at boot of container

Make sure all the config volume of decidim is owned by the user running in the container (10520 in the docker-compose example). To be sure, run

sudo chown -R 10520 /var/lib/docker/volumes/decidim-nonroot_decidim-config/_data

I don't have any assets (css, js, ...) served !

Make sure the decidim container has the env var RAILS_SERVE_STATIC_FILES set to true and the RAILS_ENV set to production

More info about the image

You can check my DockerHub repo.

Author

I am Ivann LARUELLE, engineering student in Networks & Telecommunications at the Université de Technologie de Troyes in France, which is a public engineering university.

This tool was made for the students, as I am a student representative, and in collaboration with the UTT Net Group, an non profit organization which aims to provide IT Service to all UTT students and student organizations.

Contact me for any issue : ivann[at]laruelle.me

Licence

MIT

decidim-nonroot's People

Contributors

larueli avatar xdubx avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

decidim-nonroot's Issues

Decidim initiatives error

Hello, there seems to be a problem with decidim initiatives. When a new user register there is an 500 error related to a column not found in database. After this, decidim does not recorvers. Is this happening to you?

Completed 500 Internal Server Error in 46ms (ActiveRecord: 2.5ms)
Error during failsafe response: PG::UndefinedColumn: ERROR: column decidim_initiatives.decidim_author_type does not exist
LINE 1: ...m_initiatives".* FROM "decidim_initiatives" WHERE "decidim_i...

Thank you.

Strange behaviour after launch

Hi!

I'm finding strange that after creating an organization I just see three items in admin panel and if as an end user try to go to "Initiatives" I get an error:

ActionView::Template::Error (PG::UndefinedColumn: ERROR: column decidim_initiatives.decidim_author_type does not exist
LINE 1: ...m_initiatives".* FROM "decidim_initiatives" WHERE "decidim_i...

Screenshot from 2020-10-15 19-56-00

Any ideas?
Thank you

Can't launch decidim - message_encryptor openssl::cipher error

Hello, first of all, thanks a lot for this repo, it looks promising and should help with docker deployment of decidim !

I cloned your repo and built my own image (didn't change anything in your files). Build went ok, but once docker runs decidim container, it is stuck on this error :

/usr/local/bundle/ruby/2.6.0/gems/activesupport-5.2.4.3/lib/active_support/message_encryptor.rb:201:in `final': OpenSSL::Cipher::CipherError
	from /usr/local/bundle/ruby/2.6.0/gems/activesupport-5.2.4.3/lib/active_support/message_encryptor.rb:201:in `_decrypt`
	from /usr/local/bundle/ruby/2.6.0/gems/activesupport-5.2.4.3/lib/active_support/message_encryptor.rb:157:in `decrypt_and_verify`
	from /usr/local/bundle/ruby/2.6.0/gems/activesupport-5.2.4.3/lib/active_support/messages/rotator.rb:21:in `decrypt_and_verify`
	from /usr/local/bundle/ruby/2.6.0/gems/activesupport-5.2.4.3/lib/active_support/encrypted_file.rb:79:in `decrypt`
	from /usr/local/bundle/ruby/2.6.0/gems/activesupport-5.2.4.3/lib/active_support/encrypted_file.rb:42:in `read`
	from /usr/local/bundle/ruby/2.6.0/gems/activesupport-5.2.4.3/lib/active_support/encrypted_configuration.rb:21:in `read`
	from /usr/local/bundle/ruby/2.6.0/gems/activesupport-5.2.4.3/lib/active_support/encrypted_configuration.rb:33:in `config`
	from /usr/local/bundle/ruby/2.6.0/gems/activesupport-5.2.4.3/lib/active_support/encrypted_configuration.rb:38:in `options`
	from /usr/local/bundle/ruby/2.6.0/gems/activesupport-5.2.4.3/lib/active_support/core_ext/module/delegation.rb:271:in `method_missing`
	from /usr/local/bundle/ruby/2.6.0/gems/devise-4.7.3/lib/devise/secret_key_finder.rb:24:in `key_exists?`
	from /usr/local/bundle/ruby/2.6.0/gems/devise-4.7.3/lib/devise/secret_key_finder.rb:10:in `find`
	from /usr/local/bundle/ruby/2.6.0/gems/devise-4.7.3/lib/devise/rails.rb:37:in `block in <class:Engine>`
	from /usr/local/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/initializable.rb:32:in `instance_exec`
	from /usr/local/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/initializable.rb:32:in `run`
	from /usr/local/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/initializable.rb:61:in `block in run_initializers`
	from /usr/local/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each`
	from /usr/local/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component`
	from /usr/local/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from`
	from /usr/local/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component`
	from /usr/local/lib/ruby/2.6.0/tsort.rb:347:in `each`
	from /usr/local/lib/ruby/2.6.0/tsort.rb:347:in `call`
	from /usr/local/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component`
	from /usr/local/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each`
	from /usr/local/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each`
	from /usr/local/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/initializable.rb:60:in `run_initializers`
	from /usr/local/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/application.rb:361:in `initialize!`
	from /decidim-app/config/environment.rb:5:in `<main>`
	from /usr/local/bundle/ruby/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require`
	from /usr/local/bundle/ruby/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi`
	from /usr/local/bundle/ruby/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register`
	from /usr/local/bundle/ruby/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi`
	from /usr/local/bundle/ruby/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require`
	from /usr/local/bundle/ruby/2.6.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `block in require`
	from /usr/local/bundle/ruby/2.6.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:257:in `load_dependency`
	from /usr/local/bundle/ruby/2.6.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `require`
	from /usr/local/bundle/ruby/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:48:in `require_relative`
	from config.ru:3:in `block in <main>`
	from /usr/local/bundle/ruby/2.6.0/gems/rack-2.2.2/lib/rack/builder.rb:116:in `eval`
	from /usr/local/bundle/ruby/2.6.0/gems/rack-2.2.2/lib/rack/builder.rb:116:in `new_from_string`
	from /usr/local/bundle/ruby/2.6.0/gems/rack-2.2.2/lib/rack/builder.rb:105:in `load_file`
	from /usr/local/bundle/ruby/2.6.0/gems/rack-2.2.2/lib/rack/builder.rb:66:in `parse_file`
	from /usr/local/bundle/ruby/2.6.0/gems/rack-2.2.2/lib/rack/server.rb:349:in `build_app_and_options_from_config`
	from /usr/local/bundle/ruby/2.6.0/gems/rack-2.2.2/lib/rack/server.rb:249:in `app`
	from /usr/local/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/commands/server/server_command.rb:27:in `app`
	from /usr/local/bundle/ruby/2.6.0/gems/rack-2.2.2/lib/rack/server.rb:422:in `wrapped_app`
	from /usr/local/bundle/ruby/2.6.0/gems/rack-2.2.2/lib/rack/server.rb:312:in `block in start`
	from /usr/local/bundle/ruby/2.6.0/gems/rack-2.2.2/lib/rack/server.rb:379:in `handle_profiling`
	from /usr/local/bundle/ruby/2.6.0/gems/rack-2.2.2/lib/rack/server.rb:311:in `start`
	from /usr/local/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/commands/server/server_command.rb:53:in `start`
	from /usr/local/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/commands/server/server_command.rb:147:in `block in perform`
	from /usr/local/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/commands/server/server_command.rb:142:in `tap`
	from /usr/local/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/commands/server/server_command.rb:142:in `perform`
	from /usr/local/bundle/ruby/2.6.0/gems/thor-1.0.1/lib/thor/command.rb:27:in `run`
	from /usr/local/bundle/ruby/2.6.0/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command`
	from /usr/local/bundle/ruby/2.6.0/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch`
	from /usr/local/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/command/base.rb:69:in `perform`
	from /usr/local/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/command.rb:46:in `invoke`
	from /usr/local/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/commands.rb:18:in `<main>`
	from /usr/local/bundle/ruby/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require`
	from /usr/local/bundle/ruby/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi`
	from /usr/local/bundle/ruby/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register`
	from /usr/local/bundle/ruby/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi`
	from /usr/local/bundle/ruby/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require`
	from /usr/local/bundle/ruby/2.6.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `block in require`
	from /usr/local/bundle/ruby/2.6.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:257:in `load_dependency`
	from /usr/local/bundle/ruby/2.6.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `require`
	from bin/rails:4:in `<main>`
Exiting

Any help would be greatly appreciated :)

Dockerfile Build Error

Hey,
i tryed to build the container for myself. This error comes by docker.

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/usr/local/bundle/ruby/2.6.0/gems/unf_ext-0.0.7.7/ext/unf_ext
/usr/local/bin/ruby -I /usr/local/lib/ruby/2.6.0 -r
./siteconf20201109-13571-lydyl8.rb extconf.rb
checking for -lstdc++... yes
creating Makefile

current directory: /usr/local/bundle/ruby/2.6.0/gems/unf_ext-0.0.7.7/ext/unf_ext
make "DESTDIR=" clean

current directory: /usr/local/bundle/ruby/2.6.0/gems/unf_ext-0.0.7.7/ext/unf_ext
make "DESTDIR="
compiling unf.cc
cc1plus: warning: command line option '-Wdeclaration-after-statement' is valid
for C/ObjC but not for C++
cc1plus: warning: command line option '-Wimplicit-function-declaration' is valid
for C/ObjC but not for C++
cc1plus: warning: command line option '-Wimplicit-int' is valid for C/ObjC but
not for C++
virtual memory exhausted: Cannot allocate memory
make: *** [Makefile:213: unf.o] Error 1

make failed, exit code 2

Gem files will remain installed in
/usr/local/bundle/ruby/2.6.0/gems/unf_ext-0.0.7.7 for inspection.
Results logged to
/usr/local/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/unf_ext-0.0.7.7/gem_make.out

An error occurred while installing unf_ext (0.0.7.7), and Bundler cannot
continue.
Make sure that `gem install unf_ext -v '0.0.7.7' --source
'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  decidim-dev was resolved to 0.22.0, which depends on
    decidim was resolved to 0.22.0, which depends on
      decidim-accountability was resolved to 0.22.0, which depends on
        decidim-comments was resolved to 0.22.0, which depends on
          decidim-core was resolved to 0.22.0, which depends on
            etherpad-lite was resolved to 0.3.0, which depends on
              rest-client was resolved to 2.1.0, which depends on
                http-cookie was resolved to 1.0.3, which depends on
                  domain_name was resolved to 0.5.20190701, which depends on
                    unf was resolved to 0.1.4, which depends on
                      unf_ext
        gsub  config/boot.rb
      append  .gitignore
      remove  public/404.html
      remove  public/500.html
      create  config/initializers/decidim.rb
       route  mount Decidim::Core::Engine => '/'
      append  db/seeds.rb
      create  config/initializers/carrierwave.rb
      create  config/initializers/social_share_button.rb
      create  config/secrets.yml
      remove  app/views/layouts/application.html.erb
      remove  app/views/layouts/mailer.text.erb
      append  app/assets/javascripts/application.js
        gsub  app/assets/javascripts/application.js
      insert  app/assets/stylesheets/application.css
      create  app/assets/stylesheets/decidim.scss
      insert  config/environments/development.rb
      insert  config/environments/test.rb
        gsub  config/environments/production.rb
      insert  config/environments/production.rb
/usr/local/bundle/gems/bundler-2.1.4/lib/bundler/resolver.rb:290:in `block in verify_gemfile_dependencies_are_found!': Could not find gem 'decidim (= 0.22.0)' in any of the gem sources listed in your Gemfile. (Bundler::GemNotFound)
	from /usr/local/bundle/gems/bundler-2.1.4/lib/bundler/resolver.rb:258:in `each'
	from /usr/local/bundle/gems/bundler-2.1.4/lib/bundler/resolver.rb:258:in `verify_gemfile_dependencies_are_found!'
	from /usr/local/bundle/gems/bundler-2.1.4/lib/bundler/resolver.rb:49:in `start'
	from /usr/local/bundle/gems/bundler-2.1.4/lib/bundler/resolver.rb:22:in `resolve'
	from /usr/local/bundle/gems/bundler-2.1.4/lib/bundler/definition.rb:258:in `resolve'
	from /usr/local/bundle/gems/bundler-2.1.4/lib/bundler/definition.rb:170:in `specs'
	from /usr/local/bundle/gems/bundler-2.1.4/lib/bundler/definition.rb:237:in `specs_for'
	from /usr/local/bundle/gems/bundler-2.1.4/lib/bundler/definition.rb:226:in `requested_specs'
	from /usr/local/bundle/gems/bundler-2.1.4/lib/bundler/runtime.rb:101:in `block in definition_method'
	from /usr/local/bundle/gems/bundler-2.1.4/lib/bundler/runtime.rb:20:in `setup'
	from /usr/local/bundle/gems/bundler-2.1.4/lib/bundler.rb:149:in `setup'
	from /usr/local/bundle/gems/bundler-2.1.4/lib/bundler/setup.rb:20:in `block in <top (required)>'
	from /usr/local/bundle/gems/bundler-2.1.4/lib/bundler/ui/shell.rb:136:in `with_level'
	from /usr/local/bundle/gems/bundler-2.1.4/lib/bundler/ui/shell.rb:88:in `silence'
	from /usr/local/bundle/gems/bundler-2.1.4/lib/bundler/setup.rb:20:in `<top (required)>'
	from /usr/local/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /usr/local/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /decidim-app/config/boot.rb:3:in `<top (required)>'
	from bin/rails:3:in `require_relative'
	from bin/rails:3:in `<main>'
The command '/bin/sh -c apt-get update && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - &&     echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list &&     apt-get update && apt-get install -y nodejs imagemagick yarn libicu-dev postgresql-client openssl nano bash curl git && apt-get autoremove &&     mkdir -m 770 /home/docker-user &&     gem install bundler && gem install bootsnap && gem install listen && mkdir -m 770 /decidim-app && gem install decidim -v ${DECIDIM_VERSION} && decidim /decidim-app' returned a non-zero code: 1

Can't launch server

Hi! First of all thank you, I haven't found anything on how to run Decidim on openshift.

I'm having trouble running your built image, I think is related to permissions in decidim_app folder, nginx and passport.

I've also tried to build the image myself and i'm getting an error on:

  • chmod -R g=rwx /usr/local/bundle/gems/omniauth-cas* (that folder does not exist)
  • nginx: [alert] Unable to start Phusion Passenger: Support binary PassengerAgent not found

Could you help me?
Thank you!

[EDIT]
This error "Unable to start Phusion Passenger" was caused by wrong passenger version in nginx.conf. Changing to 6.0.6 gives me a new error in the browser:

Incomplete response received from application

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.