11#! /bin/bash
22set -e
33
4- EFS_MOUNT_POINT =" /opt/amazon /sagemaker"
5- EBS_MOUNT_POINT =" /home/ sagemaker-user "
4+ export PERSISTENT_VOLUME_EXTENSIONS_DIR =" /home/sagemaker-user /sagemaker-code-editor-server-data/extensions "
5+ export IMAGE_EXTENSIONS_DIR =" /opt/amazon/ sagemaker/sagemaker-ui-code-editor-server-data/extensions "
66
7- persistent_settings_folder=" ${EBS_MOUNT_POINT} /sagemaker-code-editor-server-data"
8- default_settings_folder=" ${EFS_MOUNT_POINT} /sagemaker-code-editor-server-data"
7+ CONTAINER_SAGEMAKER_METADATA_PATH=" /opt/amazon/sagemaker"
8+ EBS_MOUNT_PATH=" /home/sagemaker-user"
9+
10+ persistent_ebs_settings_folder=" ${EBS_MOUNT_PATH} /sagemaker-code-editor-server-data"
11+ container_settings_folder=" ${CONTAINER_SAGEMAKER_METADATA_PATH} /sagemaker-ui-code-editor-server-data"
912
1013override_machine_settings () {
1114 # create a new settings file with preset defaults or merge the defaults into the existing settings file
1215 local settings_relative_path=" data/Machine"
1316 local settings_file_path_suffix=" ${settings_relative_path} /settings.json"
14- local persistent_machine_settings_file=" ${persistent_settings_folder } /${settings_file_path_suffix} "
15- local default_machine_settings_file=" ${default_settings_folder } /${settings_file_path_suffix} "
17+ local persistent_machine_settings_file=" ${persistent_ebs_settings_folder } /${settings_file_path_suffix} "
18+ local default_machine_settings_file=" ${container_settings_folder } /${settings_file_path_suffix} "
1619
1720 if [ ! -f " $persistent_machine_settings_file " ]; then
1821 # copy settings file to EBS if it doesn't exist in EBS
19- mkdir -p " ${persistent_settings_folder } /${settings_relative_path} "
22+ mkdir -p " ${persistent_ebs_settings_folder } /${settings_relative_path} "
2023 cp " $default_machine_settings_file " " $persistent_machine_settings_file "
2124 echo " Created persistent settings file with default settings at $persistent_machine_settings_file "
2225 else
@@ -29,19 +32,19 @@ override_machine_settings() {
2932copy_user_settings () {
3033 local settings_relative_path=" data/User"
3134 local settings_file_path_suffix=" ${settings_relative_path} /settings.json"
32- local persistent_user_settings_file=" ${persistent_settings_folder } /${settings_file_path_suffix} "
33- local default_user_settings_file=" ${default_settings_folder } /${settings_file_path_suffix} "
35+ local persistent_user_settings_file=" ${persistent_ebs_settings_folder } /${settings_file_path_suffix} "
36+ local default_user_settings_file=" ${container_settings_folder } /${settings_file_path_suffix} "
3437 if [ ! -f " $persistent_user_settings_file " ]; then
3538 # copy user settings file to EBS if it doesn't exist in EBS
36- mkdir -p " ${persistent_settings_folder } /${settings_relative_path} "
39+ mkdir -p " ${persistent_ebs_settings_folder } /${settings_relative_path} "
3740 cp " $default_user_settings_file " " $persistent_user_settings_file "
3841 echo " Created persistent settings file with default settings at $persistent_user_settings_file "
3942 fi
4043}
4144
4245install_prepackaged_extensions () {
43- local prepackaged_extensions_dir=" ${default_settings_folder } /extensions"
44- local persistent_extensions_dir=" ${persistent_settings_folder } /extensions"
46+ local prepackaged_extensions_dir=" ${container_settings_folder } /extensions"
47+ local persistent_extensions_dir=" ${persistent_ebs_settings_folder } /extensions"
4548
4649 # if extensions directory doesn't exist then this is the first time opening the app
4750 if [ ! -d " ${persistent_extensions_dir} " ]; then
@@ -95,8 +98,8 @@ if [ -n "$SAGEMAKER_APP_TYPE_LOWERCASE" ]; then
9598 sagemaker-code-editor --host 0.0.0.0 --port 8888 \
9699 --without-connection-token \
97100 --base-path " /$SAGEMAKER_APP_TYPE_LOWERCASE /default" \
98- --server-data-dir $persistent_settings_folder \
99- --extensions-dir ${persistent_settings_folder } /extensions \
101+ --server-data-dir $persistent_ebs_settings_folder \
102+ --extensions-dir ${persistent_ebs_settings_folder } /extensions \
100103 --user-data-dir /opt/amazon/sagemaker/sagemaker-code-editor-user-data
101104else
102105 sagemaker-code-editor --host 0.0.0.0 --port 8888 \
0 commit comments