##// END OF EJS Templates
core: various changes
super-admin -
Show More
@@ -0,0 +1,46 b''
1 # Quick list of action to migrate old pre 4.28.0 installer based releases to docker stack
2
3 ### 1. Decide on components use
4
5 By default RhodeCode stack uses Redis and Postgres.
6 We recommend using those in Docker as things like
7 backup/restore are much easier, and possible to run by our installer
8
9 If you plan to use your own redis or DB, uncomment/disable those services in file:
10 `docker-compose-services.override.yaml`
11
12 Select your DB type by commenting postgres or mysql db in docker-compose-services.override.yaml
13 For Sqlite, comment out both DB types
14
15 ### 2. launch stack based on get started
16
17 Run a quick start guide based on ./rccontrol get-started
18
19 ### 3. make a db dump
20 If docker-based DB is selected
21 Create a database backup from your db type
22 If you plan to use you old running DB, this step can be ommited
23
24 ### 4. restore db
25 If docker-based DB is selected
26 Restore the database into docker container running DB
27
28 ### mv repositories data to .custom/storage
29
30 ### mv gists data to .custom/storage
31
32 ### mv artifacts data to .custom/storage
33
34 ### mv tarball cache data to .custom/storage
35
36 ### ./rccontrol cli storage
37
38 ### move repos to /vol/repovolume
39
40 ### move artifacts data to /vol/datavolume
41
42 ### move tarballcache data to /vol/datavolume
43
44 ### cp rhodecode.ini to config/_shared/rhodecode.ini
45
46 ### cp vcsserver.ini to config/_shared/vcsserver.ini No newline at end of file
@@ -0,0 +1,5 b''
1 #!/usr/bin/env bash
2
3 cd scripts/rccontrol/
4 #alias bashly='docker run --rm -it --user $(id -u):$(id -g) --volume "$PWD:/app" dannyben/bashly:edge'
5 docker run --rm -it --user $(id -u):$(id -g) --volume "$PWD:/app" dannyben/bashly:edge generate --watch
@@ -1,31 +1,32 b''
1 1 defaults:
2 2 # metrics expiration
3 # 2 days
3 4 ttl: 48h
4 5
5 6 mappings:
6 7
7 8 - match: "*.histogram"
8 9 name: "${1}"
9 10 observer_type: histogram
10 11 histogram_options:
11 12 buckets: [.1, .25, .5, .75, 1, 1.5, 2, 5, 10]
12 13
13 14 - match: "*.slow_histogram"
14 15 name: "${1}"
15 16 observer_type: histogram
16 17 histogram_options:
17 18 buckets: [.1, .25, .5, 1, 2, 5, 10, 30, 60]
18 19
19 20 - match: "*.summary"
20 21 name: "${1}"
21 22 observer_type: summary
22 23 summary_options:
23 24 quantiles:
24 25 - quantile: 0.99
25 26 error: 0.001
26 27 - quantile: 0.95
27 28 error: 0.01
28 29 - quantile: 0.9
29 30 error: 0.05
30 31 - quantile: 0.5
31 32 error: 0.005
@@ -1,156 +1,162 b''
1 1 #!/usr/bin/env bash
2 2 set -Eeo pipefail
3 3
4 4 function config_copy() {
5 5 # copy over the configs if they don't exist
6 echo "checking if config files needs bootstrapping"
6 7 for f in /etc/rhodecode/conf_build/*; do
7 8 fname=${f##*/}
8 9 if [ ! -f "/etc/rhodecode/conf/$fname" ]; then
9 10 echo "$fname not exists copying over as default conf..."
10 11 cp -v $f /etc/rhodecode/conf/$fname
11 12 fi
12 13 done
13 14
14 15 }
15 16
16 17 function db_upgrade() {
17 18 echo 'ENTRYPOINT: Upgrading database.'
18 19 /usr/local/bin/rhodecode_bin/bin/rc-upgrade-db $MAIN_INI_PATH --force-yes
19 20 }
20 21
21 22 function db_init() {
22 23
23 24 gosu $RC_USER \
24 25 /usr/local/bin/rhodecode_bin/bin/rc-setup-app \
25 26 $MAIN_INI_PATH \
26 27 --force-yes \
27 28 --skip-existing-db \
28 29 --user=$RHODECODE_USER_NAME \
29 30 --password=$RHODECODE_USER_PASS \
30 31 --email=$RHODECODE_USER_EMAIL \
31 32 --repos=$RHODECODE_REPO_DIR
32 33 }
33 34
34 35 function rhodecode_setup() {
35 36 for f in /home/$RC_USER/.rccontrol/bootstrap/*.py; do
36 37 fname=${f##*/}
37 38
38 39 echo "Running script $fname on $RC_TYPE_ID"
39 40 gosu $RC_USER /usr/local/bin/rhodecode_bin/bin/rc-ishell $MAIN_INI_PATH <<< "%run $f"
40 41
41 42 done
42 43 }
43 44
44 45 function generate_ssh_keys() {
45 46 keys_dir=/etc/rhodecode/conf/ssh
46 47
47 48 if [[ ! -d $keys_dir ]]; then
48 49 echo "Generating $keys_dir/ssh_host_rsa_key ..."
49 50 gosu "$RC_USER" mkdir -p $keys_dir
50 51 fi
51 52
52 53 # Generate ssh host key for the first time
53 54 if [[ ! -f $keys_dir/ssh_host_rsa_key ]]; then
54 55 echo "Generating $keys_dir/ssh_host_rsa_key ..."
55 56 gosu "$RC_USER" ssh-keygen -f $keys_dir/ssh_host_rsa_key -N '' -t rsa
56 57 gosu "$RC_USER" chmod 0600 $keys_dir/ssh_host_rsa_key
57 58 fi
58 59
59 60 if [[ ! -f $keys_dir/ssh_host_ecdsa_key ]]; then
60 61 echo "Generating $keys_dir/ssh_host_ecdsa_key ..."
61 62 gosu "$RC_USER" ssh-keygen -f $keys_dir/ssh_host_ecdsa_key -N '' -t ecdsa
62 63 gosu "$RC_USER" chmod 0600 $keys_dir/ssh_host_ecdsa_key
63 64 fi
64 65
65 66 if [[ ! -f $keys_dir/ssh_host_ed25519_key ]]; then
66 67 echo "Generating $keys_dir/ssh_host_ed25519_key ..."
67 68 gosu "$RC_USER" ssh-keygen -f $keys_dir/ssh_host_ed25519_key -N '' -t ed25519
68 69 gosu "$RC_USER" chmod 0600 $keys_dir/ssh_host_ed25519_key
69 70 fi
70 71
71 72 if [[ ! -f $keys_dir/authorized_keys ]]; then
72 73 echo "Generating $keys_dir/authorized_keys..."
73 74 gosu "$RC_USER" touch $keys_dir/authorized_keys
74 75 fi
75 76
76 77 sed -i "s/AllowUsers USER/AllowUsers $RC_USER/" $SSHD_CONF_FILE
77 78 }
78 79
79 80
80 81 echo "ENTRYPOINT: Running $RC_APP_TYPE with cmd '$1'"
81 82
82 83 if [ "$SSH_BOOTSTRAP" = 1 ]; then
83 84 # generate SSH keys
84 85 generate_ssh_keys
85 86 fi
86 87
87 88 isLikelyWeb=
88 89 case "$1" in
89 90 supervisord | pserve | gunicorn ) isLikelyWeb=1 ;;
90 91 esac
91 92
93 if [[ $RC_APP_TYPE = "rhodecode_vcsserver" ]]; then
94 # copy over default configuration files
95 config_copy
96 fi
97
92 98 if [[ $RC_APP_TYPE = "rhodecode_http" ]]; then
93 99
100 # copy over default configuration files
101 config_copy
102
94 103 DB_INIT_FILE=/var/opt/rhodecode_data/.dbinit_bootstrapped
95 104 if [ "$FORCE_DB_INIT_FILE" = 1 ]; then
96 105 rm $DB_INIT_FILE
97 106 fi
98 107
99 108 # Avoid DB_INIT to run multiple times
100 109 if [[ ! -e $DB_INIT_FILE ]]; then
101 110 echo "ENTRYPOINT: Starting $RC_APP_TYPE initial db bootstrap"
102 111
103 112 db_init
104 113
105 114 gosu $RC_USER touch "$DB_INIT_FILE"
106 115 echo "ENTRYPOINT: marked as db-bootstrapped at $DB_INIT_FILE"
107 116
108 117 fi
109 118
110 119 RC_SETUP_FILE=/var/opt/rhodecode_data/.setup_bootstrapped
111 120 if [ "$FORCE_RC_SETUP_APP" = 1 ]; then
112 121 rm $RC_SETUP_FILE
113 122 fi
114 123
115 124 # Avoid destroying bootstrapping by simple start/stop
116 125 if [[ ! -e $RC_SETUP_FILE ]]; then
117 126 echo "ENTRYPOINT: Starting $RC_APP_TYPE initial bootstrap"
118 127
119 # copy over default configuration files
120 config_copy
121
122 128 # setup application with specific options
123 129 if [ "$SETUP_APP" = 1 ]; then
124 130 rhodecode_setup
125 131 fi
126 132
127 133 gosu $RC_USER touch "$RC_SETUP_FILE"
128 134 echo "ENTRYPOINT: marked as setup-bootstrapped at $RC_SETUP_FILE"
129 135
130 136 fi
131 137
132 138 if [ "$DB_UPGRADE" = 1 ]; then
133 139 # run DB migrate
134 140 echo "Found DB_UPGRADE flag, running DB upgrade"
135 141 db_upgrade
136 142 fi
137 143
138 144 fi
139 145
140 146
141 147 if [[ $RC_APP_TYPE = "rhodecode_sshd" ]]; then
142 148 # Fix problem with Missing privilege separation directory error
143 149 mkdir -p /run/sshd
144 150 fi
145 151
146 152 if [[ $RC_APP_TYPE = "rhodecode_svn" ]]; then
147 153 set -- tini -- "$@"
148 154 fi
149 155
150 156 if [ "$RC_APP_PROC" = 1 ]; then
151 157 # Fix problem with zombie processes when using executables like supervisord/gunicorn
152 158 set -- tini -- "$@"
153 159 set -- gosu $RC_USER "$@"
154 160 fi
155 161
156 162 exec "$@"
@@ -1,47 +1,47 b''
1 1 #!/usr/bin/env bash
2 2 set -euo pipefail
3 3 IFS=$'\n\t'
4 4
5 5 #export RC_VERSION="4.28.0.REL20221120_SOURCE"
6 6 #docker image tag 94977371485a rhodecode/rhodecode-ee:4.27.0.DEV_BUILD
7 7
8 8
9 9 usage="$(basename "$0") ./dev.sh <COMMAND> -- run docker command
10 10 where <COMMAND>:
11 11 v|vcs -- run bash console for vcsserver
12 12 e|ee -- run bash console for rhodecode-ee
13 13 c|ce -- run bash console for rhodecode-ce
14 14 dev-env -- create dev env required to run vcsserver and rhodecode
15 15 prune -- clear disk space for docker
16 16 "
17 17
18 18 case ${1:-} in
19 19
20 20 v|vcs )
21 21 eval "(docker stop dev-vcsserver || echo skip-stop ) && ./rccontrol stack rhodecode -f docker-compose-apps.dev.yaml run --service-ports --rm --use-aliases --workdir="/home/rhodecode/rhodecode-vcsserver" --name="dev-vcsserver" vcsserver bash"
22 22 exit
23 23 ;;
24 24 e|ee )
25 25 eval "(docker stop dev-enterprise-ee || echo skip-stop ) && ./rccontrol stack rhodecode -f docker-compose-apps.dev.yaml run -e RC_APP_TYPE=rhodecode_bash --publish 10020:10020 --rm --use-aliases --workdir="/home/rhodecode/rhodecode-enterprise-ee" --name="dev-enterprise-ee" rhodecode bash"
26 26 exit
27 27 ;;
28 28 c|ce )
29 29 eval "(docker stop dev-enterprise-ce || echo skip-stop ) && ./rccontrol stack rhodecode -f docker-compose-apps.dev.yaml run --publish 10022:10020 --rm --use-aliases --workdir="/home/rhodecode/rhodecode-enterprise-ce" --name="dev-enterprise-ce" rhodecode bash"
30 30 exit
31 31 ;;
32 32 dev-env )
33 eval "./rccontrol stack metrics up --detach statsd-exporter && ./rccontrol stack services up --detach && ./rccontrol stack rhodecode up --detach celery celery-beat && ./rccontrol status -s"
33 eval "./rccontrol stack metrics up --detach statsd-exporter && ./rccontrol stack services up --detach && ./rccontrol stack rhodecode up --detach celery celery-beat && ./rccontrol status"
34 34 exit
35 35 ;;
36 36 prune )
37 37 docker system prune -f
38 38 docker builder prune -a -f
39 39 docker image prune -a -f
40 40 docker system df
41 41 exit
42 42 ;;
43 43 * )
44 44 echo "${usage}"
45 45 exit
46 46 ;;
47 47 esac
General Comments 0
You need to be logged in to leave comments. Login now