Skip to content

Commit b36b425

Browse files
authored
Refactor: Nginx Proxy Manager (#8453)
1 parent 8ab6e2d commit b36b425

File tree

2 files changed

+35
-23
lines changed

2 files changed

+35
-23
lines changed

ct/nginxproxymanager.sh

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,14 @@ function update_script() {
2828
exit
2929
fi
3030

31-
if ! command -v pnpm &>/dev/null; then
32-
msg_info "Installing pnpm"
33-
#export NODE_OPTIONS=--openssl-legacy-provider
34-
$STD npm install -g [email protected]
35-
msg_ok "Installed pnpm"
31+
if ! command -v yarn &>/dev/null; then
32+
msg_info "Installing Yarn"
33+
$STD npm install -g yarn
34+
msg_ok "Installed Yarn"
3635
fi
3736

37+
export NODE_OPTIONS="--openssl-legacy-provider"
38+
3839
RELEASE=$(curl -fsSL https://api.github.com/repos/NginxProxyManager/nginx-proxy-manager/releases/latest |
3940
grep "tag_name" |
4041
awk '{print substr($2, 3, length($2)-4) }')
@@ -49,9 +50,10 @@ function update_script() {
4950
sed -i "s|\"version\": \"0.0.0\"|\"version\": \"$RELEASE\"|" backend/package.json
5051
sed -i "s|\"version\": \"0.0.0\"|\"version\": \"$RELEASE\"|" frontend/package.json
5152
cd ./frontend || exit
52-
$STD pnpm install
53-
$STD pnpm upgrade
54-
$STD pnpm run build
53+
# Replace node-sass with sass in package.json before installation
54+
sed -i 's/"node-sass".*$/"sass": "^1.92.1",/g' package.json
55+
$STD yarn install --network-timeout 600000
56+
$STD yarn build
5557
)
5658
msg_ok "Built Frontend"
5759

@@ -71,7 +73,7 @@ function update_script() {
7173

7274
msg_info "Setting up Environment"
7375
ln -sf /usr/bin/python3 /usr/bin/python
74-
ln -sf /usr/bin/certbot /opt/certbot/bin/certbot
76+
ln -sf /opt/certbot/bin/certbot /usr/local/bin/certbot
7577
ln -sf /usr/local/openresty/nginx/sbin/nginx /usr/sbin/nginx
7678
ln -sf /usr/local/openresty/nginx/ /etc/nginx
7779
sed -i 's+^daemon+#daemon+g' docker/rootfs/etc/nginx/nginx.conf
@@ -113,7 +115,12 @@ function update_script() {
113115
cp -r frontend/app-images/* /app/frontend/images
114116
cp -r backend/* /app
115117
cp -r global/* /app/global
116-
$STD python3 -m pip install --no-cache-dir --break-system-packages certbot-dns-cloudflare
118+
119+
# Update Certbot and plugins in virtual environment
120+
if [ -d /opt/certbot ]; then
121+
$STD /opt/certbot/bin/pip install --upgrade pip setuptools wheel
122+
$STD /opt/certbot/bin/pip install --upgrade certbot certbot-dns-cloudflare
123+
fi
117124
msg_ok "Setup Environment"
118125

119126
msg_info "Initializing Backend"
@@ -134,7 +141,8 @@ function update_script() {
134141
EOF
135142
fi
136143
cd /app || exit
137-
$STD pnpm install
144+
export NODE_OPTIONS="--openssl-legacy-provider"
145+
$STD yarn install --network-timeout 600000
138146
msg_ok "Initialized Backend"
139147

140148
msg_info "Starting Services"

install/nginxproxymanager-install.sh

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ setting_up_container
1313
network_check
1414
update_os
1515

16-
setup_go
17-
1816
msg_info "Installing Dependencies"
1917
$STD apt update
2018
$STD apt -y install \
@@ -31,12 +29,16 @@ $STD apt install -y \
3129
python3-dev \
3230
python3-pip \
3331
python3-venv \
34-
python3-cffi \
35-
python3-certbot \
36-
python3-certbot-dns-cloudflare
37-
$STD pip3 install --break-system-packages certbot-dns-multi
32+
python3-cffi
3833
msg_ok "Installed Python Dependencies"
3934

35+
msg_info "Setting up Certbot"
36+
$STD python3 -m venv /opt/certbot
37+
$STD /opt/certbot/bin/pip install --upgrade pip setuptools wheel
38+
$STD /opt/certbot/bin/pip install certbot certbot-dns-cloudflare
39+
ln -sf /opt/certbot/bin/certbot /usr/local/bin/certbot
40+
msg_ok "Set up Certbot"
41+
4042
VERSION="$(awk -F'=' '/^VERSION_CODENAME=/{ print $NF }' /etc/os-release)"
4143

4244
msg_info "Installing Openresty"
@@ -53,7 +55,7 @@ $STD apt update
5355
$STD apt -y install openresty
5456
msg_ok "Installed Openresty"
5557

56-
NODE_VERSION="22" NODE_MODULE="pnpm@latest" setup_nodejs
58+
NODE_VERSION="22" NODE_MODULE="yarn" setup_nodejs
5759

5860
RELEASE=$(curl -fsSL https://api.github.com/repos/NginxProxyManager/nginx-proxy-manager/releases/latest |
5961
grep "tag_name" |
@@ -66,7 +68,6 @@ msg_ok "Downloaded Nginx Proxy Manager v${RELEASE}"
6668

6769
msg_info "Setting up Environment"
6870
ln -sf /usr/bin/python3 /usr/bin/python
69-
ln -sf /usr/bin/certbot /usr/local/bin/certbot
7071
ln -sf /usr/local/openresty/nginx/sbin/nginx /usr/sbin/nginx
7172
ln -sf /usr/local/openresty/nginx/ /etc/nginx
7273
sed -i "s|\"version\": \"0.0.0\"|\"version\": \"$RELEASE\"|" backend/package.json
@@ -118,9 +119,11 @@ msg_ok "Set up Environment"
118119

119120
msg_info "Building Frontend"
120121
cd ./frontend
121-
$STD pnpm install
122-
$STD pnpm upgrade
123-
$STD pnpm run build
122+
export NODE_OPTIONS="--openssl-legacy-provider"
123+
# Replace node-sass with sass in package.json before installation
124+
sed -i 's/"node-sass".*$/"sass": "^1.92.1",/g' package.json
125+
$STD yarn install --network-timeout 600000
126+
$STD yarn build
124127
cp -r dist/* /app/frontend
125128
cp -r app-images/* /app/frontend/images
126129
msg_ok "Built Frontend"
@@ -143,7 +146,8 @@ if [ ! -f /app/config/production.json ]; then
143146
EOF
144147
fi
145148
cd /app
146-
$STD pnpm install
149+
export NODE_OPTIONS="--openssl-legacy-provider"
150+
$STD yarn install --network-timeout 600000
147151
msg_ok "Initialized Backend"
148152

149153
msg_info "Creating Service"

0 commit comments

Comments
 (0)