Start background services with honcho
This commit is contained in:
parent
6107ba70b9
commit
1ee5086c12
1 changed files with 20 additions and 31 deletions
|
@ -1,4 +1,20 @@
|
||||||
{ pkgs, inputs }: pkgs.devshell.mkShell {
|
{ pkgs, inputs }:
|
||||||
|
let
|
||||||
|
support-procfile-text = ''
|
||||||
|
memcached: memcached
|
||||||
|
mysql: mysql
|
||||||
|
worker: rails jobs:work
|
||||||
|
css: yarn build:css --watch
|
||||||
|
js: yarn build:js --watch
|
||||||
|
'';
|
||||||
|
support-procfile = pkgs.writeText "Procfile.supp" support-procfile-text;
|
||||||
|
all-procfile-text = support-procfile-text + ''
|
||||||
|
server: rails s
|
||||||
|
'';
|
||||||
|
all-procfile = pkgs.writeText "Procfile.all" all-procfile-text;
|
||||||
|
|
||||||
|
in
|
||||||
|
pkgs.devshell.mkShell {
|
||||||
name = "Dodona";
|
name = "Dodona";
|
||||||
imports = [ "${inputs.devshell}/extra/language/c.nix" ];
|
imports = [ "${inputs.devshell}/extra/language/c.nix" ];
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
|
@ -34,12 +50,7 @@
|
||||||
category = "general commands";
|
category = "general commands";
|
||||||
help = "Start mysql (in docker container)";
|
help = "Start mysql (in docker container)";
|
||||||
command = ''
|
command = ''
|
||||||
trap "systemd-run --user --no-block docker stop dodona-db" 0
|
docker run --name dodona-db -p 3306:3306 --rm -v dodona-db-data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=dodona mariadb:latest
|
||||||
docker run -d --name dodona-db -p 3306:3306 --rm -v dodona-db-data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=dodona mariadb:latest
|
|
||||||
while [ 1 -eq 1 ]
|
|
||||||
do
|
|
||||||
sleep 1000
|
|
||||||
done
|
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
@ -47,19 +58,9 @@
|
||||||
category = "general commands";
|
category = "general commands";
|
||||||
help = "Run everything required for a server";
|
help = "Run everything required for a server";
|
||||||
command = ''
|
command = ''
|
||||||
memcached &
|
|
||||||
trap "kill $!" 0
|
|
||||||
mysql &
|
|
||||||
trap "kill $!" 0
|
|
||||||
bundle install
|
bundle install
|
||||||
yarn install
|
yarn install
|
||||||
rails jobs:work &
|
${pkgs.honcho}/bin/honcho start -f ${support-procfile} -d $PRJ_ROOT
|
||||||
trap "kill $!" 0
|
|
||||||
yarn build:css --watch &
|
|
||||||
trap "kill $!" 0
|
|
||||||
yarn build:js --watch &
|
|
||||||
trap "kill $!" 0
|
|
||||||
wait $!
|
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
@ -67,21 +68,9 @@
|
||||||
category = "general commands";
|
category = "general commands";
|
||||||
help = "Run everything";
|
help = "Run everything";
|
||||||
command = ''
|
command = ''
|
||||||
memcached &
|
|
||||||
trap "kill $!" 0
|
|
||||||
mysql &
|
|
||||||
trap "kill $!" 0
|
|
||||||
bundle install
|
bundle install
|
||||||
yarn install
|
yarn install
|
||||||
rails jobs:work &
|
${pkgs.honcho}/bin/honcho start -f ${all-procfile} -d $PRJ_ROOT
|
||||||
trap "kill $!" 0
|
|
||||||
yarn build:css --watch &
|
|
||||||
trap "kill $!" 0
|
|
||||||
yarn build:js --watch &
|
|
||||||
trap "kill $!" 0
|
|
||||||
rails s &
|
|
||||||
trap "kill $!" 0
|
|
||||||
wait $!
|
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue