3 Commits

Author SHA1 Message Date
Tran Anh Tuan
2957d7f04d chore(deploy): Add file deploy.sh 2025-12-11 12:12:01 +07:00
Tran Anh Tuan
d722a89d54 chore(deploy): Add file deploy.sh 2025-12-11 12:08:02 +07:00
95702b8370 Update Task.md 2025-12-08 16:07:04 +07:00
2 changed files with 38 additions and 31 deletions

31
Task.md
View File

@@ -1,31 +0,0 @@
- Goal:
Add new localization (i18n) to my website using the Internationalization plugin of Umi Max so that users can switch between Vietnamese and English.
- Tasks for you:
1. Create full base setup for i18n in Umi Max, including:
+ Required configuration in config/config.ts
+ Folder structure for locales
+ Base translation files (vi-VN.ts, en-US.ts)
+ Any needed runtime or app-level configuration
2. Provide sample code for:
+ Using i18n inside components (useIntl, <FormattedMessage />, etc.)
+ Creating a language switcher component
3. Write a clear usage guide explaining:
+ Where to place all files
+ How to import and use translations
+ How to switch languages at runtime
Make sure all examples are valid for Umi Max (Umi 4.5.0). Checked task you complete

38
deploy.sh Executable file
View File

@@ -0,0 +1,38 @@
#!/bin/bash
# ====== CONFIG =======
REMOTE_HOST="root@192.168.30.102"
REMOTE_DIR="/var/lib/nginx"
ZIP_FILE="dist.zip"
TMP_REMOTE_ZIP="/tmp/build.zip"
# =====================
echo "🔄 Copy file zip lên remote..."
scp "$ZIP_FILE" "$REMOTE_HOST:$TMP_REMOTE_ZIP"
echo "📦 Giải nén & deploy trên remote..."
ssh "$REMOTE_HOST" << EOF
set -e
# echo "👉 Xoá thư mục cũ (nếu muốn)..."
# rm -rf $REMOTE_DIR/*
# echo "👉 Tạo thư mục nếu chưa có..."
# mkdir -p $REMOTE_DIR
echo "👉 Giải nén file build.zip..."
unzip -o $TMP_REMOTE_ZIP -d $REMOTE_DIR
echo " Move..."
cd $REMOTE_DIR
mv dist web
echo "👉 Xoá file zip tạm..."
rm $TMP_REMOTE_ZIP
echo "🔁 Restart nginx..."
sudo systemctl restart nginx
echo "✅ Deploy thành công!"
EOF