User Tools

Site Tools


be360:fimm

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
be360:fimm [2024/03/25 09:14] – created 93.66.122.50be360:fimm [2024/08/28 08:17] (current) – Added sign spacing sysadm
Line 4: Line 4:
  
 Dedicated: Be360fimm (ID: i-0214f1fe3ceffe8ce)\\ Dedicated: Be360fimm (ID: i-0214f1fe3ceffe8ce)\\
-Directories: found in ''/home/admin''+Directories: ''/home/admin''\\ 
 +OS: Debian 12\\ 
 +SSH login: admin@35.158.209.70\\ 
 +Hours of operation: 24/7
 ---- ----
  
Line 17: Line 20:
 \\ \\
  
-=== Folder structure ===+==== Folder structure ====
 <code> <code>
 +├── app.js
 +├── Storage
 +├── uploadFtp.sh
 ├── Certs ├── Certs
 │   ├── server.cert │   ├── server.cert
 │   └── server.key │   └── server.key
-├── FtpStorage+├── wab.log
 ├── Logs ├── Logs
 │   ├── Ftp │   ├── Ftp
 │   └── Webhook │   └── Webhook
-├── Storage 
-├── app.js 
 ├── node_modules ├── node_modules
-├── package-lock.json 
 ├── package.json ├── package.json
-├── uploadFtp.sh +└── package-lock.json
-└── wab.log+
 </code> </code>
 +
 +----
 +=== app.js ===
 +Application code. It create the endpoint "/webhook/image".\\
 +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 [[https://nodejs.org/api/fs.html#fscreatewritestreampath-options|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 [[https://www.ncftp.com|ncftp]].\\
 +It runs with a [[https://en.wikipedia.org/wiki/Cron|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:
 +<code>
 +openssl req -nodes -new -x509 -keyout server.key -out server.cert
 +</code>
 +
 +\\
 +
 +=== 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 [[https://nodejs.org/|NodeJS]] stuff.\\
 +
 +\\
 +
 +=== Nginx config ===
 +Located at ''/etc/nginx/sites-available/node.conf'', all endpoints are served in HTTPS.\\
 +  * Port 5000: AQP
 +  * Port 5001: ComoAcque
 +  * Port 5002: 2iReteGas_Lotto_5
 +  * Port 5003: 2iReteGas_Lotto_6
 +
 +\\
 +
 +=== Active cronjobs ===
 +  * Automated SSL certs renewal: ''0 0 25 */2 * sudo certbot --nginx renew --all --force-renewal''
 +  * Automated [[https://www.gnu.org/software/findutils/manual/html_node/find_html/Invoking-updatedb.html#Invoking-updatedb|updatedb]] command: ''*/30 * * * * /usr/bin/updatedb''
 +  * For each Fimm's customer there is a separated cronjob ''2 * * * * /home/admin/be360fimm-*/uploadFtp.sh''
 +
 +\\
 +
 + --- //[[lorenzo.cesana@becloudsolutions.com|Lorenzo Cesana]] 2024/03/26 09:25//
be360/fimm.1711358043.txt.gz · Last modified: by 93.66.122.50

Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Public Domain Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki