From 03862ffb5494b2bef40f8b62488975b1947f555c Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun, 18 Jan 2026 18:23:19 +0000 Subject: [PATCH] feat: Add Tencent Cloud deployment script Adds a script and README for deploying the static website from the 'docs/' directory to Tencent Cloud Object Storage (COS). --- README-TENCENT.md | 51 +++++++++++++++++++++++++++++++++++++++++++++++ tencent_deploy.sh | 43 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 README-TENCENT.md create mode 100755 tencent_deploy.sh diff --git a/README-TENCENT.md b/README-TENCENT.md new file mode 100644 index 0000000..d47ebcb --- /dev/null +++ b/README-TENCENT.md @@ -0,0 +1,51 @@ +# Tencent Cloud Static Website Deployment + +This document provides instructions on how to deploy the static website in the `docs/` directory to Tencent Cloud Object Storage (COS). + +## Prerequisites + +1. **Tencent Cloud Account:** You will need a Tencent Cloud account. If you don't have one, you can sign up on the [Tencent Cloud website](https://www.tencentcloud.com/). + +2. **AWS CLI:** The deployment script uses the AWS CLI, which is compatible with Tencent's S3-like API for COS. You can install it using pip: + ```bash + pip install awscli + ``` + +3. **API Credentials:** You need to create an API key (SecretId and SecretKey) in the Tencent Cloud console. + - Navigate to the [API Key Management page](https://console.cloud.tencent.com/cam/capi). + - Create a new key and save the SecretId and SecretKey securely. + +4. **Configure AWS CLI:** Configure the AWS CLI with your Tencent Cloud credentials. Run the following command and enter your credentials when prompted: + ```bash + aws configure + ``` + - **AWS Access Key ID:** Enter your Tencent Cloud SecretId. + - **AWS Secret Access Key:** Enter your Tencent Cloud SecretKey. + - **Default region name:** Enter a Tencent Cloud region, for example, `ap-guangzhou`. + - **Default output format:** You can leave this as `json`. + +## Deployment + +The `tencent_deploy.sh` script automates the process of creating a COS bucket, configuring it for static website hosting, and uploading the website files. + +### Usage + +1. **Make the script executable:** + ```bash + chmod +x tencent_deploy.sh + ``` + +2. **Run the script:** + ```bash + ./tencent_deploy.sh + ``` + - ``: A unique name for your COS bucket (e.g., `my-static-website-123`). + - ``: The Tencent Cloud region where you want to create the bucket (e.g., `ap-guangzhou`). + + **Example:** + ```bash + ./tencent_deploy.sh my-awesome-static-site ap-singapore + ``` + +3. **Access your website:** + After the script finishes, it will print the URL of your deployed website. You can open this URL in your browser to see your live website. diff --git a/tencent_deploy.sh b/tencent_deploy.sh new file mode 100755 index 0000000..a040dd3 --- /dev/null +++ b/tencent_deploy.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +# This script deploys a static website to Tencent Cloud Object Storage (COS). +# It uses the AWS CLI, which is compatible with Tencent COS S3 API. +# +# Prerequisites: +# 1. AWS CLI installed (pip install awscli) +# 2. AWS CLI configured with Tencent Cloud credentials. +# - Create a new API key on the Tencent Cloud console: https://console.cloud.tencent.com/cam/capi +# - Configure the AWS CLI with the SecretId and SecretKey: +# aws configure +# AWS Access Key ID [None]: +# AWS Secret Access Key [None]: +# Default region name [None]: +# Default output format [None]: json +# +# Usage: +# ./tencent_deploy.sh +# e.g., ./tencent_deploy.sh my-static-website ap-guangzhou + +set -e + +BUCKET_NAME=$1 +REGION=$2 +ENDPOINT_URL="cos.${REGION}.myqcloud.com" + +if [ -z "$BUCKET_NAME" ] || [ -z "$REGION" ]; then + echo "Usage: $0 " + exit 1 +fi + +echo "Creating COS bucket: ${BUCKET_NAME}" +aws --endpoint-url "https://${ENDPOINT_URL}" s3 mb "s3://${BUCKET_NAME}" + +echo "Configuring bucket for static website hosting..." +aws --endpoint-url "https://${ENDPOINT_URL}" s3 website "s3://${BUCKET_NAME}" --index-document "index.html" --error-document "index.html" + +echo "Uploading website files from docs/ ..." +aws --endpoint-url "https://cos.${REGION}.myqcloud.com" s3 sync docs/ "s3://${BUCKET_NAME}" --acl public-read + +WEBSITE_URL="http://${BUCKET_NAME}.cos-website.${REGION}.myqcloud.com" +echo "Deployment complete. Your website is available at:" +echo "${WEBSITE_URL}"