loomio / loomio-deploy

Install Loomio on your own server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot install the app with instructions

yodatak opened this issue · comments

Hi i want to make in production this app but i cannot make it work
i got some errors like this

[10] Puma starting in cluster mode...
[10] * Puma version: 6.3.0 (ruby 3.2.2-p53) ("Mugi No Toki Itaru")
[10] * Min threads: 12
[10] * Max threads: 12
[10] * Environment: production
[10] * Master PID: 10
[10] * Workers: 2
[10] * Restarts: (✔) hot (✖) phased
[10] * Preloading application
booting bots!
bot redis connected
[10] ! Unable to load application: KeyError: Missing configuration for the local Active Storage service. Configurations available for the test, local, amazon, digitalocean, s3_compatible, and google services.
bundler: failed to load command: puma (/usr/local/bundle/bin/puma)
/usr/local/bundle/gems/activestorage-7.0.4.2/lib/active_storage/service/registry.rb:18:in block in fetch': Missing configuration for the local Active Storage service. Configurations available for the test, local, amazon, digitalocean, s3_compatible, and google services. (KeyError) from /usr/local/bundle/gems/activestorage-7.0.4.2/lib/active_storage/service/registry.rb:11:in fetch'
from /usr/local/bundle/gems/activestorage-7.0.4.2/lib/active_storage/service/registry.rb:11:in fetch' from /usr/local/bundle/gems/activestorage-7.0.4.2/lib/active_storage/engine.rb:155:in block (2 levels) in class:Engine'
from /usr/local/bundle/gems/activesupport-7.0.4.2/lib/active_support/lazy_load_hooks.rb:95:in class_eval' from /usr/local/bundle/gems/activesupport-7.0.4.2/lib/active_support/lazy_load_hooks.rb:95:in block in execute_hook'
from /usr/local/bundle/gems/activesupport-7.0.4.2/lib/active_support/lazy_load_hooks.rb:85:in with_execution_control' from /usr/local/bundle/gems/activesupport-7.0.4.2/lib/active_support/lazy_load_hooks.rb:90:in execute_hook'
from /usr/local/bundle/gems/activesupport-7.0.4.2/lib/active_support/lazy_load_hooks.rb:76:in block in run_load_hooks' from /usr/local/bundle/gems/activesupport-7.0.4.2/lib/active_support/lazy_load_hooks.rb:75:in each'
from /usr/local/bundle/gems/activesupport-7.0.4.2/lib/active_support/lazy_load_hooks.rb:75:in run_load_hooks' from /usr/local/bundle/gems/activestorage-7.0.4.2/app/models/active_storage/blob.rb:410:in

