diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..a0453fd --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +.git/ +Dockerfile +*.Dockerfile +README.md +LICENSE +.yml diff --git a/Dockerfile b/Dockerfile index 22ceaa8..cabdb22 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,28 @@ RUN mkdir -p /app WORKDIR /app COPY . . +EXPOSE 7777 + +# Rclone Environment setup +ENV RCLONE_CONFIG=/app/.config/rclone/rclone.conf +ENV RCLONE_VERBOSE=2 +ENV RCLONE_DRIVE_TPSLIMIT=3 +ENV RCLONE_LOG_FILE=rcloneLog.txt +ENV RCLONE_PROGRESS=true +# ENV RCLONE_SERVER_SIDE_ACROSS_CONFIGS=true +ENV RCLONE_DRIVE_ACKNOWLEDGE_ABUSE=true +ENV RCLONE_ORDER_BY=size,ascending +ENV RCLONE_DRIVE_PACER_MIN_SLEEP=15ms +ENV RCLONE_DRIVE_PACER_BURST=0 + +ENV SA="--drive-service-account-file=/app/.config/rclone/sa-accounts/credentials.json" + +# set bash alias +RUN echo 'alias urc="curl -s "$RCLONE_CONFIG_URL" > $RCLONE_CONFIG"' >> .bashrc + + + + RUN chmod +x setup.sh && sh setup.sh #install megatools diff --git a/README.md b/README.md index 5edce98..4e9686c 100644 --- a/README.md +++ b/README.md @@ -9,21 +9,27 @@ - `BOT_TOKEN` - `OWNER_ID` - `RCLONE_CONFIG_BASE64` + - `PORT` + - `RCLONE_SA_ZIP_URL` `# Optional ENV . Only use when you will use multiple Service Accounts` - Set B - `BOT_TOKEN` - `OWNER_ID` - `RCLONE_CONFIG_URL` - + - `PORT` + - `RCLONE_SA_ZIP_URL` `# Optional ENV . Only use when you will use multiple Service Accounts` ## Environment variable value sample - Set A - `BOT_TOKEN` : `5562055520:AAHtgue4GLR_02-BlM1bD7rodSsFGaWG5eY` - `OWNER_ID` : 1234567890 - `RCLONE_CONFIG_BASE64` : `I0RyaXZlIHJvb3QKW21kcml2ZV0KdHlwZSA9IGRyaXZlCmNsaWVudF9pZCA9IDY3NTE0MTI3MDU0ODItdTBwbGZpZnU1ZGZnY2poZDdsZDRrbXJ0Z2Z1ZjMxN2ZmaWEuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20KY2xpZW50X3NlY3JldCA9IGhaZHFDazBnX2FnNk83dXhaR0xmUDlvOApzY29wZSA9IGRyaXZlCnRva2VuID0geyJhY2Nlc3NfdG9rZW4iOiJ5YTI5LmJhMEFaN00tN1VKcWNraWRKMy13` + - `PORT` : 7777 + - `RCLONE_SA_ZIP_URL` : `https://example.com/directory/x.zip` `# Optional ENV . Only use when you will use multiple Service Accounts` - Set B - `BOT_TOKEN` : `5562055520:AAHtgue4GLR_02-BlM1bD7rodSsFGaWG5eY` - `OWNER_ID` : 1234567890 - `RCLONE_CONFIG_URL` : `https://example.com/directory/rclone.conf` - + - `PORT` : 7777 + - `RCLONE_SA_ZIP_URL` : `https://example.com/directory/x.zip` `# Optional ENV . Only use when you will use multiple Service Accounts` ## Installation - First collect the values for Set A or Set B Environment diff --git a/heroku.yml b/heroku.yml deleted file mode 100644 index 4632508..0000000 --- a/heroku.yml +++ /dev/null @@ -1,5 +0,0 @@ -build: - docker: - worker: Dockerfile -run: - worker: bash start.sh diff --git a/index.html b/index.html new file mode 100644 index 0000000..019c268 --- /dev/null +++ b/index.html @@ -0,0 +1,74 @@ + + + + + Hello World + + + +
+

👋Hello, World!🌎

+

This is a beautiful static website created using only HTML and CSS.

