One day, like me, you decide to use something bit more stable to host your web related stuff which is intended for other people than yourself, like this blog site you are reading; deciding upon using .ee
domain for once, which means no Cloudflare, Porkbun, Hover nor anything of the sort. And looking upon the list of accredited providers, someone that you already pay bills into, which most likely is the beloved and notorious Telia Eesti. You setup all fine and dandy, pay the fees, you create web app, blog site and/or something that depends on Node.js and get into realisation that your are stuck using their .php and only thing they provide giving you as an application is… WordPress. Now you are stuck and feeling buyers remorse picking a wrong web service provider… but fear not, as this guide will show a semi-jank way to get it to work!.
This isn’t sunshine and rainbows either, so I will explain the following caveats:
v24.0.1
. But can you swap between already installed versions.Now finally into the meat of this, we have to setup the following thing at the dashboard:
Webserver > Subdomains
add subdomain
, choose whatever you name you want it to be like blog
in the Name
selection and a random directory name to fill in the blank (We won’t be using this).WWW alias added
and fill in the mod_proxy backend port
into the port number that you want to use that won’t conflict with the whole domain provision, which for safest bet is going to be port number 8080
. Then save the changes.After having setup the dashboard settings, we try to setup our server through the terminal after we have setup our SSH keys if we already have not done so.
This guide follows the official documentation from the web hosting provider , which asks us to do the following:
To install the Node.js version manager nvm
, we have to use the following installation script command.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
Then refresh the bash, by terminating the session and logging back in (yeah, it is strange that usual bash
command won’t do the magic).
Then after logging back in. You can finally install either your wanted Node.js version in question or the latest one if it exists in the nvm. The commands are respectively like this:
nvm install 24.0.1
nvm install node
Now you have successfully installed Node.js! And can do the following command like this PORT=8080 node ./your/start/script.mjs
, where the PORT
environment variable is important to make it accessible through the subdomain.
Although if you already don’t know how your package management works, then what I personally do is run the following commands of copying the package .json
files, installing the dependencies and finally copying over the distribution.
# Copy package.json and package-lock.json to server
scp ./package*.json "$SERVER_CONNECTION":~/
# SSH into server and install dependencies
ssh "$SERVER_CONNECTION" "cd ~/ && npm install --production"
# Then copy the dist folder
rsync -avz ./dist/ "$SERVER_CONNECTION":~/dist/
Telia does not have a way to keep the usual PORT=8080 node ./your/start/script.mjs
persistent after we terminate the session, so we have to setup the following in the terminal:
npm install -g pm2
PORT=8080 pm2 start ~/your/start/script.mjs --name my-app
pm2 save
Now that it has been saved and started independent from the terminal, it still under the false sense of security assumption that Telia Eesti web hosting does not sometimes have restart sessions, migrations or technical difficulties where processes would have to be restarted. Luckily, we have the power to use our Crontab in the domain provider. So we need to do the following:
Crontab
and click on Add New Crontab Job
.Job name
with something like PM2 Restart
and Command
with cd ~ && pm2 resurrect
. Then select however you want to be notified and when and where. Then press Next
0 0 0 */10 * *
which means at 12:00 AM, every 10 days, restart the processes.