-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Che using different database path in different versions #8073
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please read comments, we need to handle ONLY vars that set value, vars like
export VAR=${VAR:-${DEFAULT_VAR}}
are OK as they already pick vars from ENV
dockerfiles/che/entrypoint.sh
Outdated
@@ -47,10 +47,10 @@ Variables: | |||
|
|||
# Must be exported as this will be needed by Tomcat's JVM | |||
DEFAULT_CHE_REGISTRY_HOST=localhost | |||
export CHE_REGISTRY_HOST=${CHE_REGISTRY_HOST:-${DEFAULT_CHE_REGISTRY_HOST}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in that case we don;t need any change because it already pick value fom ENV VAR
dockerfiles/che/entrypoint.sh
Outdated
|
||
DEFAULT_CHE_PORT=8080 | ||
export CHE_PORT=${CHE_PORT:-${DEFAULT_CHE_PORT}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in that case we don;t need any change because it already pick value fom ENV VAR
dockerfiles/che/entrypoint.sh
Outdated
@@ -59,7 +59,7 @@ Variables: | |||
CHE_LOG_LEVEL=${CHE_LOG_LEVEL:-${DEFAULT_CHE_LOG_LEVEL}} | |||
|
|||
DEFAULT_CHE_LOGS_DIR="${CATALINA_HOME}/logs/" | |||
export CHE_LOGS_DIR=${CHE_LOGS_DIR:-${DEFAULT_CHE_LOGS_DIR}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in that case we don;t need any change because it already pick value fom ENV VAR
dockerfiles/che/entrypoint.sh
Outdated
CHE_DATA_HOST=$(get_che_data_from_host) | ||
|
||
CHE_USER=${CHE_USER:-root} | ||
export CHE_USER=$CHE_USER | ||
[ -z "$CHE_USER" ] && export CHE_USER=$CHE_USER |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why you changed that?
dockerfiles/che/entrypoint.sh
Outdated
if [ "$CHE_USER" != "root" ]; then | ||
if [ ! $(getent group docker) ]; then | ||
echo "!!!" | ||
echo "!!! Error: The docker group doesn't exist." | ||
echo "!!!" | ||
exit 1 | ||
fi | ||
export CHE_USER_ID=${CHE_USER} | ||
[ -z "$CHE_USER_ID" ] && export CHE_USER_ID=${CHE_USER} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why you changed that?
dockerfiles/che/entrypoint.sh
Outdated
|
||
# CHE_DOCKER_IP_EXTERNAL must be set if you are in a VM. | ||
HOSTNAME=${CHE_DOCKER_IP_EXTERNAL:-$(get_docker_external_hostname)} | ||
if has_external_hostname; then | ||
# Internal property used by Che to set hostname. | ||
export CHE_DOCKER_IP_EXTERNAL=${HOSTNAME} | ||
[ -z "$CHE_DOCKER_IP_EXTERNAL" ] && export CHE_DOCKER_IP_EXTERNAL=${HOSTNAME} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why you changed that?
… into fix-entrypoint
dockerfiles/che/entrypoint.sh
Outdated
echo "See issue https://github.com/eclipse/che/issues/8068 for details" | ||
#in case if there is existing database in old path, back it up | ||
if [ -f ${CHE_DATA}/db/che.mv.db ]; then | ||
mv ${CHE_DATA}/db/che.mv.db ${CHE_DATA}/db/che.mv.db.old |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be useful to add logs that old
database is backed up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
…pse/che into fix-entrypoint
@@ -11,7 +11,7 @@ | |||
|
|||
### CHE SERVER | |||
# Folder where Che will store internal data objects | |||
che.database=${che.home}/storage | |||
che.database=${che.home} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why it's not anymore in a subfolder ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was like so in Che instances, that were running through CLI for a long while because of this che.env.erb:
https://github.com/eclipse/che/blob/56866159228bf4ba1d3b7fc8d2206c60b129579b/dockerfiles/init/modules/che/templates/che.env.erb#L36
So, the values from the che.properties or entrypoint.sh, which would point to path with "storage" directory had no effect, until recently (which was the issue cause)
I decided to consolidate everything by old path, though if you think extra "storage" directory is better, it can be changed to that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say that it looks odd to have a "root" directory as path for che database so yes using a subfolder would be better IMHO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@benoitf Am I understand you correctly. You want to change db file location.
Add extra path "storage" to what we have in Che5?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. From what I see there is a 'db' subfolder added
It's not directly stored inside the che.home folder
@benoitf I changed the PR, and updated the description, describing how it works now
|
dockerfiles/che/entrypoint.sh
Outdated
@@ -84,7 +84,7 @@ set_environment_variables () { | |||
# CHE_DOCKER_IP is used internally by Che to set its IP address | |||
if [[ -z "${CHE_DOCKER_IP}" ]]; then | |||
if [[ -n "${CHE_IP}" ]]; then | |||
export CHE_DOCKER_IP="${CHE_IP}" | |||
export CHE_DOCKER_IP="${CHE_IP}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe you can skip this change from this PR's commit as it's unrelated (it's more a indent fix)
What does this PR do?
Export Che environment variables only if there were not defined
Move database files, that were stored in different paths until and after Che 6.0.0-M3 version:
Database will be stored at path "/data/storage/db/che.mv.db"
If there is a database at old path present ("data/db/che.mv.db"), a warning will be shown in Che container logs, and, if no database is present by the new path, it will be moved there
What issues does this PR fix or reference?
should fix #8068
Fix Che using different database path in different versions.
entypoint.sh will not overwrite Che environment variables, if they were already defined
Release Notes
Docs PR
N/A