+
+ Stock Image + Stock Image + Stock Image + Stock Image + Stock Image + Stock Image +
+
+ + + diff --git a/render.yml b/render.yml new file mode 100644 index 0000000..48db24d --- /dev/null +++ b/render.yml @@ -0,0 +1,25 @@ +services: + # A Docker web service + - type: web + name: alist + env: docker + repo: https://github.com/Frozen12/Cloud_Shell_Bot.git # optional + region: oregon # optional (defaults to oregon) + plan: free # optional (defaults to starter) + healthCheckPath: / + envVars: + - key: PORT + value: 9090 + sync: false + - key: OWNER_ID + # value: xxxxxxxxx + sync: false + - key: BOT_TOKEN + # value: xxxxxxxxxx + sync: false + - key: RCLONE_CONFIG_URL + # value: https://xxx.xxx/x/rclone.conf + sync: false + - key: RCLONE_SA_ZIP_URL + # value: https://xxx.xxx/x/x.zip + sync: false diff --git a/setup.sh b/setup.sh index ca2632c..4c86dc0 100644 --- a/setup.sh +++ b/setup.sh @@ -1,14 +1,16 @@ #! /bin/bash +# Set Timezone +rm /etc/localtime +ln -s /usr/share/zoneinfo/Asia/Dhaka /etc/localtime + apt update && apt upgrade -y && apt install -y software-properties-common && apt update && add-apt-repository universe && add-apt-repository multiverse apt update && apt install -y --no-install-recommends \ - python3.8 python3-pip curl wget git \ + python3.8 python3-pip curl wget curl git \ make python-is-python3 build-essential cmake \ - nano \ - zip unzip p7zip-full p7zip-rar \ - ffmpeg fuse \ - rdfind + nano unzip \ + p7zip-full p7zip-rar + -# apt install -y php openssh-server # install node v14.x including npm curl -sL https://deb.nodesource.com/setup_14.x | bash - apt install -y nodejs diff --git a/start.sh b/start.sh index bd2297f..e027a3e 100644 --- a/start.sh +++ b/start.sh @@ -1,33 +1,37 @@ #!/bin/bash # Install rclone static binary -wget -q https://downloads.rclone.org/v1.58.1/rclone-v1.58.1-linux-amd64.zip -unzip -q rclone-*-linux-amd64.zip -export PATH=$PWD/rclone-v1.58.1-linux-amd64:$PATH +wget -q https://downloads.rclone.org/v1.61.1/rclone-v1.61.1-linux-amd64.zip +unzip -q rclone-v1.61.1-linux-amd64.zip +export PATH=$PWD/rclone-v1.61.1-linux-amd64:$PATH echo "Rclone installed successfully" + # remove junk rm -rf rclone-*-linux-amd64.zip *.txt *yml *.md # Create rclone.conf file from base64 if [[ -n $RCLONE_CONFIG_BASE64 ]]; then - echo "Rclone config detected" - echo "[DRIVE]" > rclone.conf - mkdir -p $HOME/.config/rclone - echo "$(echo $RCLONE_CONFIG_BASE64|base64 -d)" >> $HOME/.config/rclone/rclone.conf - echo "Rclone config placed in position" -fi + echo "Rclone config in BASE64 Format detected" + mkdir -p /app/.config/rclone + echo "$(echo $RCLONE_CONFIG_BASE64|base64 -d)" > /app/.config/rclone/rclone.conf # fetch rclone.conf from url +elif [[ -n $RCLONE_CONFIG_URL ]]; then + echo "Rclone config file url detected. Fetching rclone.conf . . ." + mkdir -p /app/.config/rclone + curl -o/app/.config/rclone/rclone.conf "$RCLONE_CONFIG_URL" > /dev/null 2>&1 +fi -if [[ -n $RCLONE_CONFIG_URL ]]; then - echo "Fetching rclone.conf from url" - mkdir -p $HOME/.config/rclone - curl -o$HOME/.config/rclone/rclone.conf "$RCLONE_CONFIG_URL" - +# Rclone Service Account +if [[ -n $RCLONE_SA_ZIP_URL ]]; then + echo "Rclone SA zip url detected. Fetching zip file . . ." + mkdir -p /app/.config/rclone + wget -q -O /app/.config/rclone/sa-accounts.zip "$RCLONE_SA_ZIP_URL" > /dev/null 2>&1 + unzip -qq -o /app/.config/rclone/sa-accounts.zip -d /app/.config/rclone/ + rm /app/.config/rclone/sa-accounts.zip fi # Set bot token & owner ID - if [[ -n $BOT_TOKEN && -n $OWNER_ID ]]; then echo "Bot token and owner ID detected" cd TelegramShellBot-Rclone @@ -36,6 +40,14 @@ fi echo "SETUP COMPLETED" +# Running Additional Commands +curl -s "https://gist.githubusercontent.com/Frozen12/8190e348792a0bf0c5f4f1a62d1f3a8d/raw/Cloud_Shell_Bot_additonal_command.sh" | bash + +python -m http.server 7777 -d /app & +# rclone serve webdav +# rclone serve webdav /root --addr localhost:7777 --user "meshpotato" --pass "strong-fest-rat-Nest6" --log-file=/root/rclone_webdav_log.txt > /dev/null & +echo "rclone serving webdav /root on localhost:7777 --user '"meshpotato"' -pass '"strong-fest-rat-Nest6"'" # start bot echo "starting the bot" + npm start