##// END OF EJS Templates
caches: use individual namespaces per user to prevent beaker caching problems....
caches: use individual namespaces per user to prevent beaker caching problems. - especially for mysql in case large number of data in caches there could be critical errors storing cache, and thus preventing users from authentication. This is caused by the fact that we used single namespace for ALL users. It means it grew as number of users grew reaching mysql single column limit. This changes the behaviour and now we use namespace per-user it means that each user-id will have it's own cache namespace fragmenting maximum column data to a single user cache. Which we should never reach.

File last commit:

r1133:69363678 default
r2572:5b07455a default
Show More
shell.nix
83 lines | 3.0 KiB | text/x-nix | NixLexer
{ pkgs ? (import <nixpkgs> {})
, pythonPackages ? "python27Packages"
, doCheck ? true
, sourcesOverrides ? {}
, doDevelopInstall ? true
}:
let
# Get sources from config and update them with overrides.
sources = (pkgs.config.rc.sources or {}) // sourcesOverrides;
enterprise-ce = import ./default.nix {
inherit pkgs pythonPackages doCheck;
};
ce-pythonPackages = enterprise-ce.pythonPackages;
# This method looks up a path from `pkgs.config.rc.sources` and returns a
# shell script which does a `python setup.py develop` installation of it. If
# no path is found it will return an empty string.
optionalDevelopInstall = attributeName:
let
path = pkgs.lib.attrByPath [attributeName] null sources;
doIt = doDevelopInstall && path != null;
in
pkgs.lib.optionalString doIt (
builtins.trace "Develop install of ${attributeName} from ${path}" ''
echo "Develop install of '${attributeName}' from '${path}' [BEGIN]"
pushd ${path}
python setup.py develop --prefix $tmp_path --allow-hosts ""
popd
echo "Develop install of '${attributeName}' from '${path}' [DONE]"
'');
# This method looks up a path from `pkgs.config.rc.sources` and imports the
# default.nix file if it exists. It returns the list of build inputs. If no
# path is found it will return an empty list.
optionalDevelopInstallBuildInputs = attributeName:
let
path = pkgs.lib.attrByPath [attributeName] null sources;
nixFile = "${path}/default.nix";
doIt = doDevelopInstall && path != null && pkgs.lib.pathExists "${nixFile}";
derivate = import "${nixFile}" {
inherit doCheck pkgs pythonPackages;
};
in
pkgs.lib.lists.optionals doIt derivate.propagatedNativeBuildInputs;
developInstalls = [ "rhodecode-vcsserver" ];
in enterprise-ce.override (attrs: {
# Avoid that we dump any sources into the store when entering the shell and
# make development a little bit more convenient.
src = null;
buildInputs =
attrs.buildInputs ++
pkgs.lib.lists.concatMap optionalDevelopInstallBuildInputs developInstalls ++
(with ce-pythonPackages; [
bumpversion
invoke
ipdb
]);
# Somewhat snappier setup of the development environment
# TODO: think of supporting a stable path again, so that multiple shells
# can share it.
preShellHook = enterprise-ce.linkNodeAndBowerPackages + ''
# Custom prompt to distinguish from other dev envs.
export PS1="\n\[\033[1;32m\][CE-shell:\w]$\[\033[0m\] "
# Setup a temporary directory.
tmp_path=$(mktemp -d)
export PATH="$tmp_path/bin:$PATH"
export PYTHONPATH="$tmp_path/${ce-pythonPackages.python.sitePackages}:$PYTHONPATH"
mkdir -p $tmp_path/${ce-pythonPackages.python.sitePackages}
# Develop installations
python setup.py develop --prefix $tmp_path --allow-hosts ""
echo "Additional develop installs"
'' + pkgs.lib.strings.concatMapStrings optionalDevelopInstall developInstalls;
})