初始化xray服务器 #35
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 初始化xray服务器 | |
on: | |
# 手动触发 | |
workflow_dispatch: | |
inputs: | |
logLevel: | |
description: 'Init Trigger' | |
required: false | |
default: 'warning' | |
tags: | |
description: '初始化xray服务器' | |
jobs: | |
job1: | |
name: Init Xray Server | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: 初始化服务器-安装curl工具 | |
uses: cross-the-world/ssh-scp-ssh-pipelines@latest | |
continue-on-error: true | |
with: | |
host: ${{ secrets.VPS_HOST }} | |
user: ${{ secrets.VPS_USER }} | |
pass: ${{ secrets.VPS_PASS }} | |
port: 22 | |
connect_timeout: 10s | |
first_ssh: | | |
sudo rm -f /var/lib/dpkg/lock-frontend | |
sudo rm -f /var/lib/dpkg/lock | |
sudo rm -f /var/cache/apt/archives/lock | |
sudo rm -f /var/lib/dpkg/lock-frontend | |
sudo apt-get install curl -y | |
- name: 初始化服务器-重启前-更新时区 | |
uses: cross-the-world/ssh-scp-ssh-pipelines@latest | |
with: | |
host: ${{ secrets.VPS_HOST }} | |
user: ${{ secrets.VPS_USER }} | |
pass: ${{ secrets.VPS_PASS }} | |
port: 22 | |
connect_timeout: 10s | |
first_ssh: | | |
/bin/bash <(curl -L https://raw.githubusercontent.com/nichuanfang/config-server/master/linux/bash/step1/sync_time_zone.sh) | |
- name: 初始化服务器-重启前-安全防护 | |
uses: cross-the-world/ssh-scp-ssh-pipelines@latest | |
env: | |
PORT: ${{ secrets.VPS_PORT }} | |
with: | |
host: ${{ secrets.VPS_HOST }} | |
user: ${{ secrets.VPS_USER }} | |
pass: ${{ secrets.VPS_PASS }} | |
port: 22 | |
connect_timeout: 10s | |
first_ssh: | | |
/bin/bash <(curl -L https://raw.githubusercontent.com/nichuanfang/config-server/master/linux/bash/step1/secure.sh) $PORT | |
- name: 初始化服务器-重启前-网络配置 | |
uses: cross-the-world/ssh-scp-ssh-pipelines@latest | |
env: | |
VPS_HOST: ${{ secrets.VPS_HOST }} | |
VPS_DOMAIN: ${{ secrets.VPS_DOMAIN }} | |
with: | |
host: ${{ secrets.VPS_HOST }} | |
user: ${{ secrets.VPS_USER }} | |
pass: ${{ secrets.VPS_PASS }} | |
port: 22 | |
connect_timeout: 10s | |
first_ssh: | | |
/bin/bash <(curl -L https://raw.githubusercontent.com/nichuanfang/config-server/master/linux/bash/step1/config_network.sh) $VPS_DOMAIN $VPS_HOST | |
- name: 初始化服务器-重启前-环境变量配置 | |
uses: cross-the-world/ssh-scp-ssh-pipelines@latest | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
with: | |
host: ${{ secrets.VPS_HOST }} | |
user: ${{ secrets.VPS_USER }} | |
pass: ${{ secrets.VPS_PASS }} | |
port: 22 | |
connect_timeout: 10s | |
first_ssh: | | |
/bin/bash <(curl -L https://raw.githubusercontent.com/nichuanfang/config-server/master/linux/bash/step1/config_env.sh) $GH_TOKEN | |
- name: 初始化服务器-重启前-防火墙配置 | |
uses: cross-the-world/ssh-scp-ssh-pipelines@latest | |
env: | |
PORT: ${{ secrets.VPS_PORT }} | |
with: | |
host: ${{ secrets.VPS_HOST }} | |
user: ${{ secrets.VPS_USER }} | |
pass: ${{ secrets.VPS_PASS }} | |
port: 22 | |
connect_timeout: 10s | |
first_ssh: | | |
/bin/bash <(curl -L https://raw.githubusercontent.com/nichuanfang/config-server/master/linux/bash/step1/config_ufw.sh) $PORT | |
- name: 重启服务器 | |
uses: cross-the-world/ssh-scp-ssh-pipelines@latest | |
continue-on-error: true | |
with: | |
host: ${{ secrets.VPS_HOST }} | |
user: ${{ secrets.VPS_USER }} | |
pass: ${{ secrets.VPS_PASS }} | |
port: 22 | |
connect_timeout: 10s | |
first_ssh: | | |
reboot | |
- name: 等待服务器重启完成... | |
run: | | |
sleep 15s | |
- name: 初始化服务器-重启后-配置docker | |
uses: cross-the-world/ssh-scp-ssh-pipelines@latest | |
with: | |
host: ${{ secrets.VPS_HOST }} | |
user: ${{ secrets.VPS_USER }} | |
pass: ${{ secrets.VPS_PASS }} | |
port: ${{ secrets.VPS_PORT }} | |
connect_timeout: 10s | |
first_ssh: | | |
/bin/bash <(curl -L https://raw.githubusercontent.com/nichuanfang/config-server/master/linux/bash/step2/common/config_docker.sh) | |
- name: 初始化服务器-重启后-配置git | |
uses: cross-the-world/ssh-scp-ssh-pipelines@latest | |
env: | |
EMAIL_PREFIX: ${{ secrets.EMAIL_PREFIX }} | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
with: | |
host: ${{ secrets.VPS_HOST }} | |
user: ${{ secrets.VPS_USER }} | |
pass: ${{ secrets.VPS_PASS }} | |
port: ${{ secrets.VPS_PORT }} | |
connect_timeout: 10s | |
first_ssh: | | |
/bin/bash <(curl -L https://raw.githubusercontent.com/nichuanfang/config-server/master/linux/bash/step2/common/config_git.sh) $EMAIL_PREFIX $GH_TOKEN | |
- name: 初始化服务器-重启后-配置python | |
uses: cross-the-world/ssh-scp-ssh-pipelines@latest | |
with: | |
host: ${{ secrets.VPS_HOST }} | |
user: ${{ secrets.VPS_USER }} | |
pass: ${{ secrets.VPS_PASS }} | |
port: ${{ secrets.VPS_PORT }} | |
connect_timeout: 10s | |
first_ssh: | | |
/bin/bash <(curl -L https://raw.githubusercontent.com/nichuanfang/config-server/master/linux/bash/step2/vps/config_python.sh) | |
- name: 初始化服务器-重启后-配置https证书 | |
uses: cross-the-world/ssh-scp-ssh-pipelines@latest | |
env: | |
EMAIL_PREFIX: ${{ secrets.EMAIL_PREFIX }} | |
VPS_DOMAIN: ${{ secrets.VPS_DOMAIN }} | |
VPS_HOST: ${{ secrets.VPS_HOST }} | |
continue-on-error: true | |
with: | |
host: ${{ secrets.VPS_HOST }} | |
user: ${{ secrets.VPS_USER }} | |
pass: ${{ secrets.VPS_PASS }} | |
port: ${{ secrets.VPS_PORT }} | |
connect_timeout: 10s | |
first_ssh: | | |
/bin/bash <(curl -L https://raw.githubusercontent.com/nichuanfang/config-server/master/linux/bash/step2/vps/config_cert.sh) $EMAIL_PREFIX $VPS_DOMAIN $VPS_HOST | |
- name: 初始化服务器-重启后-部署bitwarden | |
uses: cross-the-world/ssh-scp-ssh-pipelines@latest | |
continue-on-error: true | |
with: | |
host: ${{ secrets.VPS_HOST }} | |
user: ${{ secrets.VPS_USER }} | |
pass: ${{ secrets.VPS_PASS }} | |
port: ${{ secrets.VPS_PORT }} | |
connect_timeout: 10s | |
first_ssh: | | |
/bin/bash <(curl -L https://raw.githubusercontent.com/nichuanfang/config-server/master/linux/bash/step2/vps/deploy_bitwarden.sh) | |
- name: 初始化服务器-重启后-部署metube | |
uses: cross-the-world/ssh-scp-ssh-pipelines@latest | |
continue-on-error: true | |
with: | |
host: ${{ secrets.VPS_HOST }} | |
user: ${{ secrets.VPS_USER }} | |
pass: ${{ secrets.VPS_PASS }} | |
port: ${{ secrets.VPS_PORT }} | |
connect_timeout: 10s | |
first_ssh: | | |
/bin/bash <(curl -L https://raw.githubusercontent.com/nichuanfang/config-server/master/linux/bash/step2/vps/deploy_metube.sh) | |
- name: 初始化服务器-重启后-部署bark_server | |
uses: cross-the-world/ssh-scp-ssh-pipelines@latest | |
continue-on-error: true | |
with: | |
host: ${{ secrets.VPS_HOST }} | |
user: ${{ secrets.VPS_USER }} | |
pass: ${{ secrets.VPS_PASS }} | |
port: ${{ secrets.VPS_PORT }} | |
connect_timeout: 10s | |
first_ssh: | | |
/bin/bash <(curl -L https://raw.githubusercontent.com/nichuanfang/config-server/master/linux/bash/step2/vps/deploy_bark_server.sh) | |
- name: 初始化服务器-重启后-部署tgbot | |
uses: cross-the-world/ssh-scp-ssh-pipelines@latest | |
continue-on-error: true | |
with: | |
host: ${{ secrets.VPS_HOST }} | |
user: ${{ secrets.VPS_USER }} | |
pass: ${{ secrets.VPS_PASS }} | |
port: ${{ secrets.VPS_PORT }} | |
connect_timeout: 10s | |
first_ssh: | | |
/bin/bash <(curl -L https://raw.githubusercontent.com/nichuanfang/config-server/master/linux/bash/step2/vps/deploy_tgbot.sh) | |
- name: 等待部署完成 | |
run: | | |
sleep 300s | |
- name: 初始化服务器-重启后-部署nginx | |
uses: cross-the-world/ssh-scp-ssh-pipelines@latest | |
env: | |
VPS_DOMAIN: ${{ secrets.VPS_DOMAIN }} | |
VPS_CONFIG_USER: ${{ secrets.VPS_CONFIG_USER }} | |
VPS_CONFIG_PASS: ${{ secrets.VPS_CONFIG_PASS }} | |
with: | |
host: ${{ secrets.VPS_HOST }} | |
user: ${{ secrets.VPS_USER }} | |
pass: ${{ secrets.VPS_PASS }} | |
port: ${{ secrets.VPS_PORT }} | |
connect_timeout: 10s | |
first_ssh: | | |
/bin/bash <(curl -L https://raw.githubusercontent.com/nichuanfang/config-server/master/linux/bash/step2/vps/deploy_nginx.sh) $VPS_DOMAIN $VPS_CONFIG_USER $VPS_CONFIG_PASS | |
- name: 生成xray配置(部署之前需要去 nichuanfang/.github同步密钥库) | |
uses: rshop/trigger-workflow-action@v1 | |
with: | |
token: ${{ secrets.GH_TOKEN }} | |
repository: 'nichuanfang/xray-parser' | |
workflowId: 57684819 | |
branch: server | |
- name: 等待配置生成完成... | |
run: | | |
sleep 60s | |
- name: 初始化服务器-重启后-部署xray (部署之前需要去 nichuanfang/.github同步密钥库) | |
uses: cross-the-world/ssh-scp-ssh-pipelines@latest | |
continue-on-error: true | |
env: | |
VPS_DOMAIN: ${{ secrets.VPS_DOMAIN }} | |
VPS_CONFIG_USER: ${{ secrets.VPS_CONFIG_USER }} | |
VPS_CONFIG_PASS: ${{ secrets.VPS_CONFIG_PASS }} | |
with: | |
host: ${{ secrets.VPS_HOST }} | |
user: ${{ secrets.VPS_USER }} | |
pass: ${{ secrets.VPS_PASS }} | |
port: ${{ secrets.VPS_PORT }} | |
connect_timeout: 10s | |
first_ssh: | | |
/bin/bash <(curl -L https://raw.githubusercontent.com/nichuanfang/config-server/master/linux/bash/step2/vps/deploy_xray.sh) $VPS_DOMAIN $VPS_CONFIG_USER $VPS_CONFIG_PASS | |
- name: 初始化服务器-重启后-配置定时任务 | |
uses: cross-the-world/ssh-scp-ssh-pipelines@latest | |
env: | |
VPS_DOMAIN: ${{ secrets.VPS_DOMAIN }} | |
VPS_HOST: ${{ secrets.VPS_HOST }} | |
with: | |
host: ${{ secrets.VPS_HOST }} | |
user: ${{ secrets.VPS_USER }} | |
pass: ${{ secrets.VPS_PASS }} | |
port: ${{ secrets.VPS_PORT }} | |
connect_timeout: 10s | |
first_ssh: | | |
/bin/bash <(curl -L https://raw.githubusercontent.com/nichuanfang/config-server/master/linux/bash/step2/vps/config_cron.sh) $VPS_DOMAIN $VPS_HOST |