Platoniq / decidim-install

A step-by-step guide to install Decidim on a production site
https://platoniq.github.io/decidim-install/
GNU Affero General Public License v3.0
54 stars 35 forks source link

Further configurations when installed with docker #53

Closed jfoclpf closed 4 years ago

jfoclpf commented 4 years ago

I used docker to install decidim (here http://decidelisboa.org/), I know, with docker is only experimental.

Btw, one should run: nohup d/rails server --binding=0.0.0.0 >/dev/null 2>&1 &

to run the server as daemon on port 3000, it runs in background, still doesn't create nohup.out. I'd say you should update instructions accordingly.

I have though the following questions:

  1. Can you kindly tell me how do I set the email settings with Gmail. I read the instructions but I cannot find the file application.yml
  2. How do I change RAILS_ENV from development to production?
microstudi commented 4 years ago

If you want to run Decidim in Docker, I'd recommend to check sites using docker right now, for instances: https://github.com/AjuntamentDeSabadell/decidim-sabadell

Using nohub doesn't seem necessary to me but I might be missing something. When you say I should update instructions, where? I haven't tackled Docker installation yet.

These 2 questions are in the context of running Docker? I haven't tryied yet but I guess you should specifify those var in the Dockerfile

jfoclpf commented 4 years ago

@microstudi I must confess I'm quite a newby on docker + ruby on rails, I have much more experience in NodeJS or php, so I'm a bit lost.

According to the instructions of decidim to use docker, they say we must run at the end

d/rails server

This has two problems, according to what I think I undestood:

Using nohup was the solution I found, but I'm very happy to listen more reliable alternatives :)

jfoclpf commented 4 years ago

If you want to run Decidim in Docker, I'd recommend to check sites using docker right now, for instances: https://github.com/AjuntamentDeSabadell/decidim-sabadell

That is very case specific, and I find it hard to apply to the general case

These 2 questions are in the context of running Docker?

Yes

I haven't tryied yet but I guess you should specifify those var in the Dockerfile

Which file?

microstudi commented 4 years ago

Can you show the code you are using? I find really hard to understand what are you trying to do. Aren't you creating a Dockerfile? are you using docker-compose? why is so specifc that case? I found it very useful to be honest.

jfoclpf commented 4 years ago

These are the commands I run to install decidim with docker

cd /var
git clone https://github.com/decidim/decidim
cd decidim
d/bundle install
d/rake development_app
d/rails db:create db:migrate db:seed
SEED=true d/rails db:setup
nohup d/rails server --binding=0.0.0.0

Then I simply use nginx to forward on port 3000 and it works

Though I can't configure the email server

microstudi commented 4 years ago

all right, I though nohub was used inside the container. Yeah, that's a way to do it. Have you tryied the -d modificator for docker? Something like: d/rails server --binding=0.0.0.0 -d

I'd recommend using docker compose or similar however, just to have a better control.

jfoclpf commented 4 years ago

I tried

d/rails server --binding=0.0.0.0 -d

but it does not work, apparently it creates the daemon only inside the container.

But my issue now, is how to configure the email, I don't find the file application.yml

jfoclpf commented 4 years ago

Forget docker :) Finally I got it https://decidelisboa.org/

Btw, I confess I don't like to install all these files into home folder at ~/decidim-app. Do you see any issues by moving everything to /var/decidim-app?

Which links should I update?

jfoclpf commented 4 years ago

And just one final question, how do I install now the Portuguese version? https://github.com/mllocs/decidim-portugal Those instructions for me are Chinese :)

microstudi commented 4 years ago

you don't need to do anything special to install portugese version, just configure the language you want when creating you organization in the /system admin. If you want to change your current organization take a look at the guide https://platoniq.github.io/decidim-install/advanced-config/

And, yes you can move decidim-app wherever you want, I just find having it at home more consistent as (in this guide) it uses rb-env which is a user space ruby manager. In your case, using docker is different.

jfoclpf commented 4 years ago

I will check that link, but when I created an organisation in the system admin panel just English, Castilian and Catalan were available

jfoclpf commented 4 years ago

I tried now to follow those instructions in that link but when I had Portuguese I get a 500 internal server error.

microstudi commented 4 years ago

Add the languages available in initializers/decidim.rb (including Portuguese) and create a new organization with only Portuguese (rename host of the old organization to avoid collision). That should do the trick.

jfoclpf commented 4 years ago

