Infos:
Used Zammad version: 3.7.0
Used Zammad installation source: source
Operating system: NixOS
Problem:
I’m trying to package Zammad for NixOS. This is a stateless distribution, and it uses a sandbox for building. I have only weak Ruby skills. I’ll need to package it in such a way that the app is in a certain folder with the compiled assets and all application state is in e.g. /var/lib/zammad
.
I got as far building the gemset, and I’m now trying to precompile the assets. The problem is that packages are built in a network-less sandbox.
when I run
cp config/database/database.yml config/database.yml
bundle exec rake rake:assets:precompile RAILS_ENV=production NODE_ENV=production
it errors out, wanting to connect to PostgreSQL.
How can I make it skip the DB connection?
I found support for NullDB, but when I set the database adapter to nulldb
, I get this error
module NullDB class Configuration < Struct.new(:project_root); end class << self def configure @configuration = Configuration.new.tap {|c| yield c} end def configuration if @configuration.nil? raise "NullDB not configured. Require a framework, ex 'nulldb/rails'" end @configuration end def nullify(options={}) begin @prev_connection = ActiveRecord::Base.connection_pool.try(:spec) rescue ActiveRecord::ConnectionNotEstablished end
You can’t skip the database connection.
It’s deeply soldered in the application to ensure everything is up and running that’s needed.
garbas
February 22, 2021, 10:57pm
4
@MrGeneration Isn’t it a bit strange to require database connection to compile some javascript?
2 Likes
Well I get what you’re aiming at, but sorry, that’s not my cup of tea.
I can’t tell if there’s a good reason for it.
Maybe @anon29869905 can.
As mentioned before this is default Rails behaviour and not directly related to Zammads codebase.
I googled for a minute and found a straight forward workaround :
Added this gem to the Gemfile
gem "activerecord-nulldb-adapter"
Modified the assets precompile command to look like this:
bundle exec rake DATABASE_URL=nulldb://user:pass@127.0.0.1/dbname assets:precompile
We can take part 1 into the core to reduce the zammad-docker and zammad-docker-compose setup time.
However, our resources are limited. Since this is a pretty low hanging fruit contributions from the community are very welcome.
system
Closed
August 7, 2021, 12:05pm
7
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.