add deploy steps.
All checks were successful
Deploy / PullDocker (push) Successful in 5s
Deploy / Build (push) Successful in 3m57s

This commit is contained in:
amass 2024-10-07 21:10:35 +08:00
parent c7d97f1b95
commit e939fe654a
2 changed files with 21 additions and 7 deletions

View File

@ -2,13 +2,14 @@
set -e
SERVER_ADDRESS=47.107.32.69
SERVER_ADDRESS=192.168.3.3
SERVER_PORT=5022
USER=root
function update() {
echo "start update packages"
ssh "$USER@$SERVER_ADDRESS" <<EOF
ssh $USER@$SERVER_ADDRESS -p $SERVER_PORT <<EOF
apt update
apt upgrade -y
EOF
@ -19,10 +20,10 @@ EOF
function init() {
echo "start deploy server"
scp resource/openresty.service $USER@$SERVER_ADDRESS:/lib/systemd/system/openresty.service
scp resource/frps.service $USER@$SERVER_ADDRESS:/etc/systemd/system/frps.service
scp -P $SERVER_PORT resource/openresty.service $USER@$SERVER_ADDRESS:/lib/systemd/system/openresty.service
scp -P $SERVER_PORT resource/frps.service $USER@$SERVER_ADDRESS:/etc/systemd/system/frps.service
ssh "$USER@$SERVER_ADDRESS" <<EOF
ssh $USER@$SERVER_ADDRESS -p $SERVER_PORT <<EOF
if command -v openresty > /dev/null 2>&1; then
echo "OpenResty has installed."
else
@ -34,10 +35,14 @@ function init() {
opm get bungle/lua-resty-session
fi
if [ ! -f /root/Server/frp_0.60.0_linux_amd64/frps ]; then
if [ -f /root/Server/frp_0.60.0_linux_amd64/frps ]; then
echo "frps has installed."
else
pushd /root/Server
# wget https://github.com/fatedier/frp/releases/download/v0.60.0/frp_0.60.0_linux_amd64.tar.gz
wget https://frp-by1.wwvvww.cn:44048/s/frps/download -O frp_0.60.0_linux_amd64.tar.gz
tar xvf ./frp_0.60.0_linux_amd64.tar.gz
popd
fi
if command -v docker &> /dev/null; then
@ -56,6 +61,15 @@ function init() {
if [ ! -d /root/Server ]; then
mkdir -p /root/Server /root/Server/logs
fi
if [ "$(docker ps -q -f name=librespeed)" ]; then
echo "librespeed has running."
else
pushd /root/Server
docker run -d --name=librespeed -e PASSWORD=88888888 -p 8087:80 \
-v ${PWD}/librespeed:/config --restart unless-stopped lscr.io/linuxserver/librespeed:latest
popd
fi
EOF
echo "update packages finished."

View File

@ -22,7 +22,7 @@ WorkingDirectory=/root/Server
ExecStartPre=/usr/local/openresty/nginx/sbin/nginx -t -q -g 'daemon on; master_process on;' -c /root/Server/conf/nginx.conf -p /root/Server
ExecStart=/usr/local/openresty/nginx/sbin/nginx -g 'daemon on; master_process on;' -c /root/Server/conf/nginx.conf -p /root/Server
ExecReload=/usr/local/openresty/nginx/sbin/nginx -g 'daemon on; master_process on;' -s reload -c /root/Server/conf/nginx.conf -p /root/Server
ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /usr/local/openresty/nginx/logs/nginx.pid
ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /root/Server/logs/nginx.pid
TimeoutStopSec=5
KillMode=mixed