-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify dev setup by moving commons to another flake
- Loading branch information
Showing
13 changed files
with
136 additions
and
438 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,94 +1,31 @@ | ||
{ | ||
concatTextFile, | ||
system, | ||
writeShellScriptBin, | ||
}: let key = ./dev-vm-key; in rec { | ||
redis-push = concatTextFile { | ||
name = "redis-push"; | ||
files = [./scripts/redis-push]; | ||
executable = true; | ||
destination = "/bin/redis-push"; | ||
devshell-tools, | ||
}: rec { | ||
redis-push = devshell-tools.lib.installScript { | ||
script = ./scripts/redis-push; | ||
inherit system; | ||
}; | ||
|
||
recreate-container = concatTextFile { | ||
name = "recreate-container"; | ||
files = [./scripts/recreate-container]; | ||
executable = true; | ||
destination = "/bin/recreate-container"; | ||
k8s-reprovision = devshell-tools.lib.installScript { | ||
script = ./scripts/k8s-reprovision; | ||
inherit system; | ||
}; | ||
|
||
start-container = writeShellScriptBin "start-container" '' | ||
cnt=''${RS_CONTAINER:-rsdev} | ||
sudo nixos-container start $cnt | ||
''; | ||
|
||
solr-create-core = writeShellScriptBin "solr-create-core" '' | ||
core_name=''${1:-rsdev-test} | ||
sudo nixos-container run ''${RS_CONTAINER:-rsdev} -- su solr -c "solr create -c $core_name" | ||
sudo nixos-container run ''${RS_CONTAINER:-rsdev} -- find /var/solr/data/$core_name/conf -type f -exec chmod 644 {} \; | ||
''; | ||
|
||
solr-delete-core = writeShellScriptBin "solr-delete-core" '' | ||
core_name=''${1:-rsdev-test} | ||
sudo nixos-container run ''${RS_CONTAINER:-rsdev} -- su solr -c "solr delete -c $core_name" | ||
''; | ||
|
||
solr-recreate-core = writeShellScriptBin "solr-recreate-core" '' | ||
${solr-delete-core}/bin/solr-delete-core "$1" | ||
${solr-create-core}/bin/solr-create-core "$1" | ||
''; | ||
|
||
solr-logs = writeShellScriptBin "solr-logs" '' | ||
sudo nixos-container run ''${RS_CONTAINER:-rsdev} -- journalctl -efu solr.service | ||
''; | ||
|
||
vm-build = writeShellScriptBin "vm-build" '' | ||
nix build .#nixosConfigurations.dev-vm.config.system.build.vm | ||
''; | ||
|
||
vm-run = writeShellScriptBin "vm-run" '' | ||
nix run .#nixosConfigurations.dev-vm.config.system.build.vm | ||
''; | ||
|
||
vm-ssh = writeShellScriptBin "vm-ssh" '' | ||
ssh -i ${key} -p $VM_SSH_PORT root@localhost "$@" | ||
''; | ||
|
||
vm-solr-logs = writeShellScriptBin "solr-logs" '' | ||
${vm-ssh}/bin/vm-ssh journalctl -efu solr.service | ||
''; | ||
|
||
vm-solr-create-core = writeShellScriptBin "solr-create-core" '' | ||
core_name=''${1:-rsdev-test} | ||
ssh -p $VM_SSH_PORT root@localhost "su solr -c \"solr create -c $core_name\"" | ||
ssh -p $VM_SSH_PORT root@localhost "find /var/solr/data/$core_name/conf -type f -exec chmod 644 {} \;" | ||
''; | ||
|
||
vm-solr-delete-core = writeShellScriptBin "solr-delete-core" '' | ||
core_name=''${1:-rsdev-test} | ||
ssh -p $VM_SSH_PORT root@localhost "su solr -c \"solr delete -c $core_name\"" | ||
''; | ||
|
||
vm-solr-recreate-core = writeShellScriptBin "solr-recreate-core" '' | ||
${vm-solr-delete-core}/bin/solr-delete-core "$1" | ||
${vm-solr-create-core}/bin/solr-create-core "$1" | ||
solr-recreate-cores = writeShellScriptBin "solr-recreate-cores" '' | ||
script=$([ "$(which cnt-solr-recreate-core)" != "" ] && echo "cnt-solr-recreate-core" || echo "vm-solr-recreate-core") | ||
for c in $@; do | ||
$script $c | ||
done | ||
''; | ||
|
||
# core names are defined in project/SolrServer.scala | ||
solr-recreate-dbtests-cores = writeShellScriptBin "solr-recreate-dbtests-cores" '' | ||
solr-delete-core core-test1 | ||
solr-delete-core core-test2 | ||
solr-delete-core core-test3 | ||
solr-delete-core search-core-test | ||
solr-create-core core-test1 | ||
solr-create-core core-test2 | ||
solr-create-core core-test3 | ||
solr-create-core search-core-test | ||
${solr-recreate-cores}/bin/solr-recreate-cores core-test1 core-test2 core-test3 search-core-test | ||
''; | ||
|
||
k8s-reprovision = concatTextFile { | ||
name = "k8s-reprovision"; | ||
files = [./scripts/k8s-reprovision]; | ||
executable = true; | ||
destination = "/bin/k8s-reprovision"; | ||
}; | ||
solr-recreate-search-core = writeShellScriptBin "solr-recreate-search-core" '' | ||
${solr-recreate-cores}/bin/solr-recreate-cores $RS_SOLR_CORE | ||
''; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.