##// END OF EJS Templates
feat: dev-tools, ensure deamonized commands stay within process
super-admin -
Show More
@@ -38,11 +38,11 b' dev_tools_usage() {'
38 printf " %s run bash console for rhodecode-ce\n" "ce "
38 printf " %s run bash console for rhodecode-ce\n" "ce "
39 printf " %s run bash console for rhodecode-ee\n" "ee "
39 printf " %s run bash console for rhodecode-ee\n" "ee "
40 printf " %s run bash console for rhodecode-celery\n" "celery "
40 printf " %s run bash console for rhodecode-celery\n" "celery "
41 printf " %s run celery instance on top of mounted source code, e.g ./dev-tools celeryd&\n" "celeryd "
41 printf " %s run celery detached instance on top of mounted source code\n" "celeryd "
42 printf " %s run bash console for rhodecode-ssh\n" "ssh "
42 printf " %s run bash console for rhodecode-ssh\n" "ssh "
43 printf " %s run sshd instance for rhodecode-ssh\n" "sshd "
43 printf " %s run sshd detached instance on top of mounted source code\n" "sshd "
44 printf " %s run bash console for rhodecode-ssh\n" "svn "
44 printf " %s run bash console for rhodecode-ssh\n" "svn "
45 printf " %s run sshd instance for rhodecode-ssh\n" "svnd "
45 printf " %s run svn detached instance on top of mounted source code\n" "svnd "
46 printf " %s run bash console for rhodecode-tools-ce\n" "tools "
46 printf " %s run bash console for rhodecode-tools-ce\n" "tools "
47 printf " %s create dev env required to run vcsserver and rhodecode\n" "dev-env "
47 printf " %s create dev env required to run vcsserver and rhodecode\n" "dev-env "
48 printf " %s stops dev env\n" "dev-env-stop "
48 printf " %s stops dev env\n" "dev-env-stop "
@@ -280,11 +280,11 b' dev_tools_celery_usage() {'
280 # :command.usage
280 # :command.usage
281 dev_tools_celeryd_usage() {
281 dev_tools_celeryd_usage() {
282 if [[ -n $long_usage ]]; then
282 if [[ -n $long_usage ]]; then
283 printf "dev-tools celeryd - run celery instance on top of mounted source code, e.g ./dev-tools celeryd&\n"
283 printf "dev-tools celeryd - run celery detached instance on top of mounted source code\n"
284 echo
284 echo
285
285
286 else
286 else
287 printf "dev-tools celeryd - run celery instance on top of mounted source code, e.g ./dev-tools celeryd&\n"
287 printf "dev-tools celeryd - run celery detached instance on top of mounted source code\n"
288 echo
288 echo
289
289
290 fi
290 fi
@@ -311,6 +311,11 b' dev_tools_celeryd_usage() {'
311 printf " Default: .dev-env/cmd-celeryd.sh\n"
311 printf " Default: .dev-env/cmd-celeryd.sh\n"
312 echo
312 echo
313
313
314 # :flag.usage
315 printf " %s\n" "--force-cmd"
316 printf " enforce re-creation of the startup command\n"
317 echo
318
314 # :command.usage_fixed_flags
319 # :command.usage_fixed_flags
315 printf " %s\n" "--help, -h"
320 printf " %s\n" "--help, -h"
316 printf " Show this help\n"
321 printf " Show this help\n"
@@ -364,11 +369,11 b' dev_tools_ssh_usage() {'
364 # :command.usage
369 # :command.usage
365 dev_tools_sshd_usage() {
370 dev_tools_sshd_usage() {
366 if [[ -n $long_usage ]]; then
371 if [[ -n $long_usage ]]; then
367 printf "dev-tools sshd - run sshd instance for rhodecode-ssh\n"
372 printf "dev-tools sshd - run sshd detached instance on top of mounted source code\n"
368 echo
373 echo
369
374
370 else
375 else
371 printf "dev-tools sshd - run sshd instance for rhodecode-ssh\n"
376 printf "dev-tools sshd - run sshd detached instance on top of mounted source code\n"
372 echo
377 echo
373
378
374 fi
379 fi
@@ -395,6 +400,11 b' dev_tools_sshd_usage() {'
395 printf " Default: .dev-env/cmd-sshd.sh\n"
400 printf " Default: .dev-env/cmd-sshd.sh\n"
396 echo
401 echo
397
402
403 # :flag.usage
404 printf " %s\n" "--force-cmd"
405 printf " enforce re-creation of the startup command\n"
406 echo
407
398 # :command.usage_fixed_flags
408 # :command.usage_fixed_flags
399 printf " %s\n" "--help, -h"
409 printf " %s\n" "--help, -h"
400 printf " Show this help\n"
410 printf " Show this help\n"
@@ -448,11 +458,11 b' dev_tools_svn_usage() {'
448 # :command.usage
458 # :command.usage
449 dev_tools_svnd_usage() {
459 dev_tools_svnd_usage() {
450 if [[ -n $long_usage ]]; then
460 if [[ -n $long_usage ]]; then
451 printf "dev-tools svnd - run sshd instance for rhodecode-ssh\n"
461 printf "dev-tools svnd - run svn detached instance on top of mounted source code\n"
452 echo
462 echo
453
463
454 else
464 else
455 printf "dev-tools svnd - run sshd instance for rhodecode-ssh\n"
465 printf "dev-tools svnd - run svn detached instance on top of mounted source code\n"
456 echo
466 echo
457
467
458 fi
468 fi
@@ -479,6 +489,11 b' dev_tools_svnd_usage() {'
479 printf " Default: .dev-env/cmd-svnd.sh\n"
489 printf " Default: .dev-env/cmd-svnd.sh\n"
480 echo
490 echo
481
491
492 # :flag.usage
493 printf " %s\n" "--force-cmd"
494 printf " enforce re-creation of the startup command\n"
495 echo
496
482 # :command.usage_fixed_flags
497 # :command.usage_fixed_flags
483 printf " %s\n" "--help, -h"
498 printf " %s\n" "--help, -h"
484 printf " Show this help\n"
499 printf " Show this help\n"
@@ -1344,6 +1359,7 b' dev_tools_celeryd_command() {'
1344
1359
1345 code_workdir=${args[--workdir]}
1360 code_workdir=${args[--workdir]}
1346 cmd_script=${args[--cmd]}
1361 cmd_script=${args[--cmd]}
1362 force_cmd=${args[--force-cmd]}
1347
1363
1348 exec_script=$WORKSPACE_HOME/$cmd_script
1364 exec_script=$WORKSPACE_HOME/$cmd_script
1349 container_name=dev-celeryd
1365 container_name=dev-celeryd
@@ -1353,14 +1369,15 b' dev_tools_celeryd_command() {'
1353
1369
1354 RC_DEV_CMD_HELP=""
1370 RC_DEV_CMD_HELP=""
1355
1371
1356 if [[ ! -f $exec_script ]]; then
1372 if [[ ! -f $exec_script || $force_cmd ]]; then
1357 echo "Generating new $exec_script file..."
1373 echo "Generating new $exec_script file..."
1358 mkdir -p $(dirname $exec_script)
1374 mkdir -p $(dirname $exec_script)
1359
1375
1360 cat <<< "
1376 cat <<< "
1377 #!/bin/bash
1361 # Generated dev-env script for celeryd
1378 # Generated dev-env script for celeryd
1379 #echo \"Run celery dev using the following command:\"
1362
1380
1363 echo \"Run celery dev using the following command:\"
1364 make dev-env && celery --no-color --app=rhodecode.lib.celerylib.loader worker --autoscale=4,2 --max-tasks-per-child=100 --task-events --loglevel=DEBUG --ini=.dev/dev.ini
1381 make dev-env && celery --no-color --app=rhodecode.lib.celerylib.loader worker --autoscale=4,2 --max-tasks-per-child=100 --task-events --loglevel=DEBUG --ini=.dev/dev.ini
1365 " > $exec_script
1382 " > $exec_script
1366 chmod +x $exec_script
1383 chmod +x $exec_script
@@ -1380,10 +1397,13 b' dev_tools_celeryd_command() {'
1380 echo $container_name not found
1397 echo $container_name not found
1381 fi
1398 fi
1382
1399
1400 # HELPER
1401 # docker logs -f $(docker ps -q --filter "name=celeryd")
1402
1383 eval "
1403 eval "
1384 WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME RC_DEV_CMD_HELP=\"$RC_DEV_CMD_HELP\" \
1404 WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME RC_DEV_CMD_HELP=\"$RC_DEV_CMD_HELP\" \
1385 ./rcstack stack --env-file-path $env_file rhodecode -f docker-compose-apps.dev.yaml \
1405 ./rcstack stack --env-file-path $env_file rhodecode -f docker-compose-apps.dev.yaml \
1386 run -e RC_DEV_CMD_HELP=\"'$RC_DEV_CMD_HELP'\" -e ENV_FILE= -e RC_ENV_FILE= -e RC_APP_TYPE=rhodecode_$container_name --rm --use-aliases \
1406 run -e RC_APP_PROC=1 -e RC_DEV_CMD_HELP=\"'$RC_DEV_CMD_HELP'\" -e ENV_FILE= -e RC_ENV_FILE= -e RC_APP_TYPE=rhodecode_$container_name --rm --use-aliases \
1387 --workdir=\"$code_workdir\" \
1407 --workdir=\"$code_workdir\" \
1388 --name=\"$container_name\" \
1408 --name=\"$container_name\" \
1389 --detach \
1409 --detach \
@@ -1472,6 +1492,7 b' dev_tools_sshd_command() {'
1472
1492
1473 code_workdir=${args[--workdir]}
1493 code_workdir=${args[--workdir]}
1474 cmd_script=${args[--cmd]}
1494 cmd_script=${args[--cmd]}
1495 force_cmd=${args[--force-cmd]}
1475
1496
1476 exec_script=$WORKSPACE_HOME/$cmd_script
1497 exec_script=$WORKSPACE_HOME/$cmd_script
1477 container_name=dev-sshd
1498 container_name=dev-sshd
@@ -1481,14 +1502,15 b' dev_tools_sshd_command() {'
1481
1502
1482 RC_DEV_CMD_HELP=""
1503 RC_DEV_CMD_HELP=""
1483
1504
1484 if [[ ! -f $exec_script ]]; then
1505 if [[ ! -f $exec_script || $force_cmd ]]; then
1485 echo "Generating new $exec_script file..."
1506 echo "Generating new $exec_script file..."
1486 mkdir -p $(dirname $exec_script)
1507 mkdir -p $(dirname $exec_script)
1487
1508
1488 cat <<< "
1509 cat <<< "
1510 #!/bin/bash
1489 # Generated dev-env script for ssh
1511 # Generated dev-env script for ssh
1512 #echo \"Run ssh dev using the following command:\"
1490
1513
1491 echo \"Run ssh dev using the following command:\"
1492 make dev-env && mkdir -p /run/sshd && /usr/sbin/sshd -f /etc/rhodecode/sshd_config -D -e
1514 make dev-env && mkdir -p /run/sshd && /usr/sbin/sshd -f /etc/rhodecode/sshd_config -D -e
1493 " > $exec_script
1515 " > $exec_script
1494 chmod +x $exec_script
1516 chmod +x $exec_script
@@ -1508,12 +1530,15 b' dev_tools_sshd_command() {'
1508 echo $container_name not found
1530 echo $container_name not found
1509 fi
1531 fi
1510
1532
1533 # HELPER
1534 # docker logs -f $(docker ps -q --filter "name=sshd")
1535
1511 RC_SSH_PORT=9022
1536 RC_SSH_PORT=9022
1512
1537
1513 eval "
1538 eval "
1514 WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME RC_DEV_CMD_HELP=\"$RC_DEV_CMD_HELP\" \
1539 WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME RC_DEV_CMD_HELP=\"$RC_DEV_CMD_HELP\" \
1515 ./rcstack stack --env-file-path $env_file rhodecode -f docker-compose-apps.dev.yaml \
1540 ./rcstack stack --env-file-path $env_file rhodecode -f docker-compose-apps.dev.yaml \
1516 run -e RC_DEV_CMD_HELP=\"'$RC_DEV_CMD_HELP'\" -e ENV_FILE= -e RC_ENV_FILE= -e RC_APP_TYPE=rhodecode_$container_name --rm --use-aliases \
1541 run -e RC_APP_PROC=1 -e RC_DEV_CMD_HELP=\"'$RC_DEV_CMD_HELP'\" -e ENV_FILE= -e RC_ENV_FILE= -e RC_APP_TYPE=rhodecode_$container_name --rm --use-aliases \
1517 --workdir=\"$code_workdir\" \
1542 --workdir=\"$code_workdir\" \
1518 --name=\"$container_name\" \
1543 --name=\"$container_name\" \
1519 --detach \
1544 --detach \
@@ -1600,6 +1625,7 b' dev_tools_svnd_command() {'
1600
1625
1601 code_workdir=${args[--workdir]}
1626 code_workdir=${args[--workdir]}
1602 cmd_script=${args[--cmd]}
1627 cmd_script=${args[--cmd]}
1628 force_cmd=${args[--force-cmd]}
1603
1629
1604 exec_script=$WORKSPACE_HOME/$cmd_script
1630 exec_script=$WORKSPACE_HOME/$cmd_script
1605 container_name=dev-svnd
1631 container_name=dev-svnd
@@ -1609,14 +1635,15 b' dev_tools_svnd_command() {'
1609
1635
1610 RC_DEV_CMD_HELP=""
1636 RC_DEV_CMD_HELP=""
1611
1637
1612 if [[ ! -f $exec_script ]]; then
1638 if [[ ! -f $exec_script || $force_cmd ]]; then
1613 echo "Generating new $exec_script file..."
1639 echo "Generating new $exec_script file..."
1614 mkdir -p $(dirname $exec_script)
1640 mkdir -p $(dirname $exec_script)
1615
1641
1616 cat <<< "
1642 cat <<< "
1643 #!/bin/bash
1617 # Generated dev-env script for svn
1644 # Generated dev-env script for svn
1645 #echo \"Run svn dev using the following command:\"
1618
1646
1619 echo \"Run svn dev using the following command:\"
1620 make dev-env && apachectl -D FOREGROUND
1647 make dev-env && apachectl -D FOREGROUND
1621 " > $exec_script
1648 " > $exec_script
1622 chmod +x $exec_script
1649 chmod +x $exec_script
@@ -1636,10 +1663,13 b' dev_tools_svnd_command() {'
1636 echo $container_name not found
1663 echo $container_name not found
1637 fi
1664 fi
1638
1665
1666 # HELPER
1667 # docker logs -f $(docker ps -q --filter "name=svnd")
1668
1639 eval "
1669 eval "
1640 WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME RC_DEV_CMD_HELP=\"$RC_DEV_CMD_HELP\" \
1670 WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME RC_DEV_CMD_HELP=\"$RC_DEV_CMD_HELP\" \
1641 ./rcstack stack --env-file-path $env_file rhodecode -f docker-compose-apps.dev.yaml \
1671 ./rcstack stack --env-file-path $env_file rhodecode -f docker-compose-apps.dev.yaml \
1642 run -e RC_DEV_CMD_HELP=\"'$RC_DEV_CMD_HELP'\" -e ENV_FILE= -e RC_ENV_FILE= -e RC_APP_TYPE=rhodecode_$container_name --rm --use-aliases \
1672 run -e RC_APP_PROC=1 -e RC_DEV_CMD_HELP=\"'$RC_DEV_CMD_HELP'\" -e ENV_FILE= -e RC_ENV_FILE= -e RC_APP_TYPE=rhodecode_$container_name --rm --use-aliases \
1643 --workdir=\"$code_workdir\" \
1673 --workdir=\"$code_workdir\" \
1644 --name=\"$container_name\" \
1674 --name=\"$container_name\" \
1645 --detach \
1675 --detach \
@@ -2645,6 +2675,14 b' dev_tools_celeryd_parse_requirements() {'
2645 fi
2675 fi
2646 ;;
2676 ;;
2647
2677
2678 # :flag.case
2679 --force-cmd)
2680
2681 # :flag.case_no_arg
2682 args['--force-cmd']=1
2683 shift
2684 ;;
2685
2648 -?*)
2686 -?*)
2649 printf "invalid option: %s\n" "$key" >&2
2687 printf "invalid option: %s\n" "$key" >&2
2650 exit 1
2688 exit 1
@@ -2799,6 +2837,14 b' dev_tools_sshd_parse_requirements() {'
2799 fi
2837 fi
2800 ;;
2838 ;;
2801
2839
2840 # :flag.case
2841 --force-cmd)
2842
2843 # :flag.case_no_arg
2844 args['--force-cmd']=1
2845 shift
2846 ;;
2847
2802 -?*)
2848 -?*)
2803 printf "invalid option: %s\n" "$key" >&2
2849 printf "invalid option: %s\n" "$key" >&2
2804 exit 1
2850 exit 1
@@ -2953,6 +2999,14 b' dev_tools_svnd_parse_requirements() {'
2953 fi
2999 fi
2954 ;;
3000 ;;
2955
3001
3002 # :flag.case
3003 --force-cmd)
3004
3005 # :flag.case_no_arg
3006 args['--force-cmd']=1
3007 shift
3008 ;;
3009
2956 -?*)
3010 -?*)
2957 printf "invalid option: %s\n" "$key" >&2
3011 printf "invalid option: %s\n" "$key" >&2
2958 exit 1
3012 exit 1
General Comments 0
You need to be logged in to leave comments. Login now