Termux development environment setup tool (PostgreSQL, Redis, etc.)
Project description
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.
⚡ Quick Start
Prerequisites
- Termux with Proot-Distro (Ubuntu recommended).
- Python 3.8+ installed.
- Basic knowledge of terminal operations.
Installation
Install tds directly from the source with a single command:
pip install .
Or via PyPI (Recommended for users):
pip install termux-dev-setup
Run
Launch the interactive wizard to get started immediately:
tds --interactive
Demo
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
tds manage postgres status
✨ Features
💎 Core Services
- PostgreSQL: Production-ready setup with
pg_ctl. Manage users, databases, and logs effortlessly. - Redis: Secure, persistent cache with full lifecycle management. Includes password protection and persistence settings.
- OpenTelemetry: Observability out-of-the-box. Install and manage the OTEL Collector for metrics and traces.
- Google Cloud CLI: Seamless installation of
gcloudto manage your GCP resources from your pocket.
🚀 Performance & UX
- Interactive Mode: A user-friendly wizard (
tds -i) guides you through setup without memorizing flags. - Smart Validation: Built-in checks for ports, configuration paths, and environment variables prevent errors before they happen.
- Version Control: Specify exactly which version of a service you need (e.g.,
tds setup postgres --version 15).
🛡️ Security
- Secure Defaults: Redis is configured with protected mode and password support.
- Non-Root Execution: Services run as the current user, avoiding dangerous root permissions in the container.
🛠️ Configuration
Customize your setup using Environment Variables. tds respects these variables during setup and execution, allowing for flexible deployments.
Environment Variables
| Variable | Description | Default Value | Required |
|---|---|---|---|
PG_PORT |
PostgreSQL listening port | 5432 |
No |
PG_DATA |
PostgreSQL data directory | /var/lib/postgresql/data |
No |
PG_LOG |
PostgreSQL log file path | /var/log/postgresql/postgresql.log |
No |
PG_USER |
Default PostgreSQL user | postgres |
No |
REDIS_PORT |
Redis listening port | 6379 |
No |
REDIS_CONF |
Redis configuration file | /etc/redis/redis.conf |
No |
REDIS_DATA_DIR |
Redis data directory | /var/lib/redis |
No |
REDIS_PASSWORD |
Redis password | "" (Empty) |
No |
APPENDONLY |
Redis Append Only Mode | yes |
No |
OTEL_METRICS_PORT |
OTEL Metrics Port | 8888 |
No |
OTEL_GRPC_PORT |
OTEL gRPC Port | 4317 |
No |
OTEL_HTTP_PORT |
OTEL HTTP Port | 4318 |
No |
OTEL_CONFIG |
OTEL Config Path | ~/otel-config.yaml |
No |
CLI Arguments
| Flag/Command | Description | Example |
|---|---|---|
--interactive, -i |
Launch the interactive setup wizard. | tds -i |
setup [service] |
Install and configure a service. | tds setup postgres |
manage [service] [action] |
Control service state (start/stop/restart/status). | tds manage redis start |
--version |
Specify a version during setup. | tds setup postgres --version 15 |
🏗️ Architecture
tds follows a modular architecture, strictly separating the Command Line Interface (CLI) from the core business logic and configuration.
Directory Tree
src/termux_dev_setup/
├── cli.py # Entry Point: Parses arguments & routes commands
├── config.py # Configuration: Dataclasses & Env Var Validation
├── errors.py # Error Handling: Custom TDSError hierarchy
├── gcloud.py # Module: Google Cloud Installer
├── interactive.py # UI: Interactive Wizard Logic
├── otel.py # Module: OpenTelemetry Installer & Manager
├── postgres.py # Module: PostgreSQL Installer & Manager
├── redis.py # Module: Redis Installer & Manager
├── service_status.py # Logic: Service health checking
├── views.py # UI: Rich library views
└── utils/
├── banner.py # UI: CLI ASCII Art & Banner
└── status.py # UI: Logging, Success/Error styling
Data Flow
- User Input:
cli.pyreceives the command or triggersinteractive.py. - Configuration:
config.pyloads defaults and overrides with Environment Variables. - Validation: Ports and paths are validated before any action is taken.
- Execution: The respective module (e.g.,
redis.py) executes the requested action (Setup or Manage). - Feedback:
utils.statusrenders the result to the console using formatted output.
🐞 Troubleshooting
Common Issues
| Error Message | Possible Cause | Solution |
|---|---|---|
Port must be between 1 and 65535 |
Invalid port number in Env Vars. | Check PG_PORT or REDIS_PORT. |
Permission denied |
Trying to write to a protected directory. | Ensure you are running in Proot or use user-writable paths. |
Service failed to start |
Port conflict or bad config. | Check if another service is using the port. Check logs. |
command not found after install |
Path issue. | Ensure Python scripts are in your $PATH. Restart shell. |
Debugging
If a service fails to start, check the specific log files defined in your configuration:
- Postgres:
/var/log/postgresql/postgresql.log(default) - Redis:
/var/log/redis/redis-server.log(default) - OTEL:
~/otel.log(default)
🤝 Contributing
We welcome contributions! Please see our CONTRIBUTING.md for details.
Dev Setup
- Clone the repository.
- Install dependencies:
pip install . - Run tests:
pytest - Lint code:
ruff check .
🗺️ Roadmap
We are constantly improving tds. Here is a snapshot of our upcoming goals:
- Phase 1 (Completed): Core Services (PG, Redis, OTEL, GCloud), Basic Management.
- Phase 2 (Current): Interactive Setup, Version Management.
- Phase 3 (Upcoming): Plugin Architecture, Database Integrations (MySQL/Mongo), Observability Stack.
- Phase 4 (Vision): AI-Powered Tuning, Remote Tunnels.
See ROADMAP.md for the full detailed vision.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file termux_dev_setup-2.0.1.tar.gz.
File metadata
- Download URL: termux_dev_setup-2.0.1.tar.gz
- Upload date:
- Size: 41.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c798ed612ffb1c21849e1d285c4152e27bc427f01ceec592bd4f52cdf0620571
|
|
| MD5 |
6cdfe020a97d332259017a7912a190ff
|
|
| BLAKE2b-256 |
0b2a2984c5c166e64b5b1ba25cd35ec9ce03fc26289240fe38d2551bc69ed16b
|
Provenance
The following attestation bundles were made for termux_dev_setup-2.0.1.tar.gz:
Publisher:
publish.yml on dhruv13x/termux-dev-setup
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
termux_dev_setup-2.0.1.tar.gz -
Subject digest:
c798ed612ffb1c21849e1d285c4152e27bc427f01ceec592bd4f52cdf0620571 - Sigstore transparency entry: 764297464
- Sigstore integration time:
-
Permalink:
dhruv13x/termux-dev-setup@b44edef69c45662f1204cb891328f5dcd0223cf3 -
Branch / Tag:
refs/tags/v2.0.1 - Owner: https://github.com/dhruv13x
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b44edef69c45662f1204cb891328f5dcd0223cf3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file termux_dev_setup-2.0.1-py3-none-any.whl.
File metadata
- Download URL: termux_dev_setup-2.0.1-py3-none-any.whl
- Upload date:
- Size: 30.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c7c4785699aba75df3e07cdf7be6027bfd25e862b90946f59ca42f889b6e2ee
|
|
| MD5 |
d3052327c0e0bc4c7468e4fc118d12c7
|
|
| BLAKE2b-256 |
a33e206f829b4da472c937cbc9806cf275e34dfc7acfb6e92ea568549bb040aa
|
Provenance
The following attestation bundles were made for termux_dev_setup-2.0.1-py3-none-any.whl:
Publisher:
publish.yml on dhruv13x/termux-dev-setup
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
termux_dev_setup-2.0.1-py3-none-any.whl -
Subject digest:
8c7c4785699aba75df3e07cdf7be6027bfd25e862b90946f59ca42f889b6e2ee - Sigstore transparency entry: 764297466
- Sigstore integration time:
-
Permalink:
dhruv13x/termux-dev-setup@b44edef69c45662f1204cb891328f5dcd0223cf3 -
Branch / Tag:
refs/tags/v2.0.1 - Owner: https://github.com/dhruv13x
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b44edef69c45662f1204cb891328f5dcd0223cf3 -
Trigger Event:
push
-
Statement type: