Github Actions pm2: command not found - github-actions

I am trying to auto-deploy the project and npm commands run perfectly but when it goes to a line where pm2 restarts the specific projects, then actions fails.
GitHub Actions Error:
GitHub Actions Error
GitHub Action .yml file content:
yml file

NOTE: This solution is applicable only when you are using an NVM to manage node.js versions
The issue is because of the missing symbolic link for the node and the pm2, here are the commands that you can use to create a symbolic link:
sudo ln -s "$NVM_DIR/versions/node/$(nvm version)/bin/node" "/usr/local/bin/node"
sudo ln -s "$NVM_DIR/versions/node/$(nvm version)/bin/npm" "/usr/local/bin/npm"
sudo ln -s "$NVM_DIR/versions/node/$(nvm version)/bin/pm2" "/usr/local/bin/pm2"

This is because pm2 is not linked, for linking
Access your server via ssh, after that get the path of pm2 by
whereis pm2
You will get the output of your path like
pm2: /home/abhimanyu/.nvm/versions/node/v18.12.1/bin/pm2
Copy the path
link your path now
sudo ln -s "$NVM_DIR/versions/node/v18.12.1/bin/pm2" "/usr/local/bin/pm2"
versions/node/v18.12.1/bin/pm2 is my path your path may be diffrent

lo que pasa es que seguro instalaste todo por NVM lo cual no esta mal, pero para que puedas utilizar pm2 dentro del action de github, lo que tienes que realizar es.
sudo ln -s "$NVM_DIR/versions/node/$(nvm version)/bin/node" "/usr/local/bin/node"
sudo ln -s "$NVM_DIR/versions/node/$(nvm version)/bin/npm" "/usr/local/bin/npm"
sudo ln -s "$NVM_DIR/versions/node/$(nvm version)/bin/pm2" "/usr/local/bin/pm2"
despues de la intalacion para que asi puedas utilizar con sudo el pm2 y de esa forma te funcionara sin problemas

I run into the same issue.
So basically, pm2 is not installed. I found it a bit strange as in my VPS, the pm2 is installed and is running perfectly.
The way I got around with it was to create a bash script in the root directory of my project: pm2_runner.sh, within this file I added:
#!/bin/bash
if ! type pm2 > /dev/null
then
sudo npm install -g pm2 && pm2 start ./app.js --name my_project_name
else
pm2 restart my_project_name
fi
Then in my .yml file inside .github/workflow/, instead of writing:
- run: pm2 restart my_project_name
I added:
- run: chmod +x ./pm2_runner.sh
- run: bash ./pm2_runner.sh
It installed pm2 globally without requesting sudo passord since sudo in github actions runs using passwordless.

Related

High version qemu-mipsel could not find libs automatically

System info
kernel:Linux ubuntu 5.4.0-121-generic #137~18.04.1-Ubuntu SMP Mon Jun 20 07:25:24 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Distributor ID: Ubuntu
Description: Ubuntu 18.04.6 LTS
Release: 18.04
Codename: bionic
Default version of qemu installed by apt will cause system error when using gdb-multiarch to debug mips executable files. So i'm trying to compile the source codes.
I've installed re2c, ninja and some packages, which are the dependency of qemu.
wget https://github.com/skvadrik/re2c/releases/download/3.0/re2c-3.0.tar.xz
tar -xvzf re2c-1.0.1.tar.gz
cd re2c-1.0.1/
./configure
make -j4
sudo make install
cd ..
git clone https://github.com/ninja-build/ninja.git
cd ninja
./configure.py --bootstrap
sudo cp ninja /usr/bin/
ninja --version
cd ..
sudo apt install build-essential zlib1g-dev pkg-config
sudo apt install libglib2.0-dev binutils-dev libboost-all-dev libssl-dev
sudo apt install libpixman-1-dev libfdt-dev libsdl2-dev
Then i'd like to build qemu statically and get executable like qemu-mipsel(which are static linked so i rename the files with -static suffix). But when i was trying to run any mips executable file, i got error below.
$ ./qemu-mipsel-static (mips_file_name)
qemu-mipsel-static: Could not open '/lib/ld.so.1': No such file or directory
I'm sure that the arch and endian is right. And i copied related lib files in /usr/mipsel-linux-gnu/lib to current directory and using option -L to specify the lib file path. I got the same result.
And i tried the version installed by apt, It can run smoothly.
Commands for installing qemu via apt are as followed.
sudo apt-get install qemu
sudo apt-get install qemu-user-static
sudo apt-get install qemu-system
sudo apt-get install uml-utilities
sudo apt-get install bridge-utils
However, as for the higher version of qemu compiled by source code, when i was tring commands below, it can run smoothly.
chroot . ./qemu-mipsel-static (mips file)
I wonder the reason and how to correctly run the file using ./ and chroot two ways. Thanks for your help!

mysql install init failure on centos7

