🪟 Windows TippsID.3 GTI: VW stellt den stärksten Serien-GTI aller Zeiten vor(16.09.2026 um 10:00 Uhr)
🪟 Windows TippsDoppelte Power: HMX 6 mit 2x RTX 5090 von ZOTAC GAMING(16.09.2026 um 10:25 Uhr)
🪟 Windows TippsAnthbot N8 im Test: Mähroboter mit Fangkorb für Gras und Laub(16.09.2026 um 10:30 Uhr)
🪟 Windows TippsGenesung, Erholung, Entspannung – Aufgaben der Beleuchtung(16.09.2026 um 10:30 Uhr)
🪟 Windows TippsID.3 GTI: VW stellt den stärksten Serien-GTI aller Zeiten vor(16.09.2026 um 10:00 Uhr)
🪟 Windows TippsDoppelte Power: HMX 6 mit 2x RTX 5090 von ZOTAC GAMING(16.09.2026 um 10:25 Uhr)
🪟 Windows TippsAnthbot N8 im Test: Mähroboter mit Fangkorb für Gras und Laub(16.09.2026 um 10:30 Uhr)
🪟 Windows TippsGenesung, Erholung, Entspannung – Aufgaben der Beleuchtung(16.09.2026 um 10:30 Uhr)

🔧 Programmierung 🕛 vor 1 Jahr 6 Min Lesezeit
0

Deploying a FastAPI Application with CI/CD Pipeline: HNG Task 3

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht




Introduction



In this article, I will walk you through how I deployed a FastAPI application with continuous integration (CI) and continuous deployment (CD).






Requirements




  • Python

  • FastAPI Application

  • Docker

  • GitHub Actions Secrets

  • AWS Linux server






Step 1: Clone the Repository



The first step is to fork the




  • I then started the FastAPI application using Uvicorn
    uvicorn main:app --reload





compose




  • As you can see, our containers are up and running and Nginx is successfully routing incoming traffic to our FastAPI application.






Step 7: Create a Linux Server



For hosting and deploying our FastAPI application, I set up a Linux server on AWS. This server serves as the backbone of our deployment environment, where our Dockerized application will run and be accessible to users.






Step 8: Set Up the CI Pipeline



I created a GitHub Actions Workflow File for this step to automatically run tests on every pull request targeting the main branch. This ensures that any new changes are validated before they can be merged.

mkdir -p .github/workflows/

cd .github/workflows/

touch ci.yml




CODE
name: ci pipeline

on:
pull_request:
branches: [ main ]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run tests
run: pytest







  • push your changes to GitHub and check the status of your pipeline
    ci-pipeline






Step 9: Set Up the Deployment Pipeline



For continuous deployment, I created another GitHub Actions Workflow File named deploy.yml. This deployment pipeline is triggered whenever changes are pushed to the main branch, automating the process of updating the live application.

touch deploy.yml




CODE
name: CD Pipeline
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Deploy via SSH
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
# Update package index and install dependencies
sudo apt-get update -y
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common

# Add Docker's official GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

# Install Docker
sudo apt-get update -y
sudo apt-get install -y docker-ce docker-ce-cli containerd.io

# Add the SSH user to the Docker group
sudo usermod -aG docker ${{ secrets.SSH_USERNAME }}

# Install Docker Compose
sudo curl -L "https://github.com/docker/compose/releases/download/v2.20.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

# Verify installations
docker --version
docker-compose --version

# Navigate to the project directory and deploy
cd /home/ubuntu/
git clone <your-github-repo>
cd fastapi-book-project/
git pull
docker-compose up -d --build







  • Ensure your secrets are stored: Make sure SSH_HOST, SSH_USERNAME, and SSH_PRIVATE_KEY are added to your GitHub repository's secrets.

  • Push your changes to GitHub and check the status of your pipeline.
    cd-pipeline

  • Post-Deployment Verification: Once the pipeline completes, verify that your application is running as expected.
    server






Step 10: Repository Access Requirement



Before submission, we are supposed to invite the hng12-devbotops to our GitHub account as a collaborator in our repository. To do this;




  • Open the repository you want to add a collaborator

  • Click on the Settings tab, which is usually located on the right side of the repository menu.

  • In the left sidebar, under access, select Collaborators.

  • Click on add people, add hng12-devbotops
    bot



Thanks for reading, don't forget to drop a like and comment 😄😄 👩🏻‍💻👩🏻‍💻

Vollständiger Original-Artikel
Den kompletten Beitrag mit allen Details direkt auf dev.to lesen.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
1 Quelle
ID.3 GTI: VW stellt den stärksten Serien-GTI aller Zeiten vor
1 Quelle
32 Kerne, 128 GB RAM, 80 TB: Das war unsere Profi-Höllenmaschine HMX Pro
1 Quelle
Doppelte Power: HMX 6 mit 2x RTX 5090 von ZOTAC GAMING
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Deploying a FastAPI Application with CI/CD Pipeline: HNG Task 3

Thematisch verwandte Begriffe: Deploying, FastAPI, Application, with · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...