Skip to content

Commit

Permalink
Add PM2
Browse files Browse the repository at this point in the history
  • Loading branch information
Seshpenguin committed Mar 18, 2024
1 parent 0ed23fc commit 79772e2
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
22 changes: 22 additions & 0 deletions distro-files/layout/etc/systemd/system/pm2-user.service
@@ -0,0 +1,22 @@
[Unit]
Description=PM2 process manager
Documentation=https://pm2.keymetrics.io/
After=network.target

[Service]
Type=forking
User=user
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/opt/nodejs/bin:/opt/pm2/node_modules/pm2/bin
Environment=PM2_HOME=/home/user/.pm2
PIDFile=/home/user/.pm2/pm2.pid
Restart=on-failure

ExecStart=/opt/pm2/node_modules/pm2/bin/pm2 resurrect
ExecReload=/opt/pm2/node_modules/pm2/bin/pm2 reload all
ExecStop=/opt/pm2/node_modules/pm2/bin/pm2 kill

[Install]
WantedBy=multi-user.target
14 changes: 14 additions & 0 deletions src/index.ts
Expand Up @@ -206,6 +206,19 @@ EOF`);
sudo cp -v prolinux-tool.desktop ${ROOTFS_DIR}/usr/share/applications/
popd
`);

/* ------------- PM2 ------------- */
exec(`sudo arch-chroot ${ROOTFS_DIR} /bin/bash -x <<'EOF'
mkdir /opt/pm2
chown user:user /opt/pm2
echo "export PATH=/opt/nodejs/bin/:/opt/pm2/node_modules/pm2/bin/:$PATH" >> /etc/profile
sudo -u user bash << EOFSU
echo "Setting up pm2..."
export PATH=/opt/nodejs/bin/:$PATH
npm install --prefix /opt/pm2 pm2@latest
true
EOFSU
EOF`);

if(PROLINUX_VARIANT === "mobile" && PROLINUX_CHANNEL === "dev") {
/* ------------- ProLinux Mobile Dev (Plasma Mobile Nightly / kdesrc-build ) ------------- */
Expand Down Expand Up @@ -242,6 +255,7 @@ EOF`);
systemctl enable prolinuxd
systemctl enable getty@tty0
systemctl enable podman
systemctl enable pm2-user
mkdir -pv /opt/build-info
echo "${buildnum},${builduuid},prolinux,${PROLINUX_VARIANT},${PROLINUX_CHANNEL},$(date),prolinux-root-${PROLINUX_VARIANT}-${PROLINUX_CHANNEL}.squish,${arch}" >> /opt/build-info/prolinux-info.txt
Expand Down

0 comments on commit 79772e2

Please sign in to comment.