Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/ecosystem.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"max_restarts": 10,
"min_uptime": 10000,
"watch": false,
"interpreter": "/usr/local/node/bin/node",
"interpreter": "/usr/local/bin/node",
"ignore_watch": ["node_modules", "src", ".env.*", "myservers.cfg"],
"log_file": "/var/log/graphql-api.log",
"kill_timeout": 10000
Expand Down
2 changes: 1 addition & 1 deletion api/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export default defineConfig(({ mode }): ViteUserConfig => {
interop: 'auto',
banner: (chunk) => {
if (chunk.fileName === 'main.js' || chunk.fileName === 'cli.js') {
return '#!/usr/local/node/bin/node\n';
return '#!/usr/local/bin/node\n';
}
return '';
},
Expand Down
40 changes: 9 additions & 31 deletions plugin/plugins/dynamix.unraid.net.plg
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<!-- The archive's filename on the boot drive. Enables reproducible offline installs of the Unraid API. -->
<!ENTITY VENDOR_STORE_FILENAME "">
<!ENTITY TAG "">
<!ENTITY NODE_DIR "/usr/libexec/node">
]>

<PLUGIN name="&name;" author="&author;" version="&version;" pluginURL="&pluginURL;"
Expand Down Expand Up @@ -105,9 +106,6 @@ dnscheck "mothership.unraid.net"
[[ "${DNSERR}" == "yes" && "${DNS_SERVER1}" != "8.8.8.8" ]] && echo " Recommend navigating to Settings -> Network Settings and changing your DNS server to 8.8.8.8"
# Note: DNS checks will fail if the network is not available at boot. Cannot exit the install when DNS checks fail.

echo
echo "⚠️ Do not close this window yet"
echo
exit 0
]]>
</INLINE>
Expand All @@ -127,6 +125,7 @@ exit 0
<INLINE>
NODE_FILE="&NODEJS_FILENAME;"
VENDOR_ARCHIVE="&VENDOR_STORE_FILENAME;"
NODE_DIR="&NODE_DIR;"
<![CDATA[
# Check if the Node.js archive exists
if [[ ! -f "/boot/config/plugins/dynamix.my.servers/${NODE_FILE}" ]]; then
Expand All @@ -140,9 +139,6 @@ exit 0
exit 1
fi

# Define the target directory for Node.js
NODE_DIR="/usr/local/node"

# Create the target directory if it doesn't exist
mkdir -p "${NODE_DIR}" || { echo "Failed to create ${NODE_DIR}"; exit 1; }

Expand All @@ -159,6 +155,9 @@ exit 0
# Remove stale pnpm store archives from the boot drive
find /boot/config/plugins/dynamix.my.servers/ -name "pnpm-store-for-v*.txz" ! -name "${VENDOR_ARCHIVE}" -delete

# Remove the legacy node directory
rm -rf /usr/local/node

echo "Node.js installation successful"

exit 0
Expand Down Expand Up @@ -186,10 +185,6 @@ source /usr/local/emhttp/plugins/dynamix.my.servers/scripts/activation_code_remo
echo "Performing cleanup operations..."
/usr/bin/php /usr/local/emhttp/plugins/dynamix.my.servers/scripts/cleanup_operations.php

echo
echo "⚠️ Do not close this window yet"
echo

exit 0
]]>
</INLINE>
Expand Down Expand Up @@ -231,10 +226,6 @@ version=
# shellcheck disable=SC1091
source /etc/unraid-version

echo
echo "⚠️ Do not close this window yet"
echo

if [ -e /etc/rc.d/rc.unraid-api ]; then
touch /tmp/restore-files-dynamix-unraid-net
# stop flash backup
Expand Down Expand Up @@ -361,6 +352,7 @@ exit 0
TAG="&TAG;" MAINTXZ="&source;.txz"
VENDOR_ARCHIVE="/boot/config/plugins/dynamix.my.servers/&VENDOR_STORE_FILENAME;"
PNPM_BINARY_FILE="&PNPM_BINARY;"
NODE_DIR="&NODE_DIR;"
<![CDATA[
appendTextIfMissing() {
FILE="$1" TEXT="$2"
Expand Down Expand Up @@ -393,9 +385,6 @@ EOF
exit 0
fi

echo
echo "⚠️ Do not close this window yet"
echo

# NOTE: any 'exit 1' after this point will result in a broken install

Expand Down Expand Up @@ -677,9 +666,6 @@ if [[ -n "$TAG" && "$TAG" != "" ]]; then
sed -i "${sedcmd}" "/usr/local/emhttp/plugins/dynamix.unraid.net/README.md"
fi

echo
echo "⚠️ Do not close this window yet"
echo

# setup env
echo "env=\"production\"">/boot/config/plugins/dynamix.my.servers/env
Expand Down Expand Up @@ -765,10 +751,6 @@ if [[ "$webguiManifestTs" -gt "$plgManifestTs" ]]; then
echo "♻️ Reverted to stock web component files"
fi

echo
echo "⚠️ Do not close this window yet"
echo

# Activation and partner setup
# - Must come after the web component timestamp check to avoid potentially targeting the wrong JS during this setup
source /usr/local/emhttp/plugins/dynamix.my.servers/scripts/activation_code_setup
Expand Down Expand Up @@ -818,9 +800,9 @@ fi


# Create symlink to unraid-api binary (to allow usage elsewhere)
ln -sf /usr/local/node/bin/node /usr/local/bin/node
ln -sf /usr/local/node/bin/npm /usr/local/bin/npm
ln -sf /usr/local/node/bin/corepack /usr/local/bin/corepack
ln -sf ${NODE_DIR}/bin/node /usr/local/bin/node
ln -sf ${NODE_DIR}/bin/npm /usr/local/bin/npm
ln -sf ${NODE_DIR}/bin/corepack /usr/local/bin/corepack

ln -sf ${unraid_binary_path} /usr/local/sbin/unraid-api
ln -sf ${unraid_binary_path} /usr/bin/unraid-api
Expand All @@ -829,12 +811,8 @@ cp -f "${PNPM_BINARY_FILE}" /usr/local/bin/pnpm
chmod +x /usr/local/bin/pnpm

/etc/rc.d/rc.unraid-api restore-dependencies "$VENDOR_ARCHIVE"
echo
echo "⚠️ Do not close this window yet"
/etc/rc.d/rc.unraid-api pnpm-install
echo
echo "⚠️ Do not close this window yet"
echo
echo "About to start the Unraid API"


Expand Down
Loading