module ArvadosWorkbench
class Application < Rails::Application
+ # The following is to avoid SafeYAML's warning message
+ SafeYAML::OPTIONS[:default_mode] = :safe
require_relative "arvados_config.rb"
$arvados_config_defaults = clusterConfig
$arvados_config_defaults["ClusterID"] = clusterID
-# Load the global config file
-Open3.popen2("arvados-server", "config-dump", "-skip-legacy") do |stdin, stdout, status_thread|
- confs = YAML.load(stdout, deserialize_symbols: false)
- if confs && !confs.empty?
- # config-dump merges defaults with user configuration, so every
- # key should be set.
- clusterID, clusterConfig = confs["Clusters"].first
- $arvados_config_global = clusterConfig
- $arvados_config_global["ClusterID"] = clusterID
- else
- # config-dump failed, assume we will be loading from legacy
- # application.yml, initialize with defaults.
- $arvados_config_global = $arvados_config_defaults.deep_dup
+if ENV["ARVADOS_CONFIG"] == "none"
+ # Don't load config. This magic value is set by postinst so it can
+ # run "rake assets:precompile" without a real config.
+ $arvados_config_global = $arvados_config_defaults.deep_dup
+else
+ # Load the global config file
+ Open3.popen2("arvados-server", "config-dump", "-skip-legacy") do |stdin, stdout, status_thread|
+ confs = YAML.load(stdout, deserialize_symbols: false)
+ if confs && !confs.empty?
+ # config-dump merges defaults with user configuration, so every
+ # key should be set.
+ clusterID, clusterConfig = confs["Clusters"].first
+ $arvados_config_global = clusterConfig
+ $arvados_config_global["ClusterID"] = clusterID
+ else
+ # config-dump failed, assume we will be loading from legacy
+ # application.yml, initialize with defaults.
+ $arvados_config_global = $arvados_config_defaults.deep_dup
+ end
end
end
ConfigLoader.copy_into_config $arvados_config, config
ConfigLoader.copy_into_config $remaining_config, config
secrets.secret_key_base = $arvados_config["Workbench"]["SecretKeyBase"]
- ConfigValidators.validate_wb2_url_config()
- ConfigValidators.validate_download_config()
-
+ if ENV["ARVADOS_CONFIG"] != "none"
+ ConfigValidators.validate_wb2_url_config()
+ ConfigValidators.validate_download_config()
+ end
end
* After it installs the core configuration files (database.yml, application.yml, and production.rb) to /etc/arvados/server, it calls setup_extra_conffiles. By default this is a noop function (in step2.sh).
* Before it restarts nginx, it calls setup_before_nginx_restart. By default this is a noop function (in step2.sh). API server defines this to set up the internal git repository, if necessary.
* $RAILSPKG_DATABASE_LOAD_TASK defines the Rake task to load the database. API server uses db:structure:load. Workbench doesn't set this, which causes the postinst to skip all database work.
-* If $RAILSPKG_SUPPORTS_CONFIG_CHECK != 1, it won't run the config:check rake task.
prepare_database
fi
- if [ 11 = "$RAILSPKG_SUPPORTS_CONFIG_CHECK$APPLICATION_READY" ]; then
+ # Here, "ARVADOS_CONFIG=none" tells arvados_config.rb not to try
+ # loading config from /etc: it might not exist on a new install, and
+ # assets:precompile doesn't depend on config anyway.
+ run_and_report "Precompiling assets" \
+ ARVADOS_CONFIG=none $COMMAND_PREFIX bundle exec rake assets:precompile -q -s 2>/dev/null || true
+
+ if [ -e /etc/arvados/config.yml ]; then
+ # warn about config errors (deprecated/removed keys from
+ # previous version, etc)
run_and_report "Checking configuration for completeness" \
- $COMMAND_PREFIX bundle exec rake config:check || APPLICATION_READY=0
+ $COMMAND_PREFIX bundle exec rake config:check || true
fi
- # precompile assets; thankfully this does not take long
- if [ "$APPLICATION_READY" = "1" ]; then
- run_and_report "Precompiling assets" \
- $COMMAND_PREFIX bundle exec rake assets:precompile -q -s 2>/dev/null \
- || APPLICATION_READY=0
- else
- echo "Precompiling assets... skipped."
- fi
chown -R "$WWW_OWNER:" $RELEASE_PATH/tmp
setup_before_nginx_restart
PACKAGE BUILD ERROR: $0 is missing package metadata.
-This package is buggy. Please mail <support@curoverse.com> to let
+This package is buggy. Please mail <packaging@arvados.org> to let
us know the name and version number of the package you tried to
install, and we'll get it fixed.
RELEASE_CONFIG_PATH=$RELEASE_PATH/config
SHARED_PATH=$INSTALL_PATH/shared
-RAILSPKG_SUPPORTS_CONFIG_CHECK=${RAILSPKG_SUPPORTS_CONFIG_CHECK:-1}
if ! type setup_extra_conffiles >/dev/null 2>&1; then
setup_extra_conffiles() { return; }
fi
$arvados_config_defaults = clusterConfig
$arvados_config_defaults["ClusterID"] = clusterID
-# Load the global config file
-Open3.popen2("arvados-server", "config-dump", "-skip-legacy") do |stdin, stdout, status_thread|
- confs = YAML.load(stdout, deserialize_symbols: false)
- if confs && !confs.empty?
- # config-dump merges defaults with user configuration, so every
- # key should be set.
- clusterID, clusterConfig = confs["Clusters"].first
- $arvados_config_global = clusterConfig
- $arvados_config_global["ClusterID"] = clusterID
- else
- # config-dump failed, assume we will be loading from legacy
- # application.yml, initialize with defaults.
- $arvados_config_global = $arvados_config_defaults.deep_dup
+if ENV["ARVADOS_CONFIG"] == "none"
+ # Don't load config. This magic value is set by postinst so it can
+ # run "rake assets:precompile" without a real config.
+ $arvados_config_global = $arvados_config_defaults.deep_dup
+else
+ # Load the global config file
+ Open3.popen2("arvados-server", "config-dump", "-skip-legacy") do |stdin, stdout, status_thread|
+ confs = YAML.load(stdout, deserialize_symbols: false)
+ if confs && !confs.empty?
+ # config-dump merges defaults with user configuration, so every
+ # key should be set.
+ clusterID, clusterConfig = confs["Clusters"].first
+ $arvados_config_global = clusterConfig
+ $arvados_config_global["ClusterID"] = clusterID
+ else
+ # config-dump failed, assume we will be loading from legacy
+ # application.yml, initialize with defaults.
+ $arvados_config_global = $arvados_config_defaults.deep_dup
+ end
end
end
arvcfg.declare_config "Collections.CollectionVersioning", Boolean, :collection_versioning
arvcfg.declare_config "Collections.PreserveVersionIfIdle", ActiveSupport::Duration, :preserve_version_if_idle
arvcfg.declare_config "Collections.TrashSweepInterval", ActiveSupport::Duration, :trash_sweep_interval
-arvcfg.declare_config "Collections.BlobSigningKey", NonemptyString, :blob_signing_key
+arvcfg.declare_config "Collections.BlobSigningKey", String, :blob_signing_key
arvcfg.declare_config "Collections.BlobSigningTTL", ActiveSupport::Duration, :blob_signature_ttl
arvcfg.declare_config "Collections.BlobSigning", Boolean, :permit_create_collection_with_unsigned_manifest, ->(cfg, k, v) { ConfigLoader.set_cfg cfg, "Collections.BlobSigning", !v }
arvcfg.declare_config "Collections.ForwardSlashNameSubstitution", String
$arvados_config["PostgreSQL"]["Connection"]["collation"] = "en_US.UTF-8"
end
+if ENV["ARVADOS_CONFIG"] == "none"
+ # We need the postgresql connection URI to be valid, even if we
+ # don't use it.
+ $arvados_config["PostgreSQL"]["Connection"]["host"] = "localhost"
+ $arvados_config["PostgreSQL"]["Connection"]["user"] = "x"
+ $arvados_config["PostgreSQL"]["Connection"]["password"] = "x"
+ $arvados_config["PostgreSQL"]["Connection"]["dbname"] = "x"
+end
+
if $arvados_config["PostgreSQL"]["Connection"]["password"].empty?
raise "Database password is empty, PostgreSQL section is: #{$arvados_config["PostgreSQL"]}"
end
Rails.application.configure do
begin
- if ActiveRecord::Base.connection.tables.include?('jobs')
+ if ENV["ARVADOS_CONFIG"] != "none" && ActiveRecord::Base.connection.tables.include?('jobs')
check_enable_legacy_jobs_api
end
rescue ActiveRecord::NoDatabaseError