This is an old revision of the document!
Operation
Server
Dedicated: WhatsappTemplates (ID: i-072df39da22f6bd3d)
Directories: /var/www/ocme
OS: *TO DO*
SSH login: admin@52.28.158.203
Hours of operation: 24/7
Folder structure
├── dist ├── node_modules ├── public ├── src │ ├── assets │ | ├── aus.png │ | ├── bg.jpg │ | ├── bg.png │ | ├── bra.png │ | ├── eng.png │ | ├── fra.png │ | ├── ita.png │ | ├── mex.png │ | ├── sou.png │ | ├── spa.png │ | ├── tha.png │ | └── usa.png │ ├── components │ | ├── InputPhone.jsx │ | ├── Message.jsx │ | ├── style.css │ | ├── Template.jsx │ | └── Title.jsx | ├── pages │ | ├── Aus.jsx │ | ├── Bra.jsx │ | ├── Debug.jsx │ | ├── Eng.jsx │ | ├── Fra.jsx │ | ├── Ita.jsx │ | ├── Mex.jsx │ | ├── Sou.jsx │ | ├── Spa.jsx │ | ├── Tha.jsx │ | └── Usa.jsx | ├── App.css | ├── App.jsx | ├── index.css | ├── lang.json │ └── main.jsx ├── index.html ├── package.json └── README.md └── vite.config.js └── yarn.lock
dist
Folder that contains the build of the project To run the build enter '/var/www/ocme and run the command yarn build
Application code. It create the endpoint “/webhook/image”./Storage
Sample request:
<code>
POST https://wabfimmdemo.ccaas.becloudsolutions.com/webhook/image
{
“phone”:“3519970274”,
“URL”:“https://i.4cdn.org/g/1594686838367.png”
}
</code>
On request, it add “00” in front of the phonenumber, it create a WriteSteam in the folder with name pattern phone + “_” + timestamp + “.jpg” and then download the image from the link in the stream.
$yesterdayDate
=== 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 folder or in the $todayDate folder.wab.log
It also handle logs creation and clear .
app.js
=== Certs ===
Contains certificates to enable https endpoint in .uploadFtp.sh
To create:
<code>
openssl req -nodes -new -x509 -keyout server.key -out server.cert
</code>
=== wab.log ===
Pm2 log file. Every hour is cleaned by and saved in the /Logs/Webhook folder.
/etc/nginx/sites-available/node.conf
=== Logs ===
Contains hourly logs for both FTP and webhooks interactions.
=== node_modules, package.json, package-lock.json ===
Standard NodeJS stuff.
=== Nginx config ===
Located at , all endpoints are served in HTTPS.0 0 25 */2 * sudo certbot –nginx renew –all –force-renewal
* Port 5000: AQP
* Port 5001: ComoAcque
* Port 5002: 2iReteGas_Lotto_5
* Port 5003: 2iReteGas_Lotto_6
=== Active cronjobs ===
* Automated SSL certs renewal:
* Automated updatedb command: */30 * * * * /usr/bin/updatedb
* For each Fimm's customer there is a separated cronjob 2 * * * * /home/admin/be360fimm-*/uploadFtp.sh''
— Lorenzo Cesana 2024/03/26 09:25