I’ve been trying to set up a deployment of my app to a DigitalOcean Droplet using colmena.
I set up my flake as described in the manual.
After executing colmena apply
everything builds fine locally, but once the deployment reaches the stage when it copies files to remote /nix/store/...
everything slows down to unacceptable state (i.e. after 5h it still hasn’t deployed a small application).
It looks like this:
And then it more or less gets stuck copying some of the packages. To speed this up I cancel the deployment, ssh the machine, execute nix-store --repair-path /nix/store/<package>
and restart the deployment, but for hundreds of packages this is a bit annoying, at best.
What’s surprising, colmena has an option deployment.buildOnTarget
. Switching it to true
causes the transfer to go up and complete within 10 minutes, which I find surprising.
Has anyone seen anything like this before?
Regarding the flake I use - it’s pretty long, so below you can find a truncated version. Happy to post more if this is needed/helpful.
{
inputs = {
nixpkgs.url = "nixpkgs/nixos-23.11";
flake-parts.url = "github:hercules-ci/flake-parts";
haskell-flake.url = "github:srid/haskell-flake";
};
outputs = inputs@{ self, nixpkgs, flake-parts, ... }:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ system ];
imports = [
inputs.haskell-flake.flakeModule
];
flake = {
colmena = {
meta = {
nixpkgs = import inputs.nixpkgs { inherit system; };
};
defaults = { pkgs, ... }: {
environment.systemPackages = with pkgs; [
curl sqlite htop neovim
];
programs.zsh.enable = true;
};
digital-ocean-my-server = {
imports = [ "${nixpkgs}/nixos/modules/virtualisation/digital-ocean-image.nix" ];
system.stateVersion = "23.11";
deployment = {
targetHost = "<correct IP of my server>";
targetPort = 22;
# surprisingly, uncommenting this increases massively transfer speed
#buildOnTarget = true;
};
time.timeZone = "Etc/UTC";
networking = {
hostName = "my-server";
firewall = {
enable = true;
allowedTCPPorts = [ 22 80 443 ];
allowPing = true;
};
};
// ....
}