##// END OF EJS Templates
feat(dev-tools): updated various components for better UX/Debug
super-admin -
Show More
@@ -26,10 +26,10 b' use the following steps:'
26 26 #########################################################
27 27
28 28 # Default SQLite config
29 sqlalchemy.db1.url = sqlite:////home/brian/.rccontrol/enterprise-1/rhodecode.db
29 sqlalchemy.db1.url = sqlite:////home/rhodecode/.rccontrol/enterprise-1/rhodecode.db
30 30
31 31 # Use this example for a PostgreSQL
32 sqlalchemy.db1.url = postgresql://postgres:qwe@localhost/rhodecode
32 sqlalchemy.db1.url = postgresql://postgres:secret@localhost/rhodecode
33 33
34 34 # see sqlalchemy docs for other advanced settings
35 35 sqlalchemy.db1.echo = false
@@ -35,8 +35,8 b' dev_tools_usage() {'
35 35 # :command.usage_commands
36 36 printf "%s\n" "dev-env Commands:"
37 37 printf " %s run bash console for vcsserver\n" "vcs "
38 printf " %s run bash console for rhodecode-ee\n" "ee "
39 38 printf " %s run bash console for rhodecode-ce\n" "ce "
39 printf " %s run bash console for rhodecode-ee\n" "ee "
40 40 printf " %s run bash console for rhodecode-celery\n" "celery "
41 41 printf " %s run celery instance on top of mounted source code, e.g ./dev-tools celeryd&\n" "celeryd "
42 42 printf " %s run bash console for rhodecode-ssh\n" "ssh "
@@ -99,7 +99,7 b' dev_tools_vcs_usage() {'
99 99 echo
100 100
101 101 printf "%s\n" "Usage:"
102 printf " dev-tools vcs\n"
102 printf " dev-tools vcs [OPTIONS]\n"
103 103 printf " dev-tools vcs --help | -h\n"
104 104 echo
105 105
@@ -107,6 +107,19 b' dev_tools_vcs_usage() {'
107 107 if [[ -n $long_usage ]]; then
108 108 printf "%s\n" "Options:"
109 109
110 # :command.usage_flags
111 # :flag.usage
112 printf " %s\n" "--workdir WORKDIR"
113 printf " workdir to run the pip install -e on top of can be ce or ee only\n"
114 printf " Default: /home/rhodecode/rhodecode-vcsserver\n"
115 echo
116
117 # :flag.usage
118 printf " %s\n" "--cmd CMD"
119 printf " cmd script to run, this is on host machine, relative to $WORKSPACE_HOME\n"
120 printf " Default: .dev-env/cmd-vcs.sh\n"
121 echo
122
110 123 # :command.usage_fixed_flags
111 124 printf " %s\n" "--help, -h"
112 125 printf " Show this help\n"
@@ -116,29 +129,42 b' dev_tools_vcs_usage() {'
116 129 }
117 130
118 131 # :command.usage
119 dev_tools_ee_usage() {
132 dev_tools_ce_usage() {
120 133 if [[ -n $long_usage ]]; then
121 printf "dev-tools ee - run bash console for rhodecode-ee\n"
134 printf "dev-tools ce - run bash console for rhodecode-ce\n"
122 135 echo
123 136
124 137 else
125 printf "dev-tools ee - run bash console for rhodecode-ee\n"
138 printf "dev-tools ce - run bash console for rhodecode-ce\n"
126 139 echo
127 140
128 141 fi
129 142
130 printf "Alias: e\n"
143 printf "Alias: c\n"
131 144 echo
132 145
133 146 printf "%s\n" "Usage:"
134 printf " dev-tools ee\n"
135 printf " dev-tools ee --help | -h\n"
147 printf " dev-tools ce [OPTIONS]\n"
148 printf " dev-tools ce --help | -h\n"
136 149 echo
137 150
138 151 # :command.long_usage
139 152 if [[ -n $long_usage ]]; then
140 153 printf "%s\n" "Options:"
141 154
155 # :command.usage_flags
156 # :flag.usage
157 printf " %s\n" "--workdir WORKDIR"
158 printf " workdir to run the pip install -e on top of can be ce or ee only\n"
159 printf " Default: /home/rhodecode/rhodecode-enterprise-ce\n"
160 echo
161
162 # :flag.usage
163 printf " %s\n" "--cmd CMD"
164 printf " cmd script to run, this is on host machine, relative to $WORKSPACE_HOME\n"
165 printf " Default: .dev-env/cmd-ce.sh\n"
166 echo
167
142 168 # :command.usage_fixed_flags
143 169 printf " %s\n" "--help, -h"
144 170 printf " Show this help\n"
@@ -148,23 +174,23 b' dev_tools_ee_usage() {'
148 174 }
149 175
150 176 # :command.usage
151 dev_tools_ce_usage() {
177 dev_tools_ee_usage() {
152 178 if [[ -n $long_usage ]]; then
153 printf "dev-tools ce - run bash console for rhodecode-ce\n"
179 printf "dev-tools ee - run bash console for rhodecode-ee\n"
154 180 echo
155 181
156 182 else
157 printf "dev-tools ce - run bash console for rhodecode-ce\n"
183 printf "dev-tools ee - run bash console for rhodecode-ee\n"
158 184 echo
159 185
160 186 fi
161 187
162 printf "Alias: c\n"
188 printf "Alias: e\n"
163 189 echo
164 190
165 191 printf "%s\n" "Usage:"
166 printf " dev-tools ce\n"
167 printf " dev-tools ce --help | -h\n"
192 printf " dev-tools ee\n"
193 printf " dev-tools ee --help | -h\n"
168 194 echo
169 195
170 196 # :command.long_usage
@@ -967,95 +993,114 b' inspect_args() {'
967 993 # :command.function
968 994 dev_tools_vcs_command() {
969 995 # src/vcs_command.sh
970 container_name=dev-vcsserver
971 dev_env_file="/home/rhodecode/rhodecode-vcsserver/.dev/dev-env.sh"
972 env_file=".custom/.dev.env"
973
974 docker_id=$(docker ps -q --filter "name=$container_name")
975
976 if [[ $docker_id ]]; then
977 echo $container_name FOUND, Killing old one !
978 docker kill -s 9 $docker_id
979 sleep 5
980 docker rm -fv $container_name
981 echo "done..."
982 else
983 echo $container_name not found
984 # # bootstrap dev-env.sh
985 # if [[ ! -f $dev_env_file ]]; then
986 # echo "bootstrap of new dev-env file under $dev_env_file"
987 # fi
988 fi
989
990 996 if [[ -v WORKSPACE_HOME ]];
991 997 then
992 998 DEFAULT_WORKSPACE_HOME=$WORKSPACE_HOME
999 echo "Using default WORKSPACE_HOME path: $DEFAULT_WORKSPACE_HOME"
993 1000 else
994 1001 echo "WORKSPACE_HOME env var is not set"
995 1002 exit 1
996 1003 fi
997 1004
998 echo "Using default WORKSPACE_HOME path: $DEFAULT_WORKSPACE_HOME"
1005 code_workdir=${args[--workdir]}
1006 cmd_script=${args[--cmd]}
1007
1008 exec_script=$WORKSPACE_HOME/$cmd_script
1009 container_name=dev-vcsserver
1010 env_file=".custom/.dev.env"
1011
1012 echo "Using exec script: $exec_script"
1013
1014 RC_DEV_CMD_HELP="pserve --reload .dev/dev.ini"
1015
1016 if [[ ! -f $exec_script ]]; then
1017 echo "Generating new $exec_script file..."
1018 mkdir -p $(dirname $exec_script)
1019
1020 cat <<< "
1021 # Generated dev-env script for rhodecode-vcsserver
1022
1023 echo \"Run vcsserver dev using the following command:\"
1024 echo \"++++++++++++++++++++++++++++++++++++++++++++++++++\"
1025 echo \"$RC_DEV_CMD_HELP\"
1026 echo \"++++++++++++++++++++++++++++++++++++++++++++++++++\"
1027 make sh
1028 " > $exec_script
1029 chmod +x $exec_script
1030 fi
1031
1032 docker_exec_script="/var/opt/rhodecode_repo_store/$cmd_script"
999 1033
1000 1034 eval "
1001 WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME \
1035 WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME RC_DEV_CMD_HELP=\"$RC_DEV_CMD_HELP\" \
1002 1036 ./rcstack stack --env-file-path $env_file rhodecode -f docker-compose-apps.dev.yaml \
1003 run -e ENV_FILE= -e RC_ENV_FILE= -e RC_APP_TYPE=rhodecode_sh \
1004 --publish 10010:10010 --rm --use-aliases \
1005 --workdir=\"/home/rhodecode/rhodecode-vcsserver\" \
1037 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 \
1038 --workdir=\"$code_workdir\" \
1039 --name=\"$container_name\" \
1006 1040 --interactive --tty \
1007 --name=\"$container_name\" vcsserver bash $dev_env_file"
1041 --publish 10010:10010 \
1042 vcsserver bash $docker_exec_script"
1008 1043
1009 1044 }
1010 1045
1011 1046 # :command.function
1012 dev_tools_ee_command() {
1013 # src/ee_command.sh
1014 container_name=dev-enterprise-ee
1015 dev_env_file="/home/rhodecode/rhodecode-enterprise-ee/.dev/dev-env.sh"
1016 env_file=".custom/.dev.env"
1017
1018 docker_id=$(docker ps -q --filter "name=$container_name")
1019
1020 if [[ $docker_id ]]; then
1021 echo $container_name FOUND, Killing old one !
1022 docker kill -s 9 $docker_id
1023 sleep 5
1024 docker rm -fv $container_name
1025 echo "done..."
1026 else
1027 echo $container_name not found
1028 # # bootstrap dev-env.sh
1029 # if [[ ! -f $dev_env_file ]]; then
1030 # echo "bootstrap of new dev-env file under $dev_env_file"
1031 # fi
1032 fi
1033
1047 dev_tools_ce_command() {
1048 # src/ce_command.sh
1034 1049 if [[ -v WORKSPACE_HOME ]];
1035 1050 then
1036 1051 DEFAULT_WORKSPACE_HOME=$WORKSPACE_HOME
1052 echo "Using default WORKSPACE_HOME path: $DEFAULT_WORKSPACE_HOME"
1037 1053 else
1038 1054 echo "WORKSPACE_HOME env var is not set"
1039 1055 exit 1
1040 1056 fi
1041 1057
1042 echo "Using default WORKSPACE_HOME path: $DEFAULT_WORKSPACE_HOME"
1058 code_workdir=${args[--workdir]}
1059 cmd_script=${args[--cmd]}
1060
1061 exec_script=$WORKSPACE_HOME/$cmd_script
1062 container_name=dev-enterprise-ce
1063 env_file=".custom/.dev.env"
1064
1065 echo "Using exec script: $exec_script"
1066
1067 RC_DEV_CMD_HELP="pserve --reload .dev/dev.ini"
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 rhodecode-enterprise-ce
1075
1076 echo \"Run rhodecode-enterprise-ce dev using the following command:\"
1077 echo \"++++++++++++++++++++++++++++++++++++++++++++++++++\"
1078 echo \"$RC_DEV_CMD_HELP\"
1079 echo \"++++++++++++++++++++++++++++++++++++++++++++++++++\"
1080 make sh
1081 " > $exec_script
1082 chmod +x $exec_script
1083 fi
1084
1085 docker_exec_script="/var/opt/rhodecode_repo_store/$cmd_script"
1043 1086
1044 1087 eval "
1045 WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME \
1088 WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME RC_DEV_CMD_HELP=\"$RC_DEV_CMD_HELP\" \
1046 1089 ./rcstack stack --env-file-path $env_file rhodecode -f docker-compose-apps.dev.yaml \
1047 run -e ENV_FILE= -e RC_ENV_FILE= -e RC_APP_TYPE=rhodecode_sh --rm --use-aliases \
1048 --publish 10020:10020 --rm --use-aliases \
1049 --workdir=\"/home/rhodecode/rhodecode-enterprise-ee\" \
1090 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 \
1091 --workdir=\"$code_workdir\" \
1092 --name=\"$container_name\" \
1050 1093 --interactive --tty \
1051 --name=\"$container_name\" rhodecode bash $dev_env_file"
1094 --publish 10020:10020 \
1095 rhodecode bash $docker_exec_script"
1096
1052 1097 }
1053 1098
1054 1099 # :command.function
1055 dev_tools_ce_command() {
1056 # src/ce_command.sh
1057 container_name=dev-enterprise-ce
1058 dev_env_file="/home/rhodecode/rhodecode-enterprise-ce/.dev/dev-env.sh"
1100 dev_tools_ee_command() {
1101 # src/ee_command.sh
1102 container_name=dev-enterprise-ee
1103 dev_env_file="/home/rhodecode/rhodecode-enterprise-ee/.dev/dev-env.sh"
1059 1104 env_file=".custom/.dev.env"
1060 1105
1061 1106 docker_id=$(docker ps -q --filter "name=$container_name")
@@ -1089,10 +1134,9 b' dev_tools_ce_command() {'
1089 1134 ./rcstack stack --env-file-path $env_file rhodecode -f docker-compose-apps.dev.yaml \
1090 1135 run -e ENV_FILE= -e RC_ENV_FILE= -e RC_APP_TYPE=rhodecode_sh --rm --use-aliases \
1091 1136 --publish 10020:10020 --rm --use-aliases \
1092 --workdir=\"/home/rhodecode/rhodecode-enterprise-ce\" \
1137 --workdir=\"/home/rhodecode/rhodecode-enterprise-ee\" \
1093 1138 --interactive --tty \
1094 1139 --name=\"$container_name\" rhodecode bash $dev_env_file"
1095
1096 1140 }
1097 1141
1098 1142 # :command.function
@@ -1669,14 +1713,17 b' dev_tools_get_build_source_command() {'
1669 1713 echo "** download rhodecode source for build from $SERVER_URL using '$revision' hash **"
1670 1714 mkdir -p $SOURCE_DIR
1671 1715
1672 echo "getting $SERVER_URL/rhodecode-vcsserver/archive/$RHODECODE_VCS_HASH.tgz"
1673 curl --fail --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/rhodecode-vcsserver/archive/$RHODECODE_VCS_HASH.tgz?with_hash=0 | tar -xz -C $SOURCE_DIR
1716 dl_url="$SERVER_URL/rhodecode-vcsserver/archive/$RHODECODE_VCS_HASH.tgz?with_hash=0"
1717 echo "getting $dl_url"
1718 curl --fail --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $dl_url | tar -xz -C $SOURCE_DIR
1674 1719
1720 dl_url="$SERVER_URL/rhodecode-enterprise-ce/archive/$RHODECODE_CE_HASH.tgz?with_hash=0"
1675 1721 echo "getting $SERVER_URL/rhodecode-enterprise-ce/archive/$RHODECODE_CE_HASH.tgz"
1676 curl --fail --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/rhodecode-enterprise-ce/archive/$RHODECODE_CE_HASH.tgz?with_hash=0 | tar -xz -C $SOURCE_DIR
1722 curl --fail --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $dl_url | tar -xz -C $SOURCE_DIR
1677 1723
1678 echo "getting $SERVER_URL/rhodecode-enterprise-ee/archive/$RHODECODE_EE_HASH.tgz"
1679 curl --fail --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/rhodecode-enterprise-ee/archive/$RHODECODE_EE_HASH.tgz?with_hash=0 | tar -xz -C $SOURCE_DIR
1724 dl_url="$SERVER_URL/rhodecode-enterprise-ee/archive/$RHODECODE_EE_HASH.tgz?with_hash=0"
1725 echo "$dl_url"
1726 curl --fail --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $dl_url | tar -xz -C $SOURCE_DIR
1680 1727
1681 1728 rm -rf $SOURCE_DIR/rhodecode-vcsserver && \
1682 1729 mv $SOURCE_DIR/*rhodecode-vcsserver-* $SOURCE_DIR/rhodecode-vcsserver
@@ -1790,17 +1837,17 b' parse_requirements() {'
1790 1837 shift $#
1791 1838 ;;
1792 1839
1793 ee | e)
1794 action="ee"
1840 ce | c)
1841 action="ce"
1795 1842 shift
1796 dev_tools_ee_parse_requirements "$@"
1843 dev_tools_ce_parse_requirements "$@"
1797 1844 shift $#
1798 1845 ;;
1799 1846
1800 ce | c)
1801 action="ce"
1847 ee | e)
1848 action="ee"
1802 1849 shift
1803 dev_tools_ce_parse_requirements "$@"
1850 dev_tools_ee_parse_requirements "$@"
1804 1851 shift $#
1805 1852 ;;
1806 1853
@@ -1998,6 +2045,35 b' dev_tools_vcs_parse_requirements() {'
1998 2045 while [[ $# -gt 0 ]]; do
1999 2046 key="$1"
2000 2047 case "$key" in
2048 # :flag.case
2049 --workdir)
2050
2051 # :flag.case_arg
2052 if [[ -n ${2+x} ]]; then
2053
2054 args['--workdir']="$2"
2055 shift
2056 shift
2057 else
2058 printf "%s\n" "--workdir requires an argument: --workdir WORKDIR" >&2
2059 exit 1
2060 fi
2061 ;;
2062
2063 # :flag.case
2064 --cmd)
2065
2066 # :flag.case_arg
2067 if [[ -n ${2+x} ]]; then
2068
2069 args['--cmd']="$2"
2070 shift
2071 shift
2072 else
2073 printf "%s\n" "--cmd requires an argument: --cmd CMD" >&2
2074 exit 1
2075 fi
2076 ;;
2001 2077
2002 2078 -?*)
2003 2079 printf "invalid option: %s\n" "$key" >&2
@@ -2015,16 +2091,20 b' dev_tools_vcs_parse_requirements() {'
2015 2091 esac
2016 2092 done
2017 2093
2094 # :command.default_assignments
2095 [[ -n ${args['--workdir']:-} ]] || args['--workdir']="/home/rhodecode/rhodecode-vcsserver"
2096 [[ -n ${args['--cmd']:-} ]] || args['--cmd']=".dev-env/cmd-vcs.sh"
2097
2018 2098 }
2019 2099
2020 2100 # :command.parse_requirements
2021 dev_tools_ee_parse_requirements() {
2101 dev_tools_ce_parse_requirements() {
2022 2102 # :command.fixed_flags_filter
2023 2103 while [[ $# -gt 0 ]]; do
2024 2104 case "${1:-}" in
2025 2105 --help | -h)
2026 2106 long_usage=yes
2027 dev_tools_ee_usage
2107 dev_tools_ce_usage
2028 2108 exit
2029 2109 ;;
2030 2110
@@ -2036,12 +2116,41 b' dev_tools_ee_parse_requirements() {'
2036 2116 done
2037 2117
2038 2118 # :command.command_filter
2039 action="ee"
2119 action="ce"
2040 2120
2041 2121 # :command.parse_requirements_while
2042 2122 while [[ $# -gt 0 ]]; do
2043 2123 key="$1"
2044 2124 case "$key" in
2125 # :flag.case
2126 --workdir)
2127
2128 # :flag.case_arg
2129 if [[ -n ${2+x} ]]; then
2130
2131 args['--workdir']="$2"
2132 shift
2133 shift
2134 else
2135 printf "%s\n" "--workdir requires an argument: --workdir WORKDIR" >&2
2136 exit 1
2137 fi
2138 ;;
2139
2140 # :flag.case
2141 --cmd)
2142
2143 # :flag.case_arg
2144 if [[ -n ${2+x} ]]; then
2145
2146 args['--cmd']="$2"
2147 shift
2148 shift
2149 else
2150 printf "%s\n" "--cmd requires an argument: --cmd CMD" >&2
2151 exit 1
2152 fi
2153 ;;
2045 2154
2046 2155 -?*)
2047 2156 printf "invalid option: %s\n" "$key" >&2
@@ -2059,16 +2168,20 b' dev_tools_ee_parse_requirements() {'
2059 2168 esac
2060 2169 done
2061 2170
2171 # :command.default_assignments
2172 [[ -n ${args['--workdir']:-} ]] || args['--workdir']="/home/rhodecode/rhodecode-enterprise-ce"
2173 [[ -n ${args['--cmd']:-} ]] || args['--cmd']=".dev-env/cmd-ce.sh"
2174
2062 2175 }
2063 2176
2064 2177 # :command.parse_requirements
2065 dev_tools_ce_parse_requirements() {
2178 dev_tools_ee_parse_requirements() {
2066 2179 # :command.fixed_flags_filter
2067 2180 while [[ $# -gt 0 ]]; do
2068 2181 case "${1:-}" in
2069 2182 --help | -h)
2070 2183 long_usage=yes
2071 dev_tools_ce_usage
2184 dev_tools_ee_usage
2072 2185 exit
2073 2186 ;;
2074 2187
@@ -2080,7 +2193,7 b' dev_tools_ce_parse_requirements() {'
2080 2193 done
2081 2194
2082 2195 # :command.command_filter
2083 action="ce"
2196 action="ee"
2084 2197
2085 2198 # :command.parse_requirements_while
2086 2199 while [[ $# -gt 0 ]]; do
@@ -3364,7 +3477,7 b' dev_tools_build_source_parse_requirements() {'
3364 3477
3365 3478 # :command.initialize
3366 3479 initialize() {
3367 version="1.0.0"
3480 version="1.1.0"
3368 3481 long_usage=''
3369 3482 set -e
3370 3483
@@ -3384,8 +3497,8 b' run() {'
3384 3497
3385 3498 case "$action" in
3386 3499 "vcs") dev_tools_vcs_command ;;
3387 "ee") dev_tools_ee_command ;;
3388 3500 "ce") dev_tools_ce_command ;;
3501 "ee") dev_tools_ee_command ;;
3389 3502 "celery") dev_tools_celery_command ;;
3390 3503 "celeryd") dev_tools_celeryd_command ;;
3391 3504 "ssh") dev_tools_ssh_command ;;
General Comments 0
You need to be logged in to leave comments. Login now