##// 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 38 printf " %s run bash console for rhodecode-ce\n" "ce "
39 39 printf " %s run bash console for rhodecode-ee\n" "ee "
40 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 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 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 46 printf " %s run bash console for rhodecode-tools-ce\n" "tools "
47 47 printf " %s create dev env required to run vcsserver and rhodecode\n" "dev-env "
48 48 printf " %s stops dev env\n" "dev-env-stop "
@@ -280,11 +280,11 b' dev_tools_celery_usage() {'
280 280 # :command.usage
281 281 dev_tools_celeryd_usage() {
282 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 284 echo
285 285
286 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 288 echo
289 289
290 290 fi
@@ -311,6 +311,11 b' dev_tools_celeryd_usage() {'
311 311 printf " Default: .dev-env/cmd-celeryd.sh\n"
312 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 319 # :command.usage_fixed_flags
315 320 printf " %s\n" "--help, -h"
316 321 printf " Show this help\n"
@@ -364,11 +369,11 b' dev_tools_ssh_usage() {'
364 369 # :command.usage
365 370 dev_tools_sshd_usage() {
366 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 373 echo
369 374
370 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 377 echo
373 378
374 379 fi
@@ -395,6 +400,11 b' dev_tools_sshd_usage() {'
395 400 printf " Default: .dev-env/cmd-sshd.sh\n"
396 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 408 # :command.usage_fixed_flags
399 409 printf " %s\n" "--help, -h"
400 410 printf " Show this help\n"
@@ -448,11 +458,11 b' dev_tools_svn_usage() {'
448 458 # :command.usage
449 459 dev_tools_svnd_usage() {
450 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 462 echo
453 463
454 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 466 echo
457 467
458 468 fi
@@ -479,6 +489,11 b' dev_tools_svnd_usage() {'
479 489 printf " Default: .dev-env/cmd-svnd.sh\n"
480 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 497 # :command.usage_fixed_flags
483 498 printf " %s\n" "--help, -h"
484 499 printf " Show this help\n"
@@ -1344,6 +1359,7 b' dev_tools_celeryd_command() {'
1344 1359
1345 1360 code_workdir=${args[--workdir]}
1346 1361 cmd_script=${args[--cmd]}
1362 force_cmd=${args[--force-cmd]}
1347 1363
1348 1364 exec_script=$WORKSPACE_HOME/$cmd_script
1349 1365 container_name=dev-celeryd
@@ -1353,14 +1369,15 b' dev_tools_celeryd_command() {'
1353 1369
1354 1370 RC_DEV_CMD_HELP=""
1355 1371
1356 if [[ ! -f $exec_script ]]; then
1372 if [[ ! -f $exec_script || $force_cmd ]]; then
1357 1373 echo "Generating new $exec_script file..."
1358 1374 mkdir -p $(dirname $exec_script)
1359 1375
1360 1376 cat <<< "
1377 #!/bin/bash
1361 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 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 1382 " > $exec_script
1366 1383 chmod +x $exec_script
@@ -1380,10 +1397,13 b' dev_tools_celeryd_command() {'
1380 1397 echo $container_name not found
1381 1398 fi
1382 1399
1400 # HELPER
1401 # docker logs -f $(docker ps -q --filter "name=celeryd")
1402
1383 1403 eval "
1384 1404 WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME RC_DEV_CMD_HELP=\"$RC_DEV_CMD_HELP\" \
1385 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 1407 --workdir=\"$code_workdir\" \
1388 1408 --name=\"$container_name\" \
1389 1409 --detach \
@@ -1472,6 +1492,7 b' dev_tools_sshd_command() {'
1472 1492
1473 1493 code_workdir=${args[--workdir]}
1474 1494 cmd_script=${args[--cmd]}
1495 force_cmd=${args[--force-cmd]}
1475 1496
1476 1497 exec_script=$WORKSPACE_HOME/$cmd_script
1477 1498 container_name=dev-sshd
@@ -1481,14 +1502,15 b' dev_tools_sshd_command() {'
1481 1502
1482 1503 RC_DEV_CMD_HELP=""
1483 1504
1484 if [[ ! -f $exec_script ]]; then
1505 if [[ ! -f $exec_script || $force_cmd ]]; then
1485 1506 echo "Generating new $exec_script file..."
1486 1507 mkdir -p $(dirname $exec_script)
1487 1508
1488 1509 cat <<< "
1510 #!/bin/bash
1489 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 1514 make dev-env && mkdir -p /run/sshd && /usr/sbin/sshd -f /etc/rhodecode/sshd_config -D -e
1493 1515 " > $exec_script
1494 1516 chmod +x $exec_script
@@ -1508,12 +1530,15 b' dev_tools_sshd_command() {'
1508 1530 echo $container_name not found
1509 1531 fi
1510 1532
1533 # HELPER
1534 # docker logs -f $(docker ps -q --filter "name=sshd")
1535
1511 1536 RC_SSH_PORT=9022
1512 1537
1513 1538 eval "
1514 1539 WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME RC_DEV_CMD_HELP=\"$RC_DEV_CMD_HELP\" \
1515 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 1542 --workdir=\"$code_workdir\" \
1518 1543 --name=\"$container_name\" \
1519 1544 --detach \
@@ -1600,6 +1625,7 b' dev_tools_svnd_command() {'
1600 1625
1601 1626 code_workdir=${args[--workdir]}
1602 1627 cmd_script=${args[--cmd]}
1628 force_cmd=${args[--force-cmd]}
1603 1629
1604 1630 exec_script=$WORKSPACE_HOME/$cmd_script
1605 1631 container_name=dev-svnd
@@ -1609,14 +1635,15 b' dev_tools_svnd_command() {'
1609 1635
1610 1636 RC_DEV_CMD_HELP=""
1611 1637
1612 if [[ ! -f $exec_script ]]; then
1638 if [[ ! -f $exec_script || $force_cmd ]]; then
1613 1639 echo "Generating new $exec_script file..."
1614 1640 mkdir -p $(dirname $exec_script)
1615 1641
1616 1642 cat <<< "
1643 #!/bin/bash
1617 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 1647 make dev-env && apachectl -D FOREGROUND
1621 1648 " > $exec_script
1622 1649 chmod +x $exec_script
@@ -1636,10 +1663,13 b' dev_tools_svnd_command() {'
1636 1663 echo $container_name not found
1637 1664 fi
1638 1665
1666 # HELPER
1667 # docker logs -f $(docker ps -q --filter "name=svnd")
1668
1639 1669 eval "
1640 1670 WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME RC_DEV_CMD_HELP=\"$RC_DEV_CMD_HELP\" \
1641 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 1673 --workdir=\"$code_workdir\" \
1644 1674 --name=\"$container_name\" \
1645 1675 --detach \
@@ -2645,6 +2675,14 b' dev_tools_celeryd_parse_requirements() {'
2645 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 2687 printf "invalid option: %s\n" "$key" >&2
2650 2688 exit 1
@@ -2799,6 +2837,14 b' dev_tools_sshd_parse_requirements() {'
2799 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 2849 printf "invalid option: %s\n" "$key" >&2
2804 2850 exit 1
@@ -2953,6 +2999,14 b' dev_tools_svnd_parse_requirements() {'
2953 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 3011 printf "invalid option: %s\n" "$key" >&2
2958 3012 exit 1
General Comments 0
You need to be logged in to leave comments. Login now