I am trying to install Mysql Community Server version5.6.40 on my Centos7 VM.
During the installation i have met below problems:
1)
[root#Mysql_Server scripts]# ./mysql_install_db.sh --user=mysql --basedir=/application/mysql --datadir=/application/mysql/data
-bash: ./mysql_install_db.sh: Permission denied
[root#Mysql_Server support-files]# /etc/init.d/mysqld start
-bash: /etc/init.d/mysqld: Permission denied
i have use chmod a+x filename to assign the execute rights but i just want to know why those files lacks of execution rights. //i download the mysql installation tar file and extract with root privilege
2)while i was running the mysql_install_db.sh
[root#Mysql_Server scripts]# ./mysql_install_db.sh --user=mysql --basedir=/application/mysql --datadir=/application/mysql/data
FATAL ERROR: Could not find my_print_defaults
The following directories were searched:
/application/mysql/bin
/application/mysql/extra
If you compiled from source, you need to run 'make install' to
copy the software into the correct location ready for operation.
If you are using a binary release, you must either be at the top
level of the extracted archive, or pass the --basedir option
pointing to that location.
i tried follow steps to find out what the possible reason for causing this issue:
find / my_print_defaults
find: ‘my_print_defaults’: No such file or directory
and
ls /application/mysql/
[root#Mysql_Server scripts]# ls /application/mysql/
BUILD dbug libmysqld README support-files
client Docs libservices regex tests
cmake Doxyfile-perfschema man scripts unittest
CMakeLists.txt extra mysql-test sql VERSION
cmd-line-utils include mysys sql-bench vio
config.h.cmake INSTALL mysys_ssl sql-common win
configure.cmake libevent packaging storage zlib
COPYING libmysql plugin strings
no bin and extra directory were created.
so i was wondering if it was caused by lacking of gcc gcc-c++ because my centos7 installation chose minimal install.
or maybe it was caused by lacking of execution rights result the shell files did run correctly.
attached:below whole operations for better trouble shooting
[root#Mysql_Server ~]# yum install wget -y
[root#Mysql_Server ~]# wget https://cdn.mysql.com/archives/mysql-5.6/mysql-5.6.40.tar.gz
[root#Mysql_Server ~]# tar -xf mysql-5.6.40.tar.gz
[root#Mysql_Server ~]# mkdir /application
[root#Mysql_Server ~]# mv mysql-5.6.40 /application/
[root#Mysql_Server ~]# ln -s /application/mysql-5.6.40/ /application/mysql
[root#Mysql_Server ~]# cd /application/mysql/support-files/
[root#Mysql_Server support-files]# cp my-default.cnf.sh /etc/my.cnf
[root#Mysql_Server support-files]# cp mysql.server.sh /etc/init.d/mysqld
[root#Mysql_Server support-files]# cd /application/mysql/scripts/
[root#Mysql_Server scripts]# useradd mysql -s /sbin/nologin -M
[root#Mysql_Server scripts]# chmod a+x mysql_install_db.sh
[root#Mysql_Server scripts]# ./mysql_install_db.sh --user=mysql --basedir=/application/mysql --datadir=/application/mysql/data
It is a fatal mistake by misunderstanding between the source code and binary package.
Since i downloaded the source code which can not be run directly without encoding and packaging.
Thanks again for #danblack's reminds!
I've successfully run mysql_community_server on centos7 now.(using the binary package installed).
now i am going to install mysql by using the source code.

I cannot build and install QEMU for RISCV

I try to install the toolchain of QEMU for risc-v so I follow this tuto https://github.com/riscv/riscv-qemu/wiki but i get this error:
aitmanss#lo-lester-032:~/riscv-gnu-toolchain-rv32i/riscv-qemu$ make install
CHK version_gen.h
install -d -m 0755 "/usr/local/share/doc/qemu"
install -c -m 0644 qemu-doc.html qemu-tech.html "/usr/local/share/doc/qemu"
install: impossible de supprimer '/usr/local/share/doc/qemu/qemu-doc.html': Permission non accordée
install: impossible de supprimer '/usr/local/share/doc/qemu/qemu-tech.html': Permission non accordée
make: *** [Makefile:437: install-doc] Error 1
this part I change the permission but got this error
aitmanss#lo-lester-032:~/riscv-gnu-toolchain-rv32i/riscv-qemu$ sudo chmod 777 /usr/local/share/doc/qemu/qemu-doc.html
aitmanss#lo-lester-032:~/riscv-gnu-toolchain-rv32i/riscv-qemu$ sudo chmod 777 /usr/local/share/doc/qemu/qemu-tech.html
aitmanss#lo-lester-032:~/riscv-gnu-toolchain-rv32i/riscv-qemu$ sudo chmod 777 /usr/local/share/doc/qemu
aitmanss#lo-lester-032:~/riscv-gnu-toolchain-rv32i/riscv-qemu$ make install
CHK version_gen.h
install -d -m 0755 "/usr/local/share/doc/qemu"
install: impossible de modifier les droits de « /usr/local/share/doc/qemu »: Opération non permise
make: *** [Makefile:436: install-doc] Error 1
The errors shown in the console output indicate that you don't have permissions to write to directories where you're trying to install QEMU.
Usually you can first build software and then install it. This is definitely the case with QEMU.
You can build it in your home directory as an ordinary user. Building step does not need any privileges. When you install it under /usr/local you can do it with root privileges, e.g. using sudo make install. Alternatively you can configure it with --prefix pointing somewhere where you have write access, then you'll be able to install it as an ordinary user.

Installation Requirements for mysql with DBIish on rakudo-star docker image

I was creating an own docker image based on the latest rakudo-star docker image. I wanted to use DBIish to connect to a mysql database. Unfortunately I am not able to get the DBDish::mysql to work.
I've installed default-libmysqlclient-dev as you can see in
# find / -name 'libmysqlclient*.so'
/usr/lib/x86_64-linux-gnu/libmysqlclient_r.so
/usr/lib/x86_64-linux-gnu/libmysqlclient.so
The error i am facing is:
# perl6 -Ilib -e 'use DBDish::mysql; DBDish::mysql.connect()'
Cannot locate native library 'mysqlclient': mysqlclient: cannot open shared object file: No such file or directory
in method setup at /usr/share/perl6/sources/24DD121B5B4774C04A7084827BFAD92199756E03 (NativeCall) line 289
in method CALL-ME at /usr/share/perl6/sources/24DD121B5B4774C04A7084827BFAD92199756E03 (NativeCall) line 539
in method connect at /root/DBIish/lib/DBDish/mysql.pm6 (DBDish::mysql) line 12
in block <unit> at -e line 1
Short answer: you need the package libmysqlclient20 (I added the documentation request to a similar DBIish issue). Debian 9 (stable at the moment) uses and older version than Ubuntu 18.04 (stable at the moment) and Debian Unstable. It also refers to mariadb instead of mysql. Pick libmariadbclient18 on images based on Debian Stable and create a link with the mysql name (see below).
On Debian Testing/Unstable and recent derivatives:
$ sudo apt-get install libmysqlclient20
$ dpkg -L libmysqlclient20
/.
/usr
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/libmysqlclient.so.20.3.9
/usr/share
/usr/share/doc
/usr/share/doc/libmysqlclient20
/usr/share/doc/libmysqlclient20/NEWS.Debian.gz
/usr/share/doc/libmysqlclient20/changelog.Debian.gz
/usr/share/doc/libmysqlclient20/copyright
/usr/lib/x86_64-linux-gnu/libmysqlclient.so.20
On Debian 9 and derivatives:
$ dpkg -L libmariadbclient18
/.
/usr
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/libmariadbclient.so.18.0.0
/usr/lib/x86_64-linux-gnu/mariadb18
/usr/lib/x86_64-linux-gnu/mariadb18/plugin
/usr/lib/x86_64-linux-gnu/mariadb18/plugin/client_ed25519.so
/usr/lib/x86_64-linux-gnu/mariadb18/plugin/dialog.so
/usr/lib/x86_64-linux-gnu/mariadb18/plugin/mysql_clear_password.so
/usr/share
/usr/share/doc
/usr/share/doc/libmariadbclient18
/usr/share/doc/libmariadbclient18/changelog.Debian.gz
/usr/share/doc/libmariadbclient18/copyright
/usr/lib/x86_64-linux-gnu/libmariadbclient.so.18
Create the link:
$ sudo ln -s /usr/lib/x86_64-linux-gnu/libmariadbclient.so.18 /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18
In order to illustrate this, I created an Ubuntu 18.04 container for the occasion*:
docker run -ti --rm --entrypoint=bash rakudo/ubuntu-amd64-18.04
And the abbreviated commands and output:
# apt-get install -y libmysqlclient20 build-essential
# zef install DBIish
# perl6 -e 'use DBDish::mysql; DBDish::mysql.connect()'
Cannot look up attributes in a DBDish::mysql type object
[...]
The error is because I didn't pass the correct parameters for connect as I didn't have a db running. The important thing is that no .so file is missing.
*: I uploaded it to the Docker Hub, a normal run will put you right in the REPL:
$ docker run -ti --rm rakudo/ubuntu-amd64-18.04
To exit type 'exit' or '^D'
>
(I didn't use the Star image when debugging, but it does not matter because this is a more generic problem.)

Ubuntu E: Failed to fetch

I run the update on Ubuntu 16.04 LTE by :
sudo apt-get update && sudo apt-get upgrade && sudo apt-get autoremove && sudo apt-get autoclean && sudo apt-get dist-upgrade
My problem is the :
Lecture des listes de paquets... Fait
W: The repository 'http://ppa.launchpad.net/freyja-dev/unity-tweak-tool-daily/ubuntu xenial Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: The repository 'http://ppa.launchpad.net/tualatrix/next/ubuntu xenial Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch http://ppa.launchpad.net/freyja-dev/unity-tweak-tool-daily/ubuntu/dists/xenial/main/binary-amd64/Packages 404 Not Found
E: Failed to fetch http://ppa.launchpad.net/tualatrix/next/ubuntu/dists/xenial/main/binary-amd64/Packages 404 Not Found
E: Le téléchargement de quelques fichiers d'index a échoué, ils ont été ignorés, ou les anciens ont été utilisés à la place.
Can you help me ?
Try adding xenial to the repo
echo 'deb http://download.fpcomplete.com/ubuntu xenial main'|sudo tee /etc/apt/sources.list.d/fpco.list