A simple server to upload data, train and serve ML models.
./start_app.sh
./stop_app.sh
http://localhost:8000/docs
cat app.log
cat uvicorn.log
cat uvicorn.err.log
- Connect to remote server
scripts/ssh-connect-aruba.sh
- Clone the repo remotely
git clone...
- Execute the Aruba setup script on the remote server
scripts/setup-aruba.sh
sudo ufw allow ssh
sudo ufw enable
sudo ufw allow 8000/tcp
Allow specific ip address for client of the web server:
sudo ufw allow from 188.12.139.142 to any port 8000
Allow a range of ip addresses for all the ports:
sudo ufw allow from 192.168.0.0/24
Then disallow all the others:
sudo ufw default deny incoming
Il comando ss
può mostrare le porte che stanno ascoltando le connessioni e le reti da cui accetta tali connessioni. È un’alternativa moderna al vecchio comando netstat.
Esegui il seguente comando per visualizzare le porte aperte:
sudo ss -ltn
tac /var/log/ufw.log | head -n 20
To see the status:
sudo ufw status verbose
With priority:
sudo ufw status numbered
You should see something like:
sudo ufw status verbose
Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), deny (routed)
New profiles: skip
To Action From
-- ------ ----
Anywhere ALLOW IN 72.80.205.0/24
22 ALLOW IN Anywhere
8000 ALLOW IN 188.12.139.142
To use logrotate for managing your logs, you need to create a configuration file for logrotate. Here's a step-by-step plan:
- Create a new logrotate configuration file, e.g.,
/etc/logrotate.d/uvicorn
. In this file, specify the path to your log files, the rotation interval, the number of backups to keep, and any other options you want to use.
/home/user/projects/wl-semsearch-poc/*.log {
daily
rotate 7
compress
missingok
notifempty
create 0644 user group
}
This configuration will rotate the log files daily, keep 7 days of backups, compress rotated files, and create new log files with the specified permissions and ownership if they don't exist.
Finally, ensure that logrotate
is run daily by the cron daemon, you can add a cron job manually with crontab -e
and adding the following line:
crontab -e
@daily /usr/sbin/logrotate /etc/logrotate.conf
This will run logrotate daily using the main configuration file /etc/logrotate.conf, which includes all files in the /etc/logrotate.d directory.