Replace overmind with process-compose

This commit is contained in:
Andreas Zweili 2023-11-14 15:58:31 +01:00
parent 2e9cb61249
commit 58e6768253
3 changed files with 8 additions and 6 deletions

View File

@ -1 +0,0 @@
web: devenv up

4
dev.sh
View File

@ -8,7 +8,6 @@ _init() {
# Setup the database
_setup() {
overmind start -D
sleep 5
if [ -f .direnv/first_run ]; then
python ./src/manage.py collectstatic --noinput
@ -67,7 +66,6 @@ run() {
sudo iptables -I INPUT -p tcp --dport $WEBPORT -j ACCEPT
printf "\n---\n webserver: $url\n---\n"
_open_url $url
overmind echo
}
descriptions["run"]="Start the webserver."
tasks["run"]=run
@ -75,7 +73,7 @@ descriptions["start"]="Alias for run."
tasks["start"]=run
stop() {
overmind quit
process-compose down
}
descriptions["stop"]="Stop the webserver and DB."
tasks["stop"]=stop

View File

@ -29,7 +29,6 @@
modules = [
{
packages = [
pkgs.overmind
(pkgs.writeScriptBin "dev" "${builtins.readFile ./dev.sh}")
];
env = {
@ -45,7 +44,13 @@
install.enable = true;
};
};
processes.webserver.exec = "poetry run python ./src/manage.py runserver 0.0.0.0:$WEBPORT";
process.implementation = "process-compose";
process-managers.process-compose.enable = true;
# https://github.com/cachix/devenv/blob/main/examples/process-compose/devenv.nix
processes = {
webserver.exec = "poetry run python ./src/manage.py runserver 0.0.0.0:$WEBPORT";
setup.exec = "dev start";
};
services.postgres = {
enable = true;
initialDatabases = [{ name = "django"; }];