Add initial deployment configuration and setup instructions
Introduced a new example-krops.nix file for deployment configuration, providing a template for machine-specific setups. Updated the .gitignore to include krops.nix, ensuring user-specific configurations are not tracked. Expanded the DEPLOYMENT-GUIDE.md with detailed initial setup instructions, including steps for creating and customizing krops.nix and machine configurations, enhancing the onboarding process for new users.
This commit is contained in:
parent
d794cf4394
commit
2229717860
3 changed files with 124 additions and 0 deletions
83
example-krops.nix
Normal file
83
example-krops.nix
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
let
|
||||
krops = builtins.fetchGit {
|
||||
url = "https://cgit.krebsco.de/krops/";
|
||||
ref = "master";
|
||||
};
|
||||
|
||||
lib = import "${krops}/lib";
|
||||
pkgs = import "${krops}/pkgs" {};
|
||||
|
||||
# Define sources for each machine
|
||||
source = name: lib.evalSource [
|
||||
{
|
||||
# NixOS configuration entry point
|
||||
nixos-config.symlink = "config-machine/configuration.nix";
|
||||
|
||||
# Use nixpkgs from local NIX_PATH (much smaller than git clone)
|
||||
# This copies your local <nixpkgs> without .git history (~400MB vs 6GB)
|
||||
nixpkgs.file = {
|
||||
path = toString <nixpkgs>;
|
||||
useChecksum = true;
|
||||
};
|
||||
|
||||
# Shared configuration files (only shared modules and files)
|
||||
config-shared.file = toString ./config/shared.nix;
|
||||
config-modules.file = toString ./config/modules;
|
||||
config-nginx.file = toString ./config/nginx.nix;
|
||||
config-pict-rs.file = toString ./config/pict-rs.nix;
|
||||
config-lnbits.file = toString ./config/lnbits.nix;
|
||||
|
||||
# Machine-specific configuration files (only this machine's config)
|
||||
config-machine.file = toString (./config/machines + "/${name}");
|
||||
|
||||
# Pre-built web-app (built locally with machine-specific config)
|
||||
web-app-dist.file = toString (./build + "/${name}/dist");
|
||||
|
||||
# LNBits flake source
|
||||
lnbits-src.file = toString ./lnbits;
|
||||
|
||||
# LNBits extensions (deployed to /var/lib/lnbits/extensions)
|
||||
# Uncomment if you have custom extensions to deploy
|
||||
# lnbits-extensions.file = toString ./lnbits-extensions;
|
||||
}
|
||||
];
|
||||
|
||||
# Example machine deployment (copy this block for each machine)
|
||||
# Replace "example-machine" with your machine name
|
||||
# Replace "root@your-host" with your SSH target
|
||||
example-machine = pkgs.krops.writeDeploy "deploy-example-machine" {
|
||||
source = source "example-machine";
|
||||
target = "root@your-host-or-ip";
|
||||
|
||||
# Avoid having to create a sentinel file.
|
||||
# Otherwise /var/src/.populate must be created on the target node to signal krops
|
||||
# that it is allowed to deploy.
|
||||
force = true;
|
||||
};
|
||||
|
||||
# Add more machines here following the same pattern:
|
||||
# machine1 = pkgs.krops.writeDeploy "deploy-machine1" {
|
||||
# source = source "machine1";
|
||||
# target = "root@machine1-host";
|
||||
# force = true;
|
||||
# };
|
||||
|
||||
# Deploy to all machines (update this list with your machines)
|
||||
all = pkgs.writeScript "deploy-all" ''
|
||||
#!${pkgs.bash}/bin/bash
|
||||
set -e
|
||||
echo "Deploying to example-machine..."
|
||||
${example-machine}
|
||||
# Add your machines here:
|
||||
# echo "Deploying to machine1..."
|
||||
# ${machine1}
|
||||
echo "All deployments completed!"
|
||||
'';
|
||||
|
||||
in {
|
||||
# Export your machine deployments here
|
||||
inherit example-machine all;
|
||||
|
||||
# Add your machines to the inherit list:
|
||||
# inherit example-machine machine1 machine2 all;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue