Skip to main content

Termux development environment setup tool (PostgreSQL, Redis, etc.)

Project description

termux-dev-setup logo

PyPI version Python Wheel Release

Build status Codecov Test Coverage Code style: black Ruff Security

Downloads PyPI Downloads OS Python Versions

License: MIT

termux-dev-setup (tds)

Your "Batteries Included" Development Environment for Termux.

tds is a powerful CLI tool designed to effortlessly set up and manage a production-grade development environment inside Termux (Proot/Ubuntu). Forget manual configuration files and permission headaches—get your database, cache, and cloud tools running in seconds.

📖 About

Why does this exist? Setting up services like PostgreSQL or Redis on a mobile environment can be tricky. tds abstracts away the complexity, providing a seamless experience for developers who want to code on the go. Whether you're building a backend API or learning cloud engineering, tds prepares your environment so you can focus on writing code.

🚀 Quick Start

Prerequisites

  • Termux with Proot-Distro (Ubuntu recommended) installed.
  • Python 3.8+
  • pip (Python Package Installer)

Installation

Install tds directly from the source with a single command:

pip install .

Usage Example

Get a PostgreSQL database up and running in under a minute:

# 1. Install and Configure PostgreSQL
tds setup postgres

# 2. Start the Server
tds manage postgres start

# 3. Check Status (Is it running?)
tds manage postgres status

# 4. Connect to your database
# (Connection string provided in output)

✨ Key Features

  • PostgreSQL Management: God Level control over your database. Install, configure, start, stop, and restart with ease.
  • Redis Support: Full lifecycle management for Redis, including password protection and persistence settings.
  • OpenTelemetry Management: Full lifecycle management (start, stop, status) for the OTEL collector.
  • Google Cloud CLI: Seamless installation of gcloud to manage your GCP resources from your phone.
  • Smart Validation: Built-in checks for ports, configuration paths, and environment variables.
  • Robust Error Handling: informative error messages to help you debug setup issues quickly.

⚙️ Configuration & Advanced Usage

Customize your setup using Environment Variables. tds respects these variables during setup and execution.

Environment Variables

Variable Description Default Value
PG_PORT PostgreSQL listening port 5432
PG_DATA PostgreSQL data directory /var/lib/postgresql/data
PG_LOG PostgreSQL log file path /var/log/postgresql/postgresql.log
PG_USER Default PostgreSQL user postgres
PG_DB Default database to create app
REDIS_PORT Redis listening port 6379
REDIS_CONF Redis configuration file /etc/redis/redis.conf
REDIS_DATA_DIR Redis data directory /var/lib/redis
REDIS_PASSWORD Redis password (if any) "" (Empty)
APPENDONLY Redis Append Only Mode yes
OTEL_VERSION OpenTelemetry Collector version 0.137.0

Note: Paths like /var/lib refer to the path inside your Proot environment.

CLI Command Reference

Command Action Description
tds setup postgres Setup Install & Init PostgreSQL
tds setup redis Setup Install & Configure Redis
tds setup otel Setup Download & Install OTEL Collector
tds setup gcloud Setup Install Google Cloud CLI
tds manage postgres start, stop, restart, status Control PostgreSQL Service
tds manage redis start, stop, restart, status Control Redis Service
tds manage otel start, stop, restart, status Control OpenTelemetry Collector

🏗️ Architecture

tds is built with modularity in mind, separating service logic from the CLI interface.

Directory Structure

src/termux_dev_setup/
├── cli.py            # Entry Point (Argparse logic)
├── config.py         # Configuration Classes & Validation
├── gcloud.py         # Google Cloud Installer
├── otel.py           # OpenTelemetry Installer
├── postgres.py       # PostgreSQL Installer & Manager
├── redis.py          # Redis Installer & Manager
└── utils/
    ├── banner.py     # CLI Visuals
    ├── lock.py       # Process Locking
    ├── shell.py      # Shell Command Wrappers
    └── status.py     # Logging & Output Utilities

Core Logic Flow

  1. Entry: cli.py parses the command (setup or manage).
  2. Configuration: config.py loads defaults and overrides them with Environment Variables.
  3. Execution: The specific service module (e.g., postgres.py) performs the action.
    • Setup: Checks prerequisites (apt, users), installs packages, and initializes data directories.
    • Manage: Uses process control (like pg_ctl or direct binary execution) to handle the service state.
  4. Feedback: utils.status provides rich, colored output to the user.

🗺️ Roadmap

We are constantly evolving! Here is a glimpse of what's next:

  • Upcoming:
    • 🔌 Plugin Architecture: Add your own services easily.
    • 🧪 Automated Testing: More robust integration tests.
    • 📊 Observability Stack: Prometheus & Grafana setup.
  • Completed:
    • ✅ Core Services (PG, Redis, OTEL, GCloud)
    • ✅ Service Lifecycle Management (Start/Stop/Restart)

See ROADMAP.md for the detailed vision.

🤝 Contributing & License

We welcome contributions! Whether it's a bug fix or a new feature, please check out our GitHub repository.

This project is licensed under the MIT License. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

termux_dev_setup-2.0.0.tar.gz (40.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

termux_dev_setup-2.0.0-py3-none-any.whl (30.0 kB view details)

Uploaded Python 3

File details

Details for the file termux_dev_setup-2.0.0.tar.gz.

File metadata

  • Download URL: termux_dev_setup-2.0.0.tar.gz
  • Upload date:
  • Size: 40.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for termux_dev_setup-2.0.0.tar.gz
Algorithm Hash digest
SHA256 6da26655fbc3127750b56e7445daa8336ef04a5ea307fac8fca4c8c11c6ffc52
MD5 d3c8a8f4bcb222809126503e6a55a245
BLAKE2b-256 a2733688e56d9843ca45ceb07ddef10e3d9c90e5c5eb29adfcac52568bfb28b4

See more details on using hashes here.

Provenance

The following attestation bundles were made for termux_dev_setup-2.0.0.tar.gz:

Publisher: publish.yml on dhruv13x/termux-dev-setup

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file termux_dev_setup-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for termux_dev_setup-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0a4bc01fa28f09f22eb1764ccf37f72b7a3b2ae4c5d42fe9ac5ef65e9e604b25
MD5 4ccbe8deadb88ba2838556e4b0700868
BLAKE2b-256 8e64bb4b0fbcdbaac2b8a1c0cfb2db60c0ef0190f35b1eacdc3848d5765e794b

See more details on using hashes here.

Provenance

The following attestation bundles were made for termux_dev_setup-2.0.0-py3-none-any.whl:

Publisher: publish.yml on dhruv13x/termux-dev-setup

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page