Update entrypoint-wrapper.sh
Browse files- entrypoint-wrapper.sh +14 -8
entrypoint-wrapper.sh
CHANGED
|
@@ -1,28 +1,34 @@
|
|
| 1 |
#!/bin/sh
|
| 2 |
|
| 3 |
-
|
|
|
|
| 4 |
|
| 5 |
echo "Entrypoint wrapper: Attempting to create necessary directories in ephemeral FS..."
|
| 6 |
|
| 7 |
echo "Ensuring directory $APP_DATA_DIR exists (for SQLite or other app data)..."
|
| 8 |
mkdir -p "$APP_DATA_DIR"
|
|
|
|
| 9 |
if [ $? -ne 0 ]; then
|
| 10 |
echo "ERROR: Failed to create $APP_DATA_DIR. Application data storage might fail."
|
| 11 |
else
|
| 12 |
echo "$APP_DATA_DIR was created or already exists."
|
| 13 |
-
echo "Listing permissions for
|
| 14 |
-
ls -ld /
|
| 15 |
-
echo "Listing permissions for
|
| 16 |
ls -ld "$APP_DATA_DIR"
|
| 17 |
-
echo "Attempting to create a test file in
|
| 18 |
touch "$APP_DATA_DIR/test_writable.txt"
|
| 19 |
if [ $? -eq 0 ]; then
|
| 20 |
-
echo "
|
| 21 |
rm "$APP_DATA_DIR/test_writable.txt"
|
| 22 |
else
|
| 23 |
-
echo "
|
| 24 |
fi
|
| 25 |
fi
|
| 26 |
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
exec /one-api
|
|
|
|
| 1 |
#!/bin/sh
|
| 2 |
|
| 3 |
+
# 使用临时目录替代 /data
|
| 4 |
+
APP_DATA_DIR="/tmp/data"
|
| 5 |
|
| 6 |
echo "Entrypoint wrapper: Attempting to create necessary directories in ephemeral FS..."
|
| 7 |
|
| 8 |
echo "Ensuring directory $APP_DATA_DIR exists (for SQLite or other app data)..."
|
| 9 |
mkdir -p "$APP_DATA_DIR"
|
| 10 |
+
mkdir -p "$APP_DATA_DIR/logs" # 预先创建logs目录
|
| 11 |
if [ $? -ne 0 ]; then
|
| 12 |
echo "ERROR: Failed to create $APP_DATA_DIR. Application data storage might fail."
|
| 13 |
else
|
| 14 |
echo "$APP_DATA_DIR was created or already exists."
|
| 15 |
+
echo "Listing permissions for /tmp:"
|
| 16 |
+
ls -ld /tmp
|
| 17 |
+
echo "Listing permissions for $APP_DATA_DIR:"
|
| 18 |
ls -ld "$APP_DATA_DIR"
|
| 19 |
+
echo "Attempting to create a test file in $APP_DATA_DIR:"
|
| 20 |
touch "$APP_DATA_DIR/test_writable.txt"
|
| 21 |
if [ $? -eq 0 ]; then
|
| 22 |
+
echo "$APP_DATA_DIR is writable, test file created."
|
| 23 |
rm "$APP_DATA_DIR/test_writable.txt"
|
| 24 |
else
|
| 25 |
+
echo "$APP_DATA_DIR is NOT writable directly by this script for creating files."
|
| 26 |
fi
|
| 27 |
fi
|
| 28 |
|
| 29 |
+
# 设置环境变量,让应用使用临时目录
|
| 30 |
+
export DATA_DIR="$APP_DATA_DIR"
|
| 31 |
+
export LOG_DIR="$APP_DATA_DIR/logs"
|
| 32 |
+
|
| 33 |
+
echo "Entrypoint wrapper: Starting application (expecting it to try $APP_DATA_DIR/logs by default)"
|
| 34 |
exec /one-api
|