Loomio

I can't get development environment running on Ubuntu 14.04

Ronald PublicSeen by 39

I have just successfully installed Loomio on ubuntu 14.04 but i can't get development environment running in the browser.

When i try accessing: http://localhost:3000/development/setup_discussion
i get this error "undefined method `is_visible_to_public=' for #".

Even though i try any other option such as "http://localhost:3000/development/setup_login"
i get another different error ": unknown attribute 'is_admin' for User.

Rails Server is fully running and gulp dev

Your help will be appreciated.
Thanks

James Kiesel

That smells like an out of sync database to me. Have you set up a loomio_development db in postgres, and run rake db:schema:load?

Ronald

Hello @jameskiesel
Yes i setup loomio_development db but i didn't run the second command (rake db:schema:load), am going to try it out.

But to be curious am still confused on deploying loomio to the live server, apparently am using heroku.
I tried this guide https://github.com/loomio/loomio-deploy but i wasn't able to succeed because as so far i don't have root privilege on heroku.

But is here is what i tried out.

  1. Installed heroku-docker.
  2. docker-compose run loomio rake db:setup
  3. Setup git
    • git add -A
    • git commit -m "Initial commit"
    • git push heroku master

With the above trials i didn't succeed. Am not really sure what am supposed to do assuming i want to deploy loomio to heroku, apparently the development environment is now working fine.

Your help will be appreciated

Ronald

I tried rake db:schema:load.
Here is the response....

ronald@ronald-phil:~/codebase/loomio$ rake db:schema:load
-- enable_extension("plpgsql")
-> 0.0221s
-- enable_extension("hstore")
-> 0.0059s
-- create_table("active_admin_comments", {:force=>:cascade})
-> 0.1836s
-- add_index("active_admin_comments", ["author_type", "author_id"], {:name=>"index_active_admin_comments_on_author_type_and_author_id", :using=>:btree})
-> 0.0494s
-- add_index("active_admin_comments", ["namespace"], {:name=>"index_active_admin_comments_on_namespace", :using=>:btree})
-> 0.0495s
-- add_index("active_admin_comments", ["resource_type", "resource_id"], {:name=>"index_active_admin_comments_on_resource_type_and_resource_id", :using=>:btree})
-> 0.0496s
-- create_table("ahoy_events", {:id=>:uuid, :default=>nil, :force=>:cascade})
rake aborted!
ActiveRecord::StatementInvalid: PG::UndefinedObject: ERROR: type "jsonb" does not exist
LINE 1: ..." integer, "name" character varying, "properties" jsonb, "ti...
^
: CREATE TABLE "ahoy_events" ("id" uuid PRIMARY KEY , "visit_id" uuid, "user_id" integer, "name" character varying, "properties" jsonb, "time" timestamp)
/home/ronald/codebase/loomio/db/schema.rb:35:in block in <top (required)>'
/home/ronald/codebase/loomio/db/schema.rb:14:in
'
PG::UndefinedObject: ERROR: type "jsonb" does not exist
LINE 1: ..." integer, "name" character varying, "properties" jsonb, "ti...
^
/home/ronald/codebase/loomio/db/schema.rb:35:in block in <top (required)>'
/home/ronald/codebase/loomio/db/schema.rb:14:in
'
Tasks: TOP => db:schema:load
(See full trace by running task with --trace)

What should i do in-order to successed.

James Kiesel

You'll need to upgrade your postgres version, Loomio requires 9.4+ to run (because of that jsonb data type, which was introduced in 9.4)

Ronald

Thanks, Now it works fine on my development environment.

But to be curious am still confused on deploying loomio to the live server, apparently am using heroku.
I tried this guide https://github.com/loomio/loomio-deploy but i wasn't able to succeed because as so far i don't have root privilege on heroku.

But here is what i have tried out.

I Installed heroku-docker.

docker-compose run loomio rake db:setup

Setup git
git add -A
git commit -m "Initial commit"
git push heroku master

With the above trials i didn't succeed. Am not really sure what am supposed to do assuming i want to deploy loomio to heroku, apparently the development environment is now working fine.

Ronald

Any feedback?

Robert Guthrie

@ronald1 Sorry, but, it's hard to understand what you're saying - It's unclear if you are using heroku or not. If you are using heroku then the loomio-deploy guide is not going to help you.

Right now we only have capacity to support people to follow the instructions in the loomio-deploy repo.

If you do want to deploy to heorku.. let us know and we can consider writing up a document to guide people through that.

Ronald

@robertguthrie, I would really like to deploy loomio to heroku. Most of us are having difficulty in deploying to heroku. I will be grateful if you provide the documentation guide showing how that is done.

James Kiesel

