From 8212d00f680f67ca4e0c9cd556769ce0a665a36a Mon Sep 17 00:00:00 2001 From: Ankan Saha Date: Sun, 15 Mar 2026 12:38:00 +0530 Subject: [PATCH 1/2] chore: Remove unused model configuration from settings.json --- .gemini/settings.json | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.gemini/settings.json b/.gemini/settings.json index 10694e7..b6d9274 100644 --- a/.gemini/settings.json +++ b/.gemini/settings.json @@ -9,12 +9,6 @@ "runtime": "Go ≥1.18" }, - "model": { - "name": "gemini-3-pro", - "temperature": 0.2, - "maxTokens": 8192 - }, - "context": { "fileName": ["GEMINI.md"], "hierarchical": true From c466ad5e76962f15482c7571ecbdd51de0d81354 Mon Sep 17 00:00:00 2001 From: Ankan Saha Date: Thu, 19 Mar 2026 20:50:10 +0530 Subject: [PATCH 2/2] feat: Update version to 8.19.43-stable and enhance phpMyAdmin connection options --- INSTALLATION.md | 4 +- Scripts/installer.sh | 2 +- VERSION | 2 +- npm/package.json | 2 +- src/Core/main.go | 2 +- src/Docker/DockerComposeMaker.go | 7 +- src/base/Banner.go | 2 +- src/tools/PhpMyAdmin.go | 150 ++++++++++++++++++++++++++++++- 8 files changed, 161 insertions(+), 10 deletions(-) diff --git a/INSTALLATION.md b/INSTALLATION.md index 75ed606..df3ea67 100644 --- a/INSTALLATION.md +++ b/INSTALLATION.md @@ -19,10 +19,10 @@ This is the simplest method for Debian-based systems like Ubuntu, Debian, Linux ```bash # Download the latest .deb release -wget https://github.com/nexoral/ContainDB/releases/download/v7.19.43-stable/containDB_7.19.43-stable_amd64.deb +wget https://github.com/nexoral/ContainDB/releases/download/v8.19.43-stable/containDB_8.19.43-stable_amd64.deb # Install the package -sudo dpkg -i containDB_7.19.43-stable_amd64.deb +sudo dpkg -i containDB_8.19.43-stable_amd64.deb # If you see dependency errors, run: sudo apt-get install -f diff --git a/Scripts/installer.sh b/Scripts/installer.sh index 9f68ae3..0060c65 100755 --- a/Scripts/installer.sh +++ b/Scripts/installer.sh @@ -7,7 +7,7 @@ ARCH=$(dpkg --print-architecture) echo "Detected architecture: $ARCH" -VERSION="7.19.43-stable" +VERSION="8.19.43-stable" if [[ "$ARCH" == "amd64" ]]; then PKG="containdb_${VERSION}_amd64.deb" diff --git a/VERSION b/VERSION index b5892ba..430d06a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -7.19.43-stable +8.19.43-stable diff --git a/npm/package.json b/npm/package.json index 9fd23f4..458f1e7 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "containdb", - "version": "7.19.43", + "version": "8.19.43", "description": "The Ultimate Docker Database Manager. Automate the creation, management, and monitoring of containerized databases (MongoDB, MySQL, PostgreSQL, Redis) and their GUI tools (Compass, phpMyAdmin, PgAdmin, RedisInsight) with a simple CLI. No complex Docker commands—just productivity.", "bin": { "containdb": "./InstallController.js" diff --git a/src/Core/main.go b/src/Core/main.go index 272ccd1..fb64a77 100644 --- a/src/Core/main.go +++ b/src/Core/main.go @@ -11,7 +11,7 @@ import ( ) func main() { - VERSION := "7.19.43-stable" + VERSION := "8.19.43-stable" // handle version flag without requiring sudo if len(os.Args) > 1 && os.Args[1] == "--version" { diff --git a/src/Docker/DockerComposeMaker.go b/src/Docker/DockerComposeMaker.go index 288fef7..5906c9d 100644 --- a/src/Docker/DockerComposeMaker.go +++ b/src/Docker/DockerComposeMaker.go @@ -183,7 +183,12 @@ func getContainerInfo(containerName string) (ContainerInfo, error) { for _, env := range envVars { if strings.HasPrefix(env, "PMA_HOST=") || strings.HasPrefix(env, "PMA_PORT=") || - strings.HasPrefix(env, "PMA_USER=") { + strings.HasPrefix(env, "PMA_USER=") || + strings.HasPrefix(env, "PMA_PASSWORD=") || + strings.HasPrefix(env, "PMA_DATABASE=") || + strings.HasPrefix(env, "PMA_ARBITRARY=") || + strings.HasPrefix(env, "PMA_SSL=") || + strings.HasPrefix(env, "PMA_SSL_VERIFY=") { filteredEnvVars = append(filteredEnvVars, env) } } diff --git a/src/base/Banner.go b/src/base/Banner.go index 7941b1e..72e4583 100644 --- a/src/base/Banner.go +++ b/src/base/Banner.go @@ -9,7 +9,7 @@ import ( "github.com/fatih/color" ) -const Version = "7.19.43-stable" +const Version = "8.19.43-stable" func ShowBanner() { // Define styles diff --git a/src/tools/PhpMyAdmin.go b/src/tools/PhpMyAdmin.go index 1b3cf8f..42fcbf3 100644 --- a/src/tools/PhpMyAdmin.go +++ b/src/tools/PhpMyAdmin.go @@ -10,6 +10,16 @@ import ( "github.com/manifoldco/promptui" ) +// CloudDBConfig holds cloud database connection parameters +type CloudDBConfig struct { + Host string + Port string + Username string + Password string + Database string // Optional + EnableSSL bool +} + func StartPHPMyAdmin() { // Check if phpMyAdmin is already running if Docker.IsContainerRunning("phpmyadmin", true) { @@ -30,12 +40,55 @@ func StartPHPMyAdmin() { } } + // Detect local MySQL/MariaDB containers sqlContainers := Docker.ListOfContainers([]string{"mysql", "mariadb"}) - if len(sqlContainers) == 0 { - fmt.Println("No running MySQL/MariaDB containers found.") + + // Present connection type selection + connectionType := selectConnectionType(len(sqlContainers) > 0) + if connectionType == "exit" { + fmt.Println("Exiting phpMyAdmin setup.") return } + // Branch to appropriate handler + if connectionType == "local" { + startPHPMyAdminLocal(sqlContainers) + } else { + startPHPMyAdminCloud() + } +} + +// selectConnectionType prompts user to choose between local container or cloud database +func selectConnectionType(hasLocalContainers bool) string { + items := []string{} + + if hasLocalContainers { + items = append(items, "Local Container") + } + items = append(items, "Cloud Database", "Exit") + + prompt := promptui.Select{ + Label: "Select phpMyAdmin connection type", + Items: items, + } + _, selected, err := prompt.Run() + if err != nil { + fmt.Println("\n⚠️ Interrupt received, rolling back...") + Cleanup() + return "exit" + } + + if selected == "Exit" { + return "exit" + } else if selected == "Local Container" { + return "local" + } else { + return "cloud" + } +} + +// startPHPMyAdminLocal handles local container connection (existing logic) +func startPHPMyAdminLocal(sqlContainers []string) { items := append(sqlContainers, "Exit") prompt := promptui.Select{ Label: "Select a SQL container to link with phpMyAdmin", @@ -45,6 +98,7 @@ func StartPHPMyAdmin() { if err != nil { fmt.Println("\n⚠️ Interrupt received, rolling back...") Cleanup() + return } if selectedContainer == "Exit" { fmt.Println("Exiting phpMyAdmin setup.") @@ -80,3 +134,95 @@ func StartPHPMyAdmin() { fmt.Printf("phpMyAdmin started. Access it at http://localhost:%s\n", port) } } + +// startPHPMyAdminCloud handles cloud database connection (new logic) +func startPHPMyAdminCloud() { + config := getCloudConnectionConfig() + port := AskForInput("Enter host port to expose phpMyAdmin", "8080") + + // Validate inputs + if config.Host == "" { + fmt.Println("Error: Database host cannot be empty") + return + } + if config.Username == "" { + fmt.Println("Error: Username cannot be empty") + return + } + if config.Password == "" { + fmt.Println("Error: Password cannot be empty") + return + } + + // Pull image + fmt.Printf("Pulling phpMyAdmin image...\n") + cmd := exec.Command("docker", "pull", "phpmyadmin/phpmyadmin") + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + _ = cmd.Run() + + // Build docker run args + args := []string{ + "run", "-d", + "--restart", "unless-stopped", + "--network", "bridge", + "--name", "phpmyadmin", + "-e", "PMA_ARBITRARY=1", + "-e", fmt.Sprintf("PMA_HOST=%s", config.Host), + "-e", fmt.Sprintf("PMA_PORT=%s", config.Port), + "-e", fmt.Sprintf("PMA_USER=%s", config.Username), + "-e", fmt.Sprintf("PMA_PASSWORD=%s", config.Password), + } + + if config.Database != "" { + args = append(args, "-e", fmt.Sprintf("PMA_DATABASE=%s", config.Database)) + } + + if config.EnableSSL { + args = append(args, "-e", "PMA_SSL=1") + } else { + args = append(args, "-e", "PMA_SSL=0") + } + + // Always disable SSL verification by default + args = append(args, "-e", "PMA_SSL_VERIFY=0") + + args = append(args, "-p", fmt.Sprintf("%s:80", port)) + args = append(args, "phpmyadmin/phpmyadmin") + + fmt.Println("Running: docker", strings.Join(args, " ")) + cmd = exec.Command("docker", args...) + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + if err := cmd.Run(); err != nil { + fmt.Println("Error starting phpMyAdmin:", err) + } else { + fmt.Printf("\n✅ phpMyAdmin started! Access it at http://localhost:%s\n", port) + fmt.Printf("📋 Cloud database connection:\n") + fmt.Printf(" Host: %s:%s\n", config.Host, config.Port) + fmt.Printf(" User: %s\n", config.Username) + fmt.Printf(" SSL: %v\n", config.EnableSSL) + } +} + +// getCloudConnectionConfig collects cloud database connection parameters from user +func getCloudConnectionConfig() CloudDBConfig { + fmt.Println("\n🌐 Cloud Database Configuration") + + host := AskForInput("Enter database host (e.g., learn-mysql-db.mysql.database.azure.com)", "") + port := AskForInput("Enter database port", "3306") + username := AskForInput("Enter database username", "") + password := AskForInput("Enter database password", "") + database := AskForInput("Enter database name (optional, leave empty for none)", "") + + enableSSL := Docker.AskYesNo("Enable SSL connection?") + + return CloudDBConfig{ + Host: strings.TrimSpace(host), + Port: strings.TrimSpace(port), + Username: strings.TrimSpace(username), + Password: strings.TrimSpace(password), + Database: strings.TrimSpace(database), + EnableSSL: enableSSL, + } +}