Managing FastAPI Projects with Poetry: A Step-by-Step Guide

Image
This guide will walk you through how to use Poetry to manage dependencies and structure your project in FastAPI . It includes detailed explanations of Poetry's core concepts and commands to help prevent issues that can arise during team collaboration and deployment. 1. What is Poetry? Poetry is a dependency management and packaging tool for Python. It goes beyond simply installing libraries by allowing you to clearly declare the dependencies your project needs and ensuring that all developers on the project have the same library versions. Clarity in Dependency Management : Explicitly manage your project's basic information and required libraries through the pyproject.toml file. Reproducible Builds : By locking all dependency versions in the poetry.lock file, it fundamentally prevents "it works on my machine" problems. Integrated Development Environment : It automatically creates and manages isolated virtual environments for each project and handles mo...

How to enable ssh server and client on Ubuntu

openssh

Introduction

SSH (Secure Shell) is a network protocol used to securely communicate between two computers and transfer data. One of the main features of SSH is that it works well on insecure networks, as the communication channel is encrypted. The most widely-used SSH implementation is the OpenSSH suite, which includes the following tools:

  • Remote operations: ssh, scp, sftp
  • Key management: ssh-add, ssh-keysign, ssh-keyscan, ssh-keygen
  • Service-side tools: sshd, sftp-server, ssh-agent

Environment

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.4 LTS
Release:        22.04
Codename:       jammy

$ uname -r
6.8.0-57-generic

Install OpenSSH Server and Client

OpenSSH client is usually pre-installed on Ubuntu. To accept SSH connections, install the server component:

$ sudo apt update
$ sudo apt install openssh-server openssh-client

Verify installation:

$ ssh -V
OpenSSH_8.9p1 Ubuntu-3ubuntu0.13, OpenSSL 3.0.2 15 Mar 2022

Allow SSH Port (22) Through the Firewall

Ubuntu uses UFW as the default firewall. Allow SSH with the following commands:

$ sudo ufw allow ssh
Rule added
Rule added (v6)

$ sudo ufw enable
Command may disrupt existing ssh connections. Proceed with operation (y|n)? y
Firewall is active and enabled on system startup

$ sudo ufw status
Status: active
To                         Action      From
--                         ------      ----
22/tcp                     ALLOW       Anywhere
22/tcp (v6)                ALLOW       Anywhere (v6)

Start and Enable SSH Service

Use systemctl to start and enable the SSH server (sshd):

$ sudo systemctl start ssh
$ sudo systemctl enable ssh

Check SSH Service Status and Listening Port

$ sudo systemctl status ssh
● ssh.service - OpenBSD Secure Shell server
     Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
     Active: active (running) since Thu 2025-04-24 08:18:00 PDT; 2min 3s ago
       Docs: man:sshd(8)
             man:sshd_config(5)
   Main PID: 3104741 (sshd)
      Tasks: 1 (limit: 18790)
     Memory: 1.7M
        CPU: 25ms
     CGroup: /system.slice/ssh.service
             └─3104741 "sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups"

Apr 24 08:18:00 GU502DU systemd[1]: Starting OpenBSD Secure Shell server...
Apr 24 08:18:00 GU502DU sshd[3104741]: Server listening on 0.0.0.0 port 22.
Apr 24 08:18:00 GU502DU sshd[3104741]: Server listening on :: port 22.
Apr 24 08:18:00 GU502DU systemd[1]: Started OpenBSD Secure Shell server.

Test SSH Connection on Loopback

Try connecting to your own machine to verify SSH is working:

$ ssh your_username@127.0.0.1

First-time connection prompt:

$ ssh jason@127.0.0.1
The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established.
ED25519 key fingerprint is SHA256:y+fnvwQ29kzrFIrvXBEl7NXd9ZdjdZsj6xDaCKY94Tc.
This host key is known by the following other names/addresses:
    ~/.ssh/known_hosts:1: [hashed name]
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '127.0.0.1' (ED25519) to the list of known hosts.
jason@127.0.0.1's password: 
Welcome to Ubuntu 22.04.4 LTS (GNU/Linux 6.8.0-57-generic x86_64)

If you see the login prompt and connect successfully, your SSH server and client setup is working properly!


Comments

Popular posts from this blog

Resolving Key Exchange Failure When Connecting with SecureCRT to OpenSSH

SecureCRT] How to Back Up and Restore SecureCRT Settings on Windows

How to Set Up Vaultwarden (Bitwarden) on Synology NAS (Best Free Alternative to LastPass)