Skip to content

Shipmint connects to postgres, runs SQL queries, exports data to CSV, and ships your container to Azure, all automated with GitHub Actions.

License

Notifications You must be signed in to change notification settings

r-o-bo/shipmint

Repository files navigation

Shipmint

Shipmint is a data querying and export tool built with Python for running analytical SQL queries on the dvdrental dataset. It connects to a PostgreSQL database, executes pre-defined queries, and exports the results to CSV files.

This project includes a working Continuous Integration and Continuous Delivery (CI/CD) pipeline using GitHub Actions that builds and pushes a Docker image to Azure Container Registry and deploys it via Azure Container Instances.

Hello Stranger


📂 Project Structure

.
shipmint/
├── .github/
│   └── workflows/
│       └── deploy.yml
├── .dockerignore
├── Dockerfile
├── LICENSE
├── flyingnimbus.py
├── requirements.txt
├── README.md

⚙️ Features and Technologies:

  • Python: Scripting and data transformation
  • PostgreSQL: Data storage (hosted on Azure)
  • Docker: Containerization
  • Azure Container Registry (ACR): Stores Docker images
  • Azure Container Instances (ACI): Runs containers on demand
  • GitHub Actions: CI/CD pipeline

Python libraries used:

  • psycopg2 – Used to connect and interact with the PostgreSQL database.
  • os – Handles interaction with the operating system, such as environment variables and file paths.
  • csv – Used for reading and writing CSV files, primarily for data export/import.
  • time – Utilized during development and testing for adding delays (for stuff like while waiting for Azure containers or services to be ready).
  • dotenv – Loads environment variables from a .env file, for keeping sensitive configs like db credentials out of source code.

Setup

1. Clone the repo

git clone https://github.com/r-o-bo/shipmint
cd shipmint

2. Create .env file

DB_HOST=your_postgres_host 
DB_NAME=dvdrental
DB_USER=your_username 
DB_PASSWORD=your_password

🐳 Running with Docker

docker build -t flying-nimbus .
docker run --env-file .env flying-nimbus

These are injected from GitHub Secrets during CI/CD:

DB_HOST
DB_NAME
DB_USER
DB_PASSWORD
ACR_LOGIN_SERVER
ACR_USERNAME
ACR_PASSWORD
AZURE_RG (Resource Group)
AZURE_CLIENT_ID
AZURE_CLIENT_SECRET
AZURE_TENANT_ID
AZURE_SUBSCRIPTION_ID
ACI_NAME

🔧 CI/CD Pipeline

On push to master, the GitHub Actions workflow will:

  1. Authenticate with Azure via OIDC.
  2. Build and push a Docker image to ACR.
  3. Delete any existing container instance.
  4. Deploy a new container to ACI.
  5. Wait for the container to finish execution.
  6. Delete the container (optional cleanup).

Azure1

Azure2


📜 License

This project is licensed under the MIT License.

About

Shipmint connects to postgres, runs SQL queries, exports data to CSV, and ships your container to Azure, all automated with GitHub Actions.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published