The file initializers/decidim.rb already has Portuguese, this is the full file

# frozen_string_literal: true

Decidim.configure do |config|
  config.application_name = "My Application Name"
  config.mailer_sender = "change-me@domain.org"

  # Change these lines to set your preferred locales
  config.default_locale = :en
  config.available_locales = [:en, :ca, :es, :pt]

  # Geocoder configuration
  # config.geocoder = {
  #   static_map_url: "https://image.maps.ls.hereapi.com/mia/1.6/mapview",
  #   here_api_key: Rails.application.secrets.geocoder[:here_api_key]
  # }

  # Custom resource reference generator method
  # config.reference_generator = lambda do |resource, component|
  #   # Implement your custom method to generate resources references
  #   "1234-#{resource.id}"
  # end

  # Currency unit
  # config.currency_unit = "€"

  # The number of reports which an object can receive before hiding it
  # config.max_reports_before_hiding = 3

  # Custom HTML Header snippets
  #
  # The most common use is to integrate third-party services that require some
  # extra JavaScript or CSS. Also, you can use it to add extra meta tags to the
  # HTML. Note that this will only be rendered in public pages, not in the admin
  # section.
  #
  # Before enabling this you should ensure that any tracking that might be done
  # is in accordance with the rules and regulations that apply to your
  # environment and usage scenarios. This component also comes with the risk
  # that an organization's administrator injects malicious scripts to spy on or
  # take over user accounts.
  #
  config.enable_html_header_snippets = false

  # SMS gateway configuration
  #
  # If you want to verify your users by sending a verification code via
  # SMS you need to provide a SMS gateway service class.
  #
  # An example class would be something like:
  #
  # class MySMSGatewayService
  #   attr_reader :mobile_phone_number, :code
  #
  #   def initialize(mobile_phone_number, code)
  #     @mobile_phone_number = mobile_phone_number
  #     @code = code
  #   end
  #
  #   def deliver_code
  #     # Actual code to deliver the code
  #     true
  #   end
  # end
  #
  # config.sms_gateway_service = "MySMSGatewayService"

  # Timestamp service configuration
  #
  # Provide a class to generate a timestamp for a document. The instances of
  # this class are initialized with a hash containing the :document key with
  # the document to be timestamped as value. The istances respond to a
  # timestamp public method with the timestamp
  #
  # An example class would be something like:
  #
  # class MyTimestampService
  #   attr_accessor :document
  #
  #   def initialize(args = {})
  #     @document = args.fetch(:document)
  #   end
  #
  #   def timestamp
  #     # Code to generate timestamp
  #     "My timestamp"
  #   end
  # end
  #
  # config.timestamp_service = "MyTimestampService"

  # PDF signature service configuration
  #
  # Provide a class to process a pdf and return the document including a
  # digital signature. The instances of this class are initialized with a hash
  # containing the :pdf key with the pdf file content as value. The instances
  # respond to a signed_pdf method containing the pdf with the signature
  #
  # An example class would be something like:
  #
  # class MyPDFSignatureService
  #   attr_accessor :pdf
  #
  #   def initialize(args = {})
  #     @pdf = args.fetch(:pdf)
  #   end
  #
  #   def signed_pdf
  #     # Code to return the pdf signed
  #   end
  # end
  #
  # config.pdf_signature_service = "MyPDFSignatureService"

  # Etherpad configuration
  #
  # Only needed if you want to have Etherpad integration with Decidim. See
  # Decidim docs at docs/services/etherpad.md in order to set it up.
  #
  # config.etherpad = {
  #   server: Rails.application.secrets.etherpad[:server],
  #   api_key: Rails.application.secrets.etherpad[:api_key],  #   api_version: Rails.application.secrets.etherpad[:api_version]
  # }

  if ENV["HEROKU_APP_NAME"].present?
    config.base_uploads_path = ENV["HEROKU_APP_NAME"] + "/"
  end
end

Rails.application.config.i18n.available_locales = Decidim.available_locales
Rails.application.config.i18n.default_locale = Decidim.default_locale

but when I create a new organisation just English, Castilian and Catalan appear

Screenshot_20200621-154317_Samsung Internet

microstudi commented 4 years ago

Is this the file read by docker? you need to modify the file that docker is reading and then restart the server

jfoclpf commented 4 years ago

It is solved, I eventually did not user docker

I had to restart engine

sudo service nginx restart