-
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
Changes from 11 commits
bb4dba8
e322211
bff33e1
50329bd
f4d1ce4
6ac0e9d
fdbb5be
1f4865c
6da1c42
0d16a64
26e32f7
b17b070
368f415
545f930
012c0e0
93fb8c3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe 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) |
||
fi | ||
fi | ||
|
||
|
@@ -199,6 +199,24 @@ launch_docker_registry () { | |
fi | ||
} | ||
|
||
perform_database_migration() { | ||
CHE_DATA=/data | ||
# Move database to original location | ||
|
||
if [ -f ${CHE_DATA}/storage/db/che.mv.db ]; then | ||
echo "Performing migration of the database file, to it's original old path" | ||
echo "In case if there was already a database file in old path, it will be renamed to 'che.mv.db.old'" | ||
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 commentThe reason will be displayed to describe this comment to others. Learn more. It can be useful to add logs that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
fi | ||
|
||
mv ${CHE_DATA}/storage/db/che.mv.db ${CHE_DATA}/db/che.mv.db | ||
echo "Database has been moved successfuly" | ||
fi | ||
} | ||
|
||
init() { | ||
### Any variables with export is a value that native Tomcat che.sh startup script requires | ||
export CHE_IP=${CHE_IP} | ||
|
@@ -230,12 +248,17 @@ init() { | |
sudo chown -R ${CHE_USER} ${CHE_LOGS_DIR} | ||
fi | ||
|
||
export CHE_DATABASE=/data/storage | ||
export CHE_TEMPLATE_STORAGE=/data/templates | ||
export CHE_WORKSPACE_AGENT_DEV=${CHE_DATA_HOST}/lib/ws-agent.tar.gz | ||
export CHE_WORKSPACE_TERMINAL__LINUX__AMD64=${CHE_DATA_HOST}/lib/linux_amd64/terminal | ||
export CHE_WORKSPACE_TERMINAL__LINUX__ARM7=${CHE_DATA_HOST}/lib/linux_arm7/terminal | ||
export CHE_WORKSPACE_EXEC__LINUX__AMD64=${CHE_DATA_HOST}/lib/linux_amd64/exec | ||
[ -z "$CHE_DATABASE" ] && export CHE_DATABASE=${CHE_DATA} | ||
[ -z "$CHE_TEMPLATE_STORAGE" ] && export CHE_TEMPLATE_STORAGE=${CHE_DATA}/templates | ||
[ -z "$CHE_WORKSPACE_AGENT_DEV" ] && export CHE_WORKSPACE_AGENT_DEV=${CHE_DATA_HOST}/lib/ws-agent.tar.gz | ||
[ -z "$CHE_WORKSPACE_TERMINAL__LINUX__AMD64" ] && export CHE_WORKSPACE_TERMINAL__LINUX__AMD64=${CHE_DATA_HOST}/lib/linux_amd64/terminal | ||
[ -z "$CHE_WORKSPACE_TERMINAL__LINUX__ARM7" ] && export CHE_WORKSPACE_TERMINAL__LINUX__ARM7=${CHE_DATA_HOST}/lib/linux_arm7/terminal | ||
[ -z "$CHE_WORKSPACE_EXEC__LINUX__AMD64" ] && export CHE_WORKSPACE_EXEC__LINUX__AMD64=${CHE_DATA_HOST}/lib/linux_amd64/exec | ||
|
||
echo "!!!" | ||
echo "!!! Starting migration" | ||
echo "!!!" | ||
perform_database_migration | ||
|
||
# CHE_DOCKER_IP_EXTERNAL must be set if you are in a VM. | ||
HOSTNAME=${CHE_DOCKER_IP_EXTERNAL:-$(get_docker_external_hostname)} | ||
|
@@ -244,9 +267,9 @@ init() { | |
export CHE_DOCKER_IP_EXTERNAL=${HOSTNAME} | ||
fi | ||
### Necessary to allow the container to write projects to the folder | ||
export CHE_WORKSPACE_STORAGE__MASTER__PATH=/data/workspaces | ||
export CHE_WORKSPACE_STORAGE="${CHE_DATA_HOST}/workspaces" | ||
export CHE_WORKSPACE_STORAGE_CREATE_FOLDERS=false | ||
[ -z "$CHE_WORKSPACE_STORAGE__MASTER__PATH" ] && export CHE_WORKSPACE_STORAGE__MASTER__PATH=${CHE_DATA}/workspaces | ||
[ -z "$CHE_WORKSPACE_STORAGE" ] && export CHE_WORKSPACE_STORAGE="${CHE_DATA_HOST}/workspaces" | ||
[ -z "$CHE_WORKSPACE_STORAGE_CREATE_FOLDERS" ] && export CHE_WORKSPACE_STORAGE_CREATE_FOLDERS=false | ||
|
||
# Move files from /lib to /lib-copy. This puts files onto the host. | ||
rm -rf ${CHE_DATA}/lib/* | ||
|
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
https://github.com/eclipse/che/blob/93b974d1e0ec7836635f3d7da196b7651da8ad1b/dockerfiles/che/entrypoint.sh#L233
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