Services
This page is discussing about the OS, tools and services that we provide inside SSH and some tips that you can leverage.
This page assumes you already know on how to open SSH to access these commands. To learn about opening SSH, see our SSH web editor.
Operating System
The operating system is Rocky Linux, a derivation of RHEL.
We choose Rocky Linux because the repos are active and more frequently updated (twice a year), unlike Ubuntu. To view current system information, run neofetch
.
Linux tools
These popular system-wide linux tools are available out of the box:
aws | btop | bzip2 | clang | cmake | composer |
curl | dig | docker | gcc | g++ | gem |
git | gpg2 | gzip | htop | iftop | jq |
lsof | make | mysql | nano | ncdu | neofetch |
npm | node | nslookup | nvim | openssl | perl |
phar | php | pip | pipenv | psql | python |
rsync | ruby | screen | sed | sendmail | ssh |
ssh-keygen | sqlite3 | tar | tmux | vi | vim |
wget | whois | xz | yarn | zip | zstd |
Don't rely on their version as it's OS wide and changing anytime though system updates.
Install DNF Packages
DNF is official RHEL-based package managers like Ubuntu APT. Even though you can't install packages via dnf install
, you can install it to your home dir, which is in ~/usr
.
To install additional packages, run via dnf
feature in the deployment system. For example, here's a way to install ImageMagick:
features:
- dnf GraphicsMagick
This install gm
to ~/usr/bin
. Check lists of all dnf
packages here. To only init the environment and install directly in SSH, just use dnf
feature (to init bash environments), and then install it in SSH like this:
# See https://www.baeldung.com/linux/install-packages-no-root-privileges#2dnf
pushd ~/tmp
dnf download GraphicsMagick --resolve
rpm2cpio *.rpm | cpio -idmD ~
popd
Be aware that since this doesn't install to OS-wide /usr
, so don't expect installing daemon services will work here. This command only suitable to install additional CLI tools.
Run the same command to update the software later in time.
Cron Job
You can create cron jobs by running crontab -e
from SSH. It will open vim to edit cronjob for your server. If you unfamiliar with vim try use nano EDITOR=vi crontab -e
.
The cronjob syntax is like this:
Please note, the minimum interval for cronjob is once in every hour; lesser than that and the system will delete your cron entries automatically!
Installing SSH Identity Keys
Installing this will avoid asking for password. Please change username@remote_host
with the server SSH user and host.
ssh-keygen -C $USER@$HOST -f ~/.ssh/id_rsa -q -N ''
echo "IdentityFile ~/.ssh/id_rsa" >> ~/.ssh/config
chmod 0600 ~/.ssh/*
ssh-copy-id username@remote_host
$sshDir = "$env:USERPROFILE\.ssh"; ssh-keygen -C "$env:USERNAME@$env:COMPUTERNAME" -f "$sshDir\id_rsa" -q -N ''
Add-Content -Path "$sshDir\config" -Value "IdentityFile $sshDir\id_rsa"
icacls "$sshDir\*" /inheritance:r /grant:r "$env:USERNAME:(F)"
type "$sshDir\id_rsa.pub" | ssh username@remote_host "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
Installing Shared Libraries
When you in a situation in needing linking C libraries but unable to do that because of lack to sudo
access, you might need to download and build from the source as the alternative solution.
To do that, when you configure
a C project, make sure to have prefix set to $HOME/.local
instead of usual /usr/local
so the installation will look like this:
./configure --prefix=$HOME/.local
make
make install
Then export LD_LIBRARY_PATH
to that local folder permanently so your app can find the shared library.
echo 'export LD_LIBRARY_PATH=$HOME/.local/lib:$LD_LIBRARY_PATH' >> ~/.bashrc
echo 'export LIBRARY_PATH=$HOME/.local/lib:$LIBRARY_PATH' >> ~/.bashrc
Phussion Passenger Tools
There's passenger-status
and passenger-config
to diagnose your app if you happen to use passenger apps.
The restart
CLI tool is also to forcefully restart your currently running apps under NGINX. It's equivalent as killall -u $USER
.
To check passenger apps logs, you have to check it from our UI panel.
Docker Tools
There's docker
and systemctl --user
when you activate docker
feature via deployment system.
To manage docker apps including viewing logs, you have to check it via docker
CLI tool.
This docker is run with rootless mode. Hence some features is unavailable such as limiting by CPU and RAM and binding to port <= 1024.
Ephemeral Ports
Most ports are blocked except ephemeral ports (32000 - 65535). You can use them for local development inside the server, including running a custom development without going though NGINX.
Please note that long-running background processes are not allowed in the server. It will be killed automatically as soon as you log-out from SSH session.
DOM Cloud is a shared VM, so other people might stumble across your randomly assigned ports (incoming traffic from ports can't be divided by domain name unlike if it's going through NGINX). Never put any sensitive data if it's mean for development!
To automatically run with server public IP and random ports, use syntax like this:
export HOST=$(hostname -I | cut -d " " -f1)
export PORT=$(shuf -n 1 -i 32000-65535)
npm run dev -- --host $HOST --port $PORT
Memory Sharing
Any application run through Passenger will be spawned into multiple processes. If you save data through memory (i.e. saving some data into global variables) it won't work consistently, you have to save it either in file or database.
If you want performant cache storage, look for other platform. Some of them may grant free Redis storage. Just make sure the cluster is in same region with what you use in DOM Cloud.
Managing File Storage
If you need to delete caches and other unnecessary files in one of your hosts, use ncdu. It's a disk usage analyzer available in all servers. This is a great tool to use if you run out of disk space.