'
from internal:/usr/local/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb:37:in require' from <internal:/usr/local/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in require'
from /usr/local/bundle/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in require' from /usr/local/bundle/gems/zeitwerk-2.6.8/lib/zeitwerk/kernel.rb:30:in require'
from /usr/local/bundle/gems/zeitwerk-2.6.8/lib/zeitwerk/loader/helpers.rb:135:in const_get' from /usr/local/bundle/gems/zeitwerk-2.6.8/lib/zeitwerk/loader/helpers.rb:135:in cget'
from /usr/local/bundle/gems/zeitwerk-2.6.8/lib/zeitwerk/loader/eager_load.rb:176:in block in actual_eager_load_dir' from /usr/local/bundle/gems/zeitwerk-2.6.8/lib/zeitwerk/loader/helpers.rb:40:in block in ls'
from /usr/local/bundle/gems/zeitwerk-2.6.8/lib/zeitwerk/loader/helpers.rb:25:in each' from /usr/local/bundle/gems/zeitwerk-2.6.8/lib/zeitwerk/loader/helpers.rb:25:in ls'
from /usr/local/bundle/gems/zeitwerk-2.6.8/lib/zeitwerk/loader/eager_load.rb:164:in actual_eager_load_dir' from /usr/local/bundle/gems/zeitwerk-2.6.8/lib/zeitwerk/loader/eager_load.rb:17:in block (2 levels) in eager_load'
from /usr/local/bundle/gems/zeitwerk-2.6.8/lib/zeitwerk/loader/eager_load.rb:16:in each' from /usr/local/bundle/gems/zeitwerk-2.6.8/lib/zeitwerk/loader/eager_load.rb:16:in block in eager_load'
from /usr/local/bundle/gems/zeitwerk-2.6.8/lib/zeitwerk/loader/eager_load.rb:10:in synchronize' from /usr/local/bundle/gems/zeitwerk-2.6.8/lib/zeitwerk/loader/eager_load.rb:10:in eager_load'
from /usr/local/bundle/gems/zeitwerk-2.6.8/lib/zeitwerk/loader.rb:329:in block in eager_load_all' from /usr/local/bundle/gems/zeitwerk-2.6.8/lib/zeitwerk/loader.rb:327:in each'
from /usr/local/bundle/gems/zeitwerk-2.6.8/lib/zeitwerk/loader.rb:327:in eager_load_all' from /usr/local/bundle/gems/railties-7.0.4.2/lib/rails/application/finisher.rb:74:in block in module:Finisher'
from /usr/local/bundle/gems/railties-7.0.4.2/lib/rails/initializable.rb:32:in instance_exec' from /usr/local/bundle/gems/railties-7.0.4.2/lib/rails/initializable.rb:32:in run'
from /usr/local/bundle/gems/railties-7.0.4.2/lib/rails/initializable.rb:61:in block in run_initializers' from /usr/local/lib/ruby/3.2.0/tsort.rb:228:in block in tsort_each'
from /usr/local/lib/ruby/3.2.0/tsort.rb:350:in block (2 levels) in each_strongly_connected_component' from /usr/local/lib/ruby/3.2.0/tsort.rb:431:in each_strongly_connected_component_from'
from /usr/local/lib/ruby/3.2.0/tsort.rb:349:in block in each_strongly_connected_component' from /usr/local/lib/ruby/3.2.0/tsort.rb:347:in each'
from /usr/local/lib/ruby/3.2.0/tsort.rb:347:in call' from /usr/local/lib/ruby/3.2.0/tsort.rb:347:in each_strongly_connected_component'
from /usr/local/lib/ruby/3.2.0/tsort.rb:226:in tsort_each' from /usr/local/lib/ruby/3.2.0/tsort.rb:205:in tsort_each'
from /usr/local/bundle/gems/railties-7.0.4.2/lib/rails/initializable.rb:60:in run_initializers' from /usr/local/bundle/gems/railties-7.0.4.2/lib/rails/application.rb:372:in initialize!'
from /loomio/config/environment.rb:5:in <top (required)>' from config.ru:1:in require_relative'
from config.ru:1:in block in <main>' from /usr/local/bundle/gems/rack-2.2.7/lib/rack/builder.rb:116:in eval'
from /usr/local/bundle/gems/rack-2.2.7/lib/rack/builder.rb:116:in new_from_string' from /usr/local/bundle/gems/rack-2.2.7/lib/rack/builder.rb:105:in load_file'
from /usr/local/bundle/gems/rack-2.2.7/lib/rack/builder.rb:66:in parse_file' from /usr/local/bundle/gems/puma-6.3.0/lib/puma/configuration.rb:366:in load_rackup'
from /usr/local/bundle/gems/puma-6.3.0/lib/puma/configuration.rb:288:in app' from /usr/local/bundle/gems/puma-6.3.0/lib/puma/runner.rb:158:in load_and_bind'
from /usr/local/bundle/gems/puma-6.3.0/lib/puma/cluster.rb:359:in run' from /usr/local/bundle/gems/puma-6.3.0/lib/puma/launcher.rb:194:in run'
from /usr/local/bundle/gems/puma-6.3.0/lib/puma/cli.rb:75:in run' from /usr/local/bundle/gems/puma-6.3.0/bin/puma:10:in <top (required)>'
from /usr/local/bundle/bin/puma:25:in load' from /usr/local/bundle/bin/puma:25:in <top (required)>'
from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/cli/exec.rb:58:in load' from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/cli/exec.rb:58:in kernel_load'
from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/cli/exec.rb:23:in run' from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/cli.rb:492:in exec'
from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/vendor/thor/lib/thor/command.rb:27:in run' from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in invoke_command'
from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/vendor/thor/lib/thor.rb:392:in dispatch' from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/cli.rb:34:in dispatch'
from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/vendor/thor/lib/thor/base.rb:485:in start' from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/cli.rb:28:in start'
from /usr/local/bundle/gems/bundler-2.4.12/exe/bundle:45:in block in <top (required)>' from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/friendly_errors.rb:117:in with_friendly_errors'
from /usr/local/bundle/gems/bundler-2.4.12/exe/bundle:33:in <top (required)>' from /usr/local/bundle/bin/bundle:25:in load'
from /usr/local/bundle/bin/bundle:25:in `'
exit code: 1

or this

ActiveRecord::ProtectedEnvironmentError: You are attempting to run a destructive action against your 'production' database.
If you are sure you want to continue, run the same command with the environment variable:
DISABLE_DATABASE_ENVIRONMENT_CHECK=1
/usr/local/bundle/gems/activerecord-7.0.4.2/lib/active_record/tasks/database_tasks.rb:69:in check_protected_environments!' /usr/local/bundle/gems/activerecord-7.0.4.2/lib/active_record/railties/databases.rake:18:in block (2 levels) in

'
/usr/local/bundle/gems/sentry-ruby-5.10.0/lib/sentry/rake.rb:26:in `execute'
Tasks: TOP => db:setup => db:schema:load => db:check_protected_environments
(See full trace by running task with --trace)
Database 'loomio' already exists
rake aborted!

