-
Notifications
You must be signed in to change notification settings - Fork 1
add: firebird #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,5 +57,25 @@ | |
| - ${VOL_NAME}:/data/db | ||
| """ | ||
|
|
||
| AGENT_FIREBIRD_SNIPPET = """ | ||
| ${SERVICE_NAME}: | ||
| container_name: ${PROJECT_NAME}-${SERVICE_NAME} | ||
| image: firebirdsql/firebird | ||
| restart: always | ||
| networks: | ||
| - portabase | ||
| - default | ||
| ports: | ||
| - "${PORT}:3050" | ||
| volumes: | ||
| - ${VOL_NAME}:/var/lib/firebird/data | ||
| environment: | ||
| - FIREBIRD_DATABASE=${DB_NAME} | ||
| - FIREBIRD_USER=${USER} | ||
| - FIREBIRD_PASSWORD=${PASSWORD} | ||
| - FIREBIRD_ROOT_PASSWORD=${PASSWORD} | ||
|
Comment on lines
+73
to
+76
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # First, locate and examine templates/compose.py
find . -name "compose.py" -type f | head -20Repository: Portabase/cli Length of output: 79 🏁 Script executed: # Search for files containing FIREBIRD configuration
rg -l "FIREBIRD" --type py | head -20Repository: Portabase/cli Length of output: 110 🏁 Script executed: # Read templates/compose.py to verify the code and context
cat -n templates/compose.py | head -100Repository: Portabase/cli Length of output: 2535 🏁 Script executed: # Check for FIREBIRD_ROOT_PASSWORD usage in the codebase
rg "FIREBIRD_ROOT_PASSWORD" --type py -B 2 -A 2Repository: Portabase/cli Length of output: 323 🏁 Script executed: # Check for ROOT_PASSWORD usage more broadly
rg "ROOT_PASSWORD" --type pyRepository: Portabase/cli Length of output: 248 🏁 Script executed: # Check for PASSWORD variable handling and rendering
rg "PASSWORD" templates/compose.py -B 2 -A 2Repository: Portabase/cli Length of output: 726 🏁 Script executed: # Check how PASSWORD is generated and used in the renderer/agent code
rg "PASSWORD" commands/ --type py -B 3 -A 3Repository: Portabase/cli Length of output: 4679 🏁 Script executed: # Look for where these variables are rendered/substituted
rg "\$\{PASSWORD\}" --type py -B 2 -A 2Repository: Portabase/cli Length of output: 39 🏁 Script executed: # Check if there's any code that parses or handles the PASSWORD variable
rg "render\|substitute\|PASSWORD" commands/ --type py | head -30Repository: Portabase/cli Length of output: 39 🏁 Script executed: # Check if ROOT_PASSWORD is already supported in the rendering logic
rg "ROOT_PASSWORD\|root_pass\|ROOT_PASS" commands/db.py commands/agent.py --type py -B 2 -A 2Repository: Portabase/cli Length of output: 39 🏁 Script executed: # Check for any environment variable generation or secret handling
rg "secrets\|generate\|token" commands/db.py --type py | head -20Repository: Portabase/cli Length of output: 39 🏁 Script executed: # Look at the full context of the replace logic in commands/db.py for Firebird
sed -n '1,150p' commands/db.py | tail -100Repository: Portabase/cli Length of output: 3279 🏁 Script executed: # Search for the Firebird-specific handling in db.py
rg "firebird" commands/db.py -i -B 5 -A 10Repository: Portabase/cli Length of output: 3457 🏁 Script executed: # Look at commands/db.py to see the full Firebird handling
cat -n commands/db.py | grep -A 30 "firebird"Repository: Portabase/cli Length of output: 5051 🏁 Script executed: # Let me check if there's any mention of separate root password handling elsewhere in the codebase
rg "root_pass\|root-pass\|ROOT_PASS" --type py -iRepository: Portabase/cli Length of output: 39 🏁 Script executed: # Check the agent.py for similar Firebird handling
rg "firebird" commands/agent.py -i -B 5 -A 10Repository: Portabase/cli Length of output: 4529 Use a separate Firebird root password.
This requires two changes:
Template change needed - FIREBIRD_DATABASE=${DB_NAME}
- FIREBIRD_USER=${USER}
- FIREBIRD_PASSWORD=${PASSWORD}
- - FIREBIRD_ROOT_PASSWORD=${PASSWORD}
+ - FIREBIRD_ROOT_PASSWORD=${ROOT_PASSWORD}
- FIREBIRD_DATABASE_DEFAULT_CHARSET=UTF8🤖 Prompt for AI Agents |
||
| - FIREBIRD_DATABASE_DEFAULT_CHARSET=UTF8 | ||
| """ | ||
|
|
||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: Portabase/cli
Length of output: 2123
🏁 Script executed:
Repository: Portabase/cli
Length of output: 8829
🏁 Script executed:
Repository: Portabase/cli
Length of output: 9545
🏁 Script executed:
Repository: Portabase/cli
Length of output: 110
🌐 Web query:
Firebird Docker official database location and path requirements💡 Result:
The official Firebird Docker image (firebirdsql/firebird) uses /var/lib/firebird/data as the default location for database files. This directory is declared as a VOLUME in the image, making it the recommended mount point for persistent data storage. Key details: - Databases created via the FIREBIRD_DATABASE environment variable are stored by default in /var/lib/firebird/data (e.g., /var/lib/firebird/data/mirror.fdb). - Absolute paths outside this directory are allowed for databases. - Usage example: docker run -v ./host/data:/var/lib/firebird/data firebirdsql/firebird - To persist data, always mount a host directory or Docker volume to /var/lib/firebird/data to avoid data loss on container restart/removal. - Firebird configuration files like databases.conf can be mounted separately at /opt/firebird/databases.conf if needed for aliases. This is confirmed across official sources including the GitHub repo, Docker Hub page, and FirebirdSQL.org announcement recognizing these as official images (updated as recently as 3 months ago).
Citations:
🌐 Web query:
Firebird TCP/IP connection string database path requirements💡 Result:
For Firebird TCP/IP connections, the connection string format is: [hostname/IP]:[port]:database_identifier, where database_identifier is either a database alias (defined in aliases.conf on the server) or the absolute path to the database file on the server machine. Key requirements for the database path: - Must be the absolute path as it exists on the server's filesystem. - Use forward slashes (/) for paths on both Windows and Linux servers; backslashes () are supported on Windows but forward slashes are preferred for cross-platform consistency. Backslashes are invalid on POSIX (Linux) servers. - Examples: - Linux server: serverhost:/opt/firebird/databases/employee.fdb or serverhost:employee (alias) - Windows server: serverhost:c:/databases/mydatabase.fdb or serverhost:MyAlias - Optional port: serverhost/3051:/path/to/db.fdb (default port 3050) - URL-style (Firebird 3+): inet://serverhost:3051/path/to/db.fdb - Local loopback: localhost:/path/to/db.fdb or inet://localhost/path/to/db.fdb The path is interpreted by the server, so use server-native format. Aliases are recommended over full paths for security and portability. This applies to current versions including Firebird 5 (latest stable as of 2024 docs). No Firebird 6 released yet.
Citations:
Use a unique filename and store the full server-side path for Firebird database connectivity.
The current code hardcodes
db_name = "mirror.fdb"and stores it as"database": db_namein the database config. This causes two problems:TCP connections fail: The "database" field stores only the filename, but Firebird TCP/IP connections require the server-side absolute path (e.g.,
/var/lib/firebird/data/mirror.fdb), not just a filename. Clients connecting to the container over the network need this full path.Duplicate names: All generated Firebird instances share the identical name
mirror.fdb, making them indistinguishable in database listings and removal operations.The container's volume is already correctly mounted at
/var/lib/firebird/datain the Docker template, but the stored connection metadata doesn't reflect this.🐛 Proposed fix
elif db_engine == "firebird": fb_port = get_free_port() db_user = "alice" db_pass = secrets.token_hex(8) - db_name = "mirror.fdb" + db_file = f"fb_{secrets.token_hex(4)}.fdb" + db_path = f"/var/lib/firebird/data/{db_file}" service_name = f"db-firebird-{secrets.token_hex(2)}" var_prefix = service_name.upper().replace("-", "_") env_vars[f"{var_prefix}_PORT"] = str(fb_port) - env_vars[f"{var_prefix}_DB"] = db_name + env_vars[f"{var_prefix}_DB"] = db_file env_vars[f"{var_prefix}_USER"] = db_user env_vars[f"{var_prefix}_PASS"] = db_pass @@ path, { - "name": db_name, - "database": db_name, + "name": db_file, + "database": db_path, "type": "firebird", "username": db_user, "password": db_pass,🤖 Prompt for AI Agents