A note that Loomio.org itself is deployed to heroku, so we do have a working example of this. Our deploy script is here:

https://github.com/loomio/loomio/blob/master/lib/tasks/deploy.rake

Which has a bit of description of the steps we take. Our rough process goes:

  • Cut a new branch
  • Build the assets (css / js)
  • Acquire any plugins you want to run (loomio.org relies on 2 plugins at the moment)
  • Force commit (git commit -m "deploy" --force) all assets and plugin code
  • Push that commit to heroku

You won't be able to use the deploy script as-is just yet (There's still a little bit of stuff specific to our world in there), but all the information you need will be in there. At some point we may make the deploy script totally white label, and write up a more comprehensive how-to for folks that want to go the heroku route, but it's not on the map at the moment.

Ronald

After running rake deploy heroku master i ran into a serious issue i tried all the possible ways but i wasn't able to over come this issue.

remote: -----> Preparing app for Rails asset pipeline
remote: Running: rake assets:precompile
remote: rake aborted!
remote: Devise.secret_key was not set. Please add the following to your Devise initializer:
remote: config.secret_key = 'a7dc04b73776bd26360220011cc6222d39fa181a48ecd1353715b293cf3af3dbc5cdad2a8a44eb50d998c6e35b7846c153db95e8daf1d9b7ac26f877aabd8d85'
remote: Please ensure you restarted your application after installing Devise or setting the key.
remote: /tmp/build_9300d884ba13899b5dda3936ab174fc9/vendor/bundle/ruby/2.3.0/gems/devise-3.5.5/lib/devise/rails/routes.rb:489:in raise_no_secret_key'

I tried
1. setting config.secret_key = '6ab8400e54410a89d4ca8cf59c9a1894f10b8e49331056ceae25c8c5f359b341a6e0285cac6b0e6fa7dafb7d9b9ad2273b58acd397893b79b249cd960faf0db7' if Rails.env == 'production' in the /config/initializers/devise.rb
2. Updating devise version

But no luck, your help will be appreciated

Robert Guthrie

You need to set your environment variables up.

You can find your environment vars in the env file.

heroku config:set VAR=value

Also note that you'll need to setup a seperate FAYE server if you want live update with heroku.

Ronald

Thanks @robertguthrie , The error is now gone but my application is not showing up instead its showing Sorry, the page you were looking for doesn't exist.
Check it out https://tunga-loomio.herokuapp.com/

Here are some logs got from production server.
`2016-05-22T22:16:11.762860+00:00 app[web.1]: Processing by RedirectController#group_subdomain as HTML
2016-05-22T22:16:11.766404+00:00 app[web.1]: Completed 500 Internal Server Error in 3ms (ActiveRecord: 0.0ms)

2016-05-22T22:16:11.776322+00:00 app[web.1]:
2016-05-22T22:16:11.776330+00:00 app[web.1]: ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR: relation "groups" does not exist
2016-05-22T22:16:11.776332+00:00 app[web.1]: LINE 1: SELECT "groups".* FROM "groups" WHERE "groups"."subdomain" ...
2016-05-22T22:16:11.776333+00:00 app[web.1]: ^
2016-05-22T22:16:11.776333+00:00 app[web.1]: : SELECT "groups".* FROM "groups" WHERE "groups"."subdomain" = $1 LIMIT 1):

2016-05-22T22:16:11.776334+00:00 app[web.1]: app/controllers/redirect_controller.rb:3:in group_subdomain'
2016-05-22T22:16:11.776335+00:00 app[web.1]:
2016-05-22T22:16:11.776336+00:00 app[web.1]:

2016-05-22T22:16:12.260909+00:00 heroku[router]: at=info method=GET path="/assets/loomio-orange.png" host=tunga-loomio.herokuapp.com request_id=8f3096c4-c98a-433c-b489-51a0ba676099 fwd="154.73.12.94" dyno=web.1 connect=0ms service=8ms status=304 bytes=272
2016-05-22T22:16:12.256339+00:00 app[web.1]: Started GET "/assets/loomio-orange.png" for 154.73.12.94 at 2016-05-22 22:16:12 +0000
`

Ronald

Many thanks @robertguthrie
After setting up TLD_LENGTH and CANONICAL_HOST
and then i ran heroku run rake db:reset.
And now loomio is fully working on heroku.

But when i try to create a group i can't receive any email.

I thought this (heroku run rake jobs:work) would help but i was unable to receive any email

Robert Guthrie

That's good progress, but oh no!

It's likely that you need to but running the background jobs.

You need to enable a worker process from the heroku resources page, this will send emails for you.

You also need to add the Heroku Scheduler addon and configure it to run rake loomio:hourly_tasks each hour on the hour. This is to close proposals and such.