CSUBOT is an open-source super administrator bot.
This article explains how to deploy CSUBOT by yourself.
Please read this document in full: CSUBOT Bot User Manual
Recommendation: Check the public IP of this machine accessing different websites for checking the current network environment.
Prerequisites#
To deploy CSUBOT by yourself, you need to meet at least the following conditions:
- Own a domain. (At least one subdomain for the backend. In total, two domains are needed for the frontend and backend, but usually, the frontend domain can be provided by the deployment platform.)
- Own a server or deploy on a platform that can host backend services. If you know of a free platform that can host backend services, please do not hesitate to click here to comment and inform the author.
- Have an unrestricted Telegram account to create a Telegram bot and obtain the bot's Token.
- Have an unrestricted Cloudflare account to enable Cloudflare Turnstile CAPTCHA. Register an account at: https://dash.cloudflare.com/
Steps#
- Enable Cloudflare Turnstile
- Deploy the frontend
- Create a Telegram bot
- Configure the backend
Enable Cloudflare Turnstile#
Click this link to open the Cloudflare Turnstile configuration panel Turnstile Component Configuration
Click add widget to add a Turnstile component.
Click Add Hostnames to add the frontend domain. If you plan to use a domain provided by the frontend hosting platform, you can write anything here.
Click the create button, and you will see the Site Key and Secret Key.
Deploy the Frontend#
We will take deploying to a frontend hosting platform as an example.
- Open https://github.com/cjh0613/csubot-vue and fork this repository.
- Choose a deployment platform, such as Cloudflare Pages, Vercel, Netlify, etc.
- Choose to import from the Github repository and select the repository you forked in step one.
Set the working path to the project root directory, and the build command is:
npm install && npm run build
The output directory is:
dist/
Configure the environment variables:
VITE_ENDPOINT=https://xxxx.com <backend URL, needs https>
VITE_SITEKEY=0x4AAAAAABBBBBBBBBBB <Cloudflare Turnstile site key Site Key (the one higher up)>
- Start the deployment, and once completed, you will see the domain provided by the platform. You can also bind your own domain. You will need to wait for DNS configuration and certificate generation.
Create a Telegram Bot#
Private message https://t.me/BotFather and send /newbot
, then follow the bot's prompts to create a new bot. After creation, you will receive a Token.
Configure the Backend#
Environment Variable Reference#
TGWD_TOKEN=<Telegram bot's token, obtained from @botfather>
TGWD_FRONTEND_DOMAIN=<frontend domain, no need for https>
TGWD_SECRET=<fill in anything>
TGWD_PORT=8000
TGWD_CFTS_API_KEY=<Cloudflare Turnstile Secret Key (the one below the site key)>
Using the Binary Executable#
We will take the Linux amd64 operating system as an example.
First, create a new folder.
mkdir csubot && cd csubot
Download the binary executable. For the download link, please open https://github.com/cjh0613/csubot/releases to get the latest link. You may need to click Show all assets
to find the file suitable for your platform.
wget https://github.com/cjh0613/csubot/releases/download/vxxx/csubot-linux-amd64.zip
Since it is a zip format compressed package, unzip it:
unzip csubot-linux-amd64.zip
If you cannot execute this command, please ensure that the unzip
package is successfully installed.
Enter the directory where csubot is located,
Use the following command to view the hidden .env.example
file.
ls -la
Using your text editor (such as nano, vim), create a new file .env
, and configure it based on the example file .env.example
.
Try running:
export $(grep -v '^#' .env | xargs) && ./csubot
Self-Compile#
Execute the command in the project root directory:
go build -o csubot
Try running:
export $(grep -v '^#' .env | xargs) && ./csubot
HTTPS#
The backend does not directly provide https support and can only be accessed via http.
You can configure HTTPS using services like Apache, Nginx, Microsoft Internet Information Services (IIS), etc.
If you are using Cloudflare CDN, you can also set the encryption mode in SSL/TLS encryption to Flexible
. This way, users accessing the Cloudflare server use the automatically configured https protocol by Cloudflare, while Cloudflare accesses your configured backend service server using the http protocol.
Other Versions of This Page#
This article has versions in multiple languages.
If you want to leave a comment, please visit the following webpage:
These pages are for browsing only and do not support comments or messages, but they provide more language options and shorter loading times:
ZH EN ZH-TW JA RU KO CS ES AR FR PT DE TR IT NL SV DA FI PL UK HE RO HU EL HR TH HI BN ID SW VI NO