Show More
@@ -39,6 +39,7 b' dev_tools_usage() {' | |||
|
39 | 39 | printf " %s run bash console for rhodecode-ce\n" "ce " |
|
40 | 40 | printf " %s run bash console for svn web\n" "svn " |
|
41 | 41 | printf " %s run bash console for rhodecode-celery\n" "celery " |
|
42 | printf " %s run celery instance on top of mounted source code, e.g ./dev-tools celeryd&\n" "celeryd " | |
|
42 | 43 | printf " %s run bash console for rhodecode-sshd\n" "sshd " |
|
43 | 44 | printf " %s run bash console for rhodecode-tools-ce\n" "tools " |
|
44 | 45 | printf " %s create dev env required to run vcsserver and rhodecode\n" "dev-env " |
@@ -74,7 +75,7 b' dev_tools_usage() {' | |||
|
74 | 75 | echo |
|
75 | 76 | |
|
76 | 77 | # :command.footer |
|
77 |
printf "RhodeCode Inc 202 |
|
|
78 | printf "RhodeCode Inc 2024\n\n" | |
|
78 | 79 | echo |
|
79 | 80 | |
|
80 | 81 | fi |
@@ -221,7 +222,7 b' dev_tools_celery_usage() {' | |||
|
221 | 222 | fi |
|
222 | 223 | |
|
223 | 224 | printf "%s\n" "Usage:" |
|
224 | printf " dev-tools celery\n" | |
|
225 | printf " dev-tools celery [OPTIONS]\n" | |
|
225 | 226 | printf " dev-tools celery --help | -h\n" |
|
226 | 227 | echo |
|
227 | 228 | |
@@ -229,6 +230,61 b' dev_tools_celery_usage() {' | |||
|
229 | 230 | if [[ -n $long_usage ]]; then |
|
230 | 231 | printf "%s\n" "Options:" |
|
231 | 232 | |
|
233 | # :command.usage_flags | |
|
234 | # :flag.usage | |
|
235 | printf " %s\n" "--workdir WORKDIR" | |
|
236 | printf " workdir to run the pip install -e on top of can be ce or ee only\n" | |
|
237 | printf " Default: /home/rhodecode/rhodecode-enterprise-ce\n" | |
|
238 | echo | |
|
239 | ||
|
240 | # :flag.usage | |
|
241 | printf " %s\n" "--cmd CMD" | |
|
242 | printf " cmd script to run, this is on host machine, relative to $WORKSPACE_HOME\n" | |
|
243 | printf " Default: .dev/cmd-celery.sh\n" | |
|
244 | echo | |
|
245 | ||
|
246 | # :command.usage_fixed_flags | |
|
247 | printf " %s\n" "--help, -h" | |
|
248 | printf " Show this help\n" | |
|
249 | echo | |
|
250 | ||
|
251 | fi | |
|
252 | } | |
|
253 | ||
|
254 | # :command.usage | |
|
255 | dev_tools_celeryd_usage() { | |
|
256 | if [[ -n $long_usage ]]; then | |
|
257 | printf "dev-tools celeryd - run celery instance on top of mounted source code, e.g ./dev-tools celeryd&\n" | |
|
258 | echo | |
|
259 | ||
|
260 | else | |
|
261 | printf "dev-tools celeryd - run celery instance on top of mounted source code, e.g ./dev-tools celeryd&\n" | |
|
262 | echo | |
|
263 | ||
|
264 | fi | |
|
265 | ||
|
266 | printf "%s\n" "Usage:" | |
|
267 | printf " dev-tools celeryd [OPTIONS]\n" | |
|
268 | printf " dev-tools celeryd --help | -h\n" | |
|
269 | echo | |
|
270 | ||
|
271 | # :command.long_usage | |
|
272 | if [[ -n $long_usage ]]; then | |
|
273 | printf "%s\n" "Options:" | |
|
274 | ||
|
275 | # :command.usage_flags | |
|
276 | # :flag.usage | |
|
277 | printf " %s\n" "--workdir WORKDIR" | |
|
278 | printf " workdir to run the pip install -e on top of can be ce or ee only\n" | |
|
279 | printf " Default: /home/rhodecode/rhodecode-enterprise-ce\n" | |
|
280 | echo | |
|
281 | ||
|
282 | # :flag.usage | |
|
283 | printf " %s\n" "--cmd CMD" | |
|
284 | printf " cmd script to run, this is on host machine, relative to $WORKSPACE_HOME\n" | |
|
285 | printf " Default: .dev/cmd-celeryd.sh\n" | |
|
286 | echo | |
|
287 | ||
|
232 | 288 | # :command.usage_fixed_flags |
|
233 | 289 | printf " %s\n" "--help, -h" |
|
234 | 290 | printf " Show this help\n" |
@@ -962,16 +1018,77 b' dev_tools_svn_command() {' | |||
|
962 | 1018 | # :command.function |
|
963 | 1019 | dev_tools_celery_command() { |
|
964 | 1020 | # src/celery_command.sh |
|
1021 | code_workdir=${args[--workdir]} | |
|
1022 | cmd_script=${args[--cmd]} | |
|
1023 | ||
|
1024 | exec_script=$WORKSPACE_HOME/$cmd_script | |
|
965 | 1025 | container_name=dev-celery |
|
966 | 1026 | |
|
1027 | echo "Using exec script: $exec_script" | |
|
1028 | ||
|
1029 | if [[ ! -f $exec_script ]]; then | |
|
1030 | echo "Generating new $exec_script file..." | |
|
1031 | mkdir -p $(dirname $exec_script) | |
|
1032 | ||
|
1033 | cat <<< " | |
|
1034 | # Generated dev-env script for celery | |
|
1035 | ||
|
1036 | echo \"Run celery dev using the following command:\" | |
|
1037 | echo \"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\" | |
|
1038 | echo \"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\" | |
|
1039 | echo \"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\" | |
|
1040 | make sh | |
|
1041 | " > $exec_script | |
|
1042 | chmod +x $exec_script | |
|
1043 | fi | |
|
1044 | ||
|
1045 | docker_exec_script="/var/opt/rhodecode_repo_store/$cmd_script" | |
|
1046 | ||
|
967 | 1047 | docker ps -q --filter "name=$container_name" | grep -q . && echo $container_name found || echo $container_name not found |
|
968 | 1048 | docker ps -q --filter "name=$container_name" | grep -q . && docker stop $container_name && docker rm -fv $container_name |
|
969 | 1049 | |
|
970 | 1050 | eval " |
|
971 | 1051 | ./rcstack stack --env-file-path .custom/.dev.env rhodecode -f docker-compose-apps.dev.yaml \ |
|
972 | 1052 | run -e ENV_FILE= -e RC_ENV_FILE= -e RC_APP_TYPE=rhodecode_sh --rm --use-aliases \ |
|
973 | --workdir=\"/home/rhodecode/rhodecode-enterprise-ce\" \ | |
|
974 |
--name=\"$container_name\" rhodecode bash |
|
|
1053 | --workdir=\"$code_workdir\" \ | |
|
1054 | --name=\"$container_name\" rhodecode bash $docker_exec_script" | |
|
1055 | ||
|
1056 | } | |
|
1057 | ||
|
1058 | # :command.function | |
|
1059 | dev_tools_celeryd_command() { | |
|
1060 | # src/celeryd_command.sh | |
|
1061 | code_workdir=${args[--workdir]} | |
|
1062 | cmd_script=${args[--cmd]} | |
|
1063 | ||
|
1064 | exec_script=$WORKSPACE_HOME/$cmd_script | |
|
1065 | container_name=dev-celeryd | |
|
1066 | ||
|
1067 | echo "Using exec script: $exec_script" | |
|
1068 | ||
|
1069 | if [[ ! -f $exec_script ]]; then | |
|
1070 | echo "Generating new $exec_script file..." | |
|
1071 | mkdir -p $(dirname $exec_script) | |
|
1072 | ||
|
1073 | cat <<< " | |
|
1074 | # Generated dev-env script for celery | |
|
1075 | ||
|
1076 | echo \"Run celery dev using the following command:\" | |
|
1077 | 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 | |
|
1078 | " > $exec_script | |
|
1079 | chmod +x $exec_script | |
|
1080 | fi | |
|
1081 | ||
|
1082 | docker_exec_script="/var/opt/rhodecode_repo_store/$cmd_script" | |
|
1083 | ||
|
1084 | docker ps -q --filter "name=$container_name" | grep -q . && echo $container_name found || echo $container_name not found | |
|
1085 | docker ps -q --filter "name=$container_name" | grep -q . && docker stop $container_name && docker rm -fv $container_name | |
|
1086 | ||
|
1087 | eval " | |
|
1088 | ./rcstack stack --env-file-path .custom/.dev.env rhodecode -f docker-compose-apps.dev.yaml \ | |
|
1089 | run -e ENV_FILE= -e RC_ENV_FILE= -e RC_APP_TYPE=rhodecode_sh --rm --use-aliases \ | |
|
1090 | --workdir=\"$code_workdir\" \ | |
|
1091 | --name=\"$container_name\" rhodecode $docker_exec_script" | |
|
975 | 1092 | |
|
976 | 1093 | } |
|
977 | 1094 | |
@@ -1412,6 +1529,13 b' parse_requirements() {' | |||
|
1412 | 1529 | shift $# |
|
1413 | 1530 | ;; |
|
1414 | 1531 | |
|
1532 | celeryd) | |
|
1533 | action="celeryd" | |
|
1534 | shift | |
|
1535 | dev_tools_celeryd_parse_requirements "$@" | |
|
1536 | shift $# | |
|
1537 | ;; | |
|
1538 | ||
|
1415 | 1539 | sshd) |
|
1416 | 1540 | action="sshd" |
|
1417 | 1541 | shift |
@@ -1747,6 +1871,35 b' dev_tools_celery_parse_requirements() {' | |||
|
1747 | 1871 | while [[ $# -gt 0 ]]; do |
|
1748 | 1872 | key="$1" |
|
1749 | 1873 | case "$key" in |
|
1874 | # :flag.case | |
|
1875 | --workdir) | |
|
1876 | ||
|
1877 | # :flag.case_arg | |
|
1878 | if [[ -n ${2+x} ]]; then | |
|
1879 | ||
|
1880 | args['--workdir']="$2" | |
|
1881 | shift | |
|
1882 | shift | |
|
1883 | else | |
|
1884 | printf "%s\n" "--workdir requires an argument: --workdir WORKDIR" >&2 | |
|
1885 | exit 1 | |
|
1886 | fi | |
|
1887 | ;; | |
|
1888 | ||
|
1889 | # :flag.case | |
|
1890 | --cmd) | |
|
1891 | ||
|
1892 | # :flag.case_arg | |
|
1893 | if [[ -n ${2+x} ]]; then | |
|
1894 | ||
|
1895 | args['--cmd']="$2" | |
|
1896 | shift | |
|
1897 | shift | |
|
1898 | else | |
|
1899 | printf "%s\n" "--cmd requires an argument: --cmd CMD" >&2 | |
|
1900 | exit 1 | |
|
1901 | fi | |
|
1902 | ;; | |
|
1750 | 1903 | |
|
1751 | 1904 | -?*) |
|
1752 | 1905 | printf "invalid option: %s\n" "$key" >&2 |
@@ -1764,6 +1917,87 b' dev_tools_celery_parse_requirements() {' | |||
|
1764 | 1917 | esac |
|
1765 | 1918 | done |
|
1766 | 1919 | |
|
1920 | # :command.default_assignments | |
|
1921 | [[ -n ${args['--workdir']:-} ]] || args['--workdir']="/home/rhodecode/rhodecode-enterprise-ce" | |
|
1922 | [[ -n ${args['--cmd']:-} ]] || args['--cmd']=".dev/cmd-celery.sh" | |
|
1923 | ||
|
1924 | } | |
|
1925 | ||
|
1926 | # :command.parse_requirements | |
|
1927 | dev_tools_celeryd_parse_requirements() { | |
|
1928 | # :command.fixed_flags_filter | |
|
1929 | while [[ $# -gt 0 ]]; do | |
|
1930 | case "${1:-}" in | |
|
1931 | --help | -h) | |
|
1932 | long_usage=yes | |
|
1933 | dev_tools_celeryd_usage | |
|
1934 | exit | |
|
1935 | ;; | |
|
1936 | ||
|
1937 | *) | |
|
1938 | break | |
|
1939 | ;; | |
|
1940 | ||
|
1941 | esac | |
|
1942 | done | |
|
1943 | ||
|
1944 | # :command.command_filter | |
|
1945 | action="celeryd" | |
|
1946 | ||
|
1947 | # :command.parse_requirements_while | |
|
1948 | while [[ $# -gt 0 ]]; do | |
|
1949 | key="$1" | |
|
1950 | case "$key" in | |
|
1951 | # :flag.case | |
|
1952 | --workdir) | |
|
1953 | ||
|
1954 | # :flag.case_arg | |
|
1955 | if [[ -n ${2+x} ]]; then | |
|
1956 | ||
|
1957 | args['--workdir']="$2" | |
|
1958 | shift | |
|
1959 | shift | |
|
1960 | else | |
|
1961 | printf "%s\n" "--workdir requires an argument: --workdir WORKDIR" >&2 | |
|
1962 | exit 1 | |
|
1963 | fi | |
|
1964 | ;; | |
|
1965 | ||
|
1966 | # :flag.case | |
|
1967 | --cmd) | |
|
1968 | ||
|
1969 | # :flag.case_arg | |
|
1970 | if [[ -n ${2+x} ]]; then | |
|
1971 | ||
|
1972 | args['--cmd']="$2" | |
|
1973 | shift | |
|
1974 | shift | |
|
1975 | else | |
|
1976 | printf "%s\n" "--cmd requires an argument: --cmd CMD" >&2 | |
|
1977 | exit 1 | |
|
1978 | fi | |
|
1979 | ;; | |
|
1980 | ||
|
1981 | -?*) | |
|
1982 | printf "invalid option: %s\n" "$key" >&2 | |
|
1983 | exit 1 | |
|
1984 | ;; | |
|
1985 | ||
|
1986 | *) | |
|
1987 | # :command.parse_requirements_case | |
|
1988 | # :command.parse_requirements_case_simple | |
|
1989 | printf "invalid argument: %s\n" "$key" >&2 | |
|
1990 | exit 1 | |
|
1991 | ||
|
1992 | ;; | |
|
1993 | ||
|
1994 | esac | |
|
1995 | done | |
|
1996 | ||
|
1997 | # :command.default_assignments | |
|
1998 | [[ -n ${args['--workdir']:-} ]] || args['--workdir']="/home/rhodecode/rhodecode-enterprise-ce" | |
|
1999 | [[ -n ${args['--cmd']:-} ]] || args['--cmd']=".dev/cmd-celeryd.sh" | |
|
2000 | ||
|
1767 | 2001 | } |
|
1768 | 2002 | |
|
1769 | 2003 | # :command.parse_requirements |
@@ -2631,6 +2865,7 b' run() {' | |||
|
2631 | 2865 | "ce") dev_tools_ce_command ;; |
|
2632 | 2866 | "svn") dev_tools_svn_command ;; |
|
2633 | 2867 | "celery") dev_tools_celery_command ;; |
|
2868 | "celeryd") dev_tools_celeryd_command ;; | |
|
2634 | 2869 | "sshd") dev_tools_sshd_command ;; |
|
2635 | 2870 | "tools") dev_tools_tools_command ;; |
|
2636 | 2871 | "dev-env") dev_tools_dev_env_command ;; |
General Comments 0
You need to be logged in to leave comments.
Login now