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

can't acces to system admin pages (redirection loop) #61

Closed ecologistas closed 4 years ago

ecologistas commented 4 years ago

Hello Platoniq! We have read your guide and other docs to install Decidim in our server (Debian 8, Apache, PostgreSQL) and we have a "redirection loop" in the system admin page. So we don't have access to the dashboard and we cannot create an organization. Could you help us to find a solution?

This is the error in production.log. Thanks in advance!

I, [2020-07-23T13:41:31.316624 #21599] INFO -- : [10915ed8-4694-43bb-818a-8b6614ba9c42] Processing by Decidim::ErrorsController#internal_server_error as / I, [2020-07-23T13:41:31.317024 #21599] INFO -- : [10915ed8-4694-43bb-818a-8b6614ba9c42] Redirected to http://participa.ecologistasenaccion.org/system/ I, [2020-07-23T13:41:31.317076 #21599] INFO -- : [10915ed8-4694-43bb-818a-8b6614ba9c42] Filter chain halted as :verify_organization rendered or redirected I, [2020-07-23T13:41:31.317224 #21599] INFO -- : [10915ed8-4694-43bb-818a-8b6614ba9c42] Completed 302 Found in 1ms (ActiveRecord: 0.0ms) I, [2020-07-23T13:41:31.357115 #21599] INFO -- : [e34b59c4-06be-49df-9fc4-b14cceeefbca] Started GET "/system/" for 34.254.186.153 at 2020-07-23 13:41:31 +0200 D, [2020-07-23T13:41:31.358199 #21599] DEBUG -- : [e34b59c4-06be-49df-9fc4-b14cceeefbca] Decidim::Organization Load (0.3ms) SELECT "decidim_organizations". FROM "decidim_organizations" WHERE "decidim_organizations"."host" = $1 LIMIT $2 [["host", "participa.ecologistasenaccion.org"], ["LIMIT", 1]] D, [2020-07-23T13:41:31.359279 #21599] DEBUG -- : [e34b59c4-06be-49df-9fc4-b14cceeefbca] Decidim::Organization Load (0.4ms) SELECT "decidim_organizations". FROM "decidim_organizations" WHERE ('participa.ecologistasenaccion.org' = ANY(secondary_hosts)) LIMIT $1 [["LIMIT", 1]] I, [2020-07-23T13:41:31.403462 #21599] INFO -- : [c9f08cdb-822b-4a75-9ae1-4266b801af7a] Started GET "/system/admins/sign_in" for 34.254.186.153 at 2020-07-23 13:41:31 +0200 D, [2020-07-23T13:41:31.404565 #21599] DEBUG -- : [c9f08cdb-822b-4a75-9ae1-4266b801af7a] Decidim::Organization Load (0.2ms) SELECT "decidim_organizations". FROM "decidim_organizations" WHERE "decidim_organizations"."host" = $1 LIMIT $2 [["host", "participa.ecologistasenaccion.org"], ["LIMIT", 1]] D, [2020-07-23T13:41:31.405681 #21599] DEBUG -- : [c9f08cdb-822b-4a75-9ae1-4266b801af7a] Decidim::Organization Load (0.5ms) SELECT "decidim_organizations". FROM "decidim_organizations" WHERE ('participa.ecologistasenaccion.org' = ANY(secondary_hosts)) LIMIT $1 [["LIMIT", 1]] I, [2020-07-23T13:41:31.408495 #21599] INFO -- : [c9f08cdb-822b-4a75-9ae1-4266b801af7a] Processing by Decidim::System::Devise::SessionsController#new as / I, [2020-07-23T13:41:31.409833 #21599] INFO -- : [c9f08cdb-822b-4a75-9ae1-4266b801af7a] Completed 500 Internal Server Error in 1ms (ActiveRecord: 0.6ms) F, [2020-07-23T13:41:31.411180 #21599] FATAL -- : [c9f08cdb-822b-4a75-9ae1-4266b801af7a]
F, [2020-07-23T13:41:31.411209 #21599] FATAL -- : [c9f08cdb-822b-4a75-9ae1-4266b801af7a] ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR: no existe la relación «decidim_system_admins» LINE 8: WHERE a.attrelid = '"decidim_system_admins"':... ^ : SELECT a.attname, format_type(a.atttypid, a.atttypmod), pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod, c.collname, col_description(a.attrelid, a.attnum) AS comment FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum LEFT JOIN pg_type t ON a.atttypid = t.oid LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation WHERE a.attrelid = '"decidim_system_admins"'::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum ):

microstudi commented 4 years ago

I think you need to configure SSL, last versions of Decidim it's enabled by default. You can disabled it (not recommended) if you want in config/initializers/decidim.rb

ecologistas commented 4 years ago

Thanks Ivan, but SSL is configured and we have installed the latest release of decidim (0.21.0). So I think the problem is other.

microstudi commented 4 years ago

Have you created a System Admin user? It seems that you haven't run migrations or some table is missing

ecologistas commented 4 years ago

After run ~/decidim-app$ bin/rails assets:precompile db:migrate RAILS_ENV=production we have an error: == 20200626105230 RenameMaximumVotesPerProposalToThresholdPerProposal: migrating -- execute("UPDATE decidim_components\nSET settings = jsonb_set(\n settings::jsonb,\n array['global'],\n (settings->'global')::jsonb - 'maximum_votes_per_proposal' || jsonb_build_object('threshold_per_proposal', settings->'global'->'maximum_votes_per_proposal')\n )\nWHERE manifest_name = 'proposals'\n") rails aborted! StandardError: An error has occurred, this and all later migrations canceled:

PG::UndefinedFunction: ERROR: el operador no existe: jsonb - unknown LINE 5: (settings->'global')::jsonb - 'maximum_votes_per_proposal'... ^ HINT: Ningún operador coincide con el nombre y el tipo de los argumentos. Puede ser necesario agregar conversiones explícitas de tipos. : UPDATE decidim_components SET settings = jsonb_set( settings::jsonb, array['global'], (settings->'global')::jsonb - 'maximum_votes_per_proposal' || jsonb_build_object('threshold_per_proposal', settings->'global'->'maximum_votes_per_proposal') ) WHERE manifest_name = 'proposals' /home/decidimenv/decidim-app/db/migrate/20200626105230_rename_maximum_votes_per_proposal_to_threshold_per_proposal.decidim.rb:6:in up' bin/rails:4:in

'

Caused by: ActiveRecord::StatementInvalid: PG::UndefinedFunction: ERROR: el operador no existe: jsonb - unknown LINE 5: (settings->'global')::jsonb - 'maximum_votes_per_proposal'... ^ HINT: Ningún operador coincide con el nombre y el tipo de los argumentos. Puede ser necesario agregar conversiones explícitas de tipos. : UPDATE decidim_components SET settings = jsonb_set( settings::jsonb, array['global'], (settings->'global')::jsonb - 'maximum_votes_per_proposal' || jsonb_build_object('threshold_per_proposal', settings->'global'->'maximum_votes_per_proposal') ) WHERE manifest_name = 'proposals' /home/decidimenv/decidim-app/db/migrate/20200626105230_rename_maximum_votes_per_proposal_to_threshold_per_proposal.decidim.rb:6:in up' bin/rails:4:in

'

Caused by: PG::UndefinedFunction: ERROR: el operador no existe: jsonb - unknown LINE 5: (settings->'global')::jsonb - 'maximum_votes_per_proposal'... ^ HINT: Ningún operador coincide con el nombre y el tipo de los argumentos. Puede ser necesario agregar conversiones explícitas de tipos. /home/decidimenv/decidim-app/db/migrate/20200626105230_rename_maximum_votes_per_proposal_to_threshold_per_proposal.decidim.rb:6:in up' bin/rails:4:in

' Tasks: TOP => db:migrate (See full trace by running task with --trace)

microstudi commented 4 years ago

And what version of postgresql are you using? it should be at least 9.5

ecologistas commented 4 years ago

I am usign PostgreSQL 9.4.26. Should I update to last version?

microstudi commented 4 years ago

indeed, try at least 9.5. Maybe debian has as a default and older version thant the required