Operation of Be360 Fimm

Server

Dedicated: Be360fimm (ID: i-0214f1fe3ceffe8ce)
Directories: /home/admin
OS: Debian 12
SSH login: admin@35.158.209.70
Hours of operation: 24/7


Fimm has 4 different scripts:

they all work the same way and they all have the same folder structure.


Folder structure

├── app.js
├── Storage
├── uploadFtp.sh
├── Certs
│   ├── server.cert
│   └── server.key
├── wab.log
├── Logs
│   ├── Ftp
│   └── Webhook
├── node_modules
├── package.json
└── package-lock.json

app.js

Application code. It create the endpoint “/webhook/image”.
Sample request:

POST https://wabfimmdemo.ccaas.becloudsolutions.com/webhook/image
{
	"phone":"3519970274",
	"URL":"https://i.4cdn.org/g/1594686838367.png"
}

On request, it add “00” in front of the phonenumber, it create a WriteSteam in the /Storage folder with name pattern phone + “_” + timestamp + “.jpg” and then download the image from the link in the stream.


Storage

Contains images that are gonna to be sent in the FTP connection.


uploadFtp.sh

Bash script that upload to Fimm's FTP all images sent in the lat 60 minutes using ncftp.
It runs with a cronjob every second minute of each hours, in order to discriminate if it needs to upload the images in the $yesterdayDate folder or in the $todayDate folder.
It also handle logs creation and clear wab.log.


Certs

Contains certificates to enable https endpoint in app.js.
To create:

openssl req -nodes -new -x509 -keyout server.key -out server.cert


wab.log

Pm2 log file. Every hour is cleaned by uploadFtp.sh and saved in the /Logs/Webhook folder.


Logs

Contains hourly logs for both FTP and webhooks interactions.


node_modules, package.json, package-lock.json

Standard NodeJS stuff.


Nginx config

Located at /etc/nginx/sites-available/node.conf, all endpoints are served in HTTPS.


Active cronjobs


Lorenzo Cesana 2024/03/26 09:25