or
48584454f93c /usr/local/bundle/gems/activerecord-7.0.4.2/lib/active_record/migration.rb:1092:in `migrate'
25accd06d6b5 2023-07-17 22:25:59.986 UTC [122] ERROR: database "loomio" already exists

using podman version: 4.5.1
podman-composer version 1.0.3
podman --version
podman version 4.5.1

.env

LOOMIO_CONTAINER_IMAGE=loomio/loomio
LOOMIO_CONTAINER_TAG=v2.18.1
MAILIN_CONTAINER_IMAGE=loomio/mailin-docker
MAILIN_CONTAINER_TAG=latest
POSTGRES_CONTAINER_TAG=12.2

# this is the hostname of your app eg: loomio.org
CANONICAL_HOST=loomio.XXXX.org

# email address of admin of the server for LetsEncrypt
SUPPORT_EMAIL=XX@XXX.com

# the human name of the app (Default Loomio)
SITE_NAME=loomio.XXXX.org

# reply-to in email notifications
REPLY_HOSTNAME=loomio.XXXX.org

# hostname of the node.js app that handles websocket stuff
CHANNELS_URI=wss://channels.loomio.XXXX.org

# helper bot is the account which welcomes people to their groups.
HELPER_BOT_EMAIL=no-reply@loomio.XXXX.org
RAILS_ENV=production

# Postgres
POSTGRES_PASSWORD=XXXXX
POSTGRES_DB=loomio
DATABASE_URL=postgresql://postgres:XXXXXX@db/loomio

# Redis URL
REDIS_URL=redis://redis:6379/0

# attachment storage service
# local will keep attachments on the server's disk under ./storage
# for cloud storage options include amazon, digitalocean or s3_compatible
ACTIVE_STORAGE_SERVICE=local

# tell clients to reload when the server is upgraded
LOOMIO_SYSTEM_RELOAD=1
DEVISE_SECRET=XXXX
SECRET_COOKIE_TOKEN=XXXXX

docker-compose.yaml

version: '3'

services:

  app:
    container_name: loomio-app
    image: ${LOOMIO_CONTAINER_IMAGE}:${LOOMIO_CONTAINER_TAG}
    restart: unless-stopped
    ports:
     - "3000:3000"
    expose:
      - 3000
    env_file: ./.env
    environment:
      - VIRTUAL_HOST=${CANONICAL_HOST}
    volumes:
      - /opt/loomio/uploads:/loomio/public/system
      - /opt/loomio/storage:/loomio/storage
      - /opt/loomio/files:/loomio/public/files
      - /opt/loomio/plugins:/loomio/plugins/docker
      - /opt/loomio/import:/import
      - /opt/loomio/tmp:/loomio/tmp
    depends_on:
      - db
      - redis

  db:
    restart: unless-stopped
    container_name: loomio-db
    image: postgres:${POSTGRES_CONTAINER_TAG}
    env_file: ./.env
    volumes:
      - /opt/loomio/pgdata:/pgdata
      - /opt/loomio/pgdumps:/pgdumps
    environment:
     - PGDATA=/pgdata

worker:
    container_name: loomio-worker
    image: ${LOOMIO_CONTAINER_IMAGE}:${LOOMIO_CONTAINER_TAG}
    restart: always
    env_file: ./.env
    environment:
      - TASK=worker
    volumes:
      - /opt/loomio/uploads:/loomio/public/system
      - /opt/loomio/storage:/loomio/storage
      - /opt/loomio/files:/loomio/public/files
      - /opt/loomio/plugins:/loomio/plugins/docker
      - /opt/loomio/tmp:/loomio/tmp


  redis:
    container_name: loomio-redis
    image: redis:5.0
    restart: unless-stopped


  channels:
    container_name: loomio-channels
    image: loomio/loomio_channel_server
    restart: unless-stopped
    env_file: ./.env
    depends_on:
      - redis
    environment:
      - VIRTUAL_HOST=channels.${CANONICAL_HOST}

Thanks again for your awsome app !

I am not sure what's wrong.
Have you been following the instructions from loomio-deploy/README on a fresh server?

It looks like you're using Podman rather than Docker.

I think I need you to follow the instructions with a fresh server, using the recommended software, otherwise I can't support you.

Ok i find it its not podman the problem but the default RAILS_ENV that is set to RAILS_ENV=production so we can't initalize db after

podman-compose up -d db
podman-compose logs db # (verify that all is ok)
podman-compose run app rake db:setup

are you open to a PR to document how use with podman and this fix for make it work ?

bether we could do this command

podman-compose run -e RAILS_ENV="development" app rake db:setup
or docker-compose run -e RAILS_ENV="development" app rake db:setup

and stay with default env RAILS_ENV="production"

#96 some part of my work

are you interested in the PR @robguthrie ?

@yodatak in case you are still interested in running Loomio via Podman. I got it working and documented the process here:

https://f-hub.org/Meta/loomio-podman

Might be still a bit lacking here and there and isn't fully tested yet, but as far as I can tell right now it all works.