-
Notifications
You must be signed in to change notification settings - Fork 46
feat(pgadmin): add new module for pgAdmin #228
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
base: main
Are you sure you want to change the base?
Conversation
I went to test this module. It was having issues with installation, and the app was not being proxied. I forked the registry and made a branch to see if I can understand what is going wrong here. The main things that I changed on my side to get this working, was I introduced a variable for the pgadmin config, introduced locals to do joins and formatting, and I utilized the venv for pgadmin. I then added a step to write the configuration to a file so that pgadmin loads with the ideal settings for coder. Here is the fork if you would like to take a look. https://github.com/DevelopmentCats/registry/tree/cat/AJ0070-pgadmin-fix/registry/AJ0070 |
Thanks for the details! |
Thank you so much for taking the time to test the module and provide such detailed feedback. I really appreciate you forking the repository and creating a working example it was incredibly helpful for understanding the issues with installation and proxying. Please let me know @DevelopmentCats if that's okay with you. Thanks again for your help! |
No worries. That's totally fine with me. I'm happy to provide in whatever way I can. Sorry I couldn't point out the exact issues right out of the gate. I had never really worked with pgadmin-web before now and it took me a minute to get it myself lol. |
Thanks for the confirmation! |
I've implemented the changes. Let me know if there's anything else you'd like adjusted. |
@AJ0070, please link a video demo of the module wokring in a Coder workspace. Thanks, |
I'll do that right after I fix the workflow failure. |
pg-admin-test.mp4 |
@DevelopmentCats, could you please review the recent changes when you have a moment? |
Hey @AJ0070. that video doesn't show pgadmin with coder. the agent doesn't start and there is no pgadmin button in the dashboard |
Now pgAdmin icon is visible: ![]() but I am not sure why the connection is refusing:
@DevelopmentCats Did you encounter anything like this during your local testing? Let me know if you have any suggestions for resolving it. |
Even in my version, it still took forever to build. PGAdmin seems to be pretty heavy overall, and I doubt there is much to be done to speed the install up. In my testing though I was able to get pgadmin installed, and available over the coder app button. |
Were you able to open it? |
It was not loading up when I pulled and tested it last, but let me build and test again. Maybe I can provide you some valuable output |
Thanks so much for looking into this. Once you share your output, I’ll be able to figure out whether the issue is with my local setup or something in the code. |
@DevelopmentCats, have you had a chance to test this? Your feedback would be greatly appreciated. |
Sorry about the delay on this. I will build this in my template tonight and will provide you with the logs for the module so we can get this buttoned up |
@DevelopmentCats, just following up—any update? |
Checking now, sorry for the delay |
It seems to be loading fine for me when I just pulled it. @AJ0070 Can you upload the icon for this and pull the svg for pgadmin instead of postgres like its referencing right now. Make sure to also make a PR in coder/coder to upload the icon in site/static/icons so that it shows up properly in coder. Also there is a typo in your avatar image please fix that. Lastly I notice that you have changes in here for the filebrowser module. Please remove that. I will review this after you take care of those things |
@DevelopmentCats added logo on coder: coder/coder#19210 |
@DevelopmentCats Ready for review |
I would use this logo instead. but the file name and upload looks good to me. Please make sure you sign the CLA on coder/coder#19210 |
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.
Pull Request Overview
This PR introduces a new Coder module for pgAdmin, allowing users to easily deploy a web-based PostgreSQL database management interface in their workspaces. The module provides automated installation, configuration, and startup of pgAdmin 4 with customizable settings.
Key changes:
- New pgAdmin module under the
AJ0070
namespace with complete implementation - Automated pgAdmin installation and configuration through shell scripts and Terraform
- Configurable deployment options including subdomain support and custom configuration
Reviewed Changes
Copilot reviewed 5 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
registry/AJ0070/modules/pgadmin/main.tf | Terraform configuration defining Coder app and script resources with pgAdmin setup |
registry/AJ0070/modules/pgadmin/run.sh | Shell script handling pgAdmin installation, virtual environment setup, and service startup |
registry/AJ0070/modules/pgadmin/main.test.ts | Basic test file ensuring the module loads correctly with required variables |
registry/AJ0070/modules/pgadmin/README.md | Documentation with usage instructions and module metadata |
registry/AJ0070/README.md | Author profile information for the AJ0070 namespace |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
printf "Creating Python virtual environment for pgAdmin...\n" | ||
if ! python3 -m venv "$PGADMIN_VENV_DIR"; then | ||
echo "⚠️ Warning: Failed to create virtual environment" | ||
exit 0 |
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.
The error message should be more descriptive and actionable. Consider including the specific error or suggesting potential solutions like checking Python installation or permissions.
exit 0 | |
if ! python3 -m venv "$PGADMIN_VENV_DIR" 2>venv_error.log; then | |
echo "⚠️ Warning: Failed to create virtual environment at $PGADMIN_VENV_DIR" | |
echo "Error details:" | |
cat venv_error.log | |
echo "Possible causes:" | |
echo " - Python 3 is not installed or not found in PATH" | |
echo " - The 'venv' module is missing (try: python3 -m ensurepip --upgrade)" | |
echo " - Insufficient permissions to write to $PGADMIN_VENV_DIR" | |
echo " - Not enough disk space" | |
echo "Please check the above error and try again." | |
rm -f venv_error.log | |
exit 1 |
Copilot uses AI. Check for mistakes.
|
||
printf "Installing pgAdmin 4 in virtual environment...\n" | ||
if ! "$PGADMIN_VENV_DIR/bin/pip" install pgadmin4; then | ||
echo "⚠️ Warning: Failed to install pgAdmin4" |
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.
The error message should be more descriptive and actionable. Consider including information about potential causes like network issues, Python version compatibility, or suggesting to check pip installation.
echo "⚠️ Warning: Failed to install pgAdmin4" | |
echo "⚠️ Warning: Failed to install pgAdmin4. This may be due to network issues, Python version incompatibility, or a missing pip installation in the virtual environment." | |
echo "💡 Please check your internet connection, ensure you are using a supported Python version, and verify that pip is installed in the virtual environment ('$PGADMIN_VENV_DIR/bin/pip')." |
Copilot uses AI. Check for mistakes.
description = "A map of pgAdmin configuration settings." | ||
default = { | ||
DEFAULT_EMAIL = "admin@coder.com" | ||
DEFAULT_PASSWORD = "coderPASSWORD" |
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.
Using a hardcoded default password poses a security risk. Consider using a randomly generated password or requiring users to set their own password through a variable.
Copilot uses AI. Check for mistakes.
MASTER_PASSWORD_REQUIRED = false | ||
LISTEN_ADDRESS = "127.0.0.1" | ||
} | ||
} |
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.
Using 'any' type for the config variable is too permissive and provides no type safety. Consider defining a more specific object type with optional attributes to better validate the configuration structure.
} | |
variable "config" { | |
type = map(any) | |
description = "A map of pgAdmin configuration settings." | |
default = { | |
DEFAULT_EMAIL = "admin@coder.com" | |
DEFAULT_PASSWORD = "coderPASSWORD" | |
SERVER_MODE = false | |
MASTER_PASSWORD_REQUIRED = false | |
LISTEN_ADDRESS = "127.0.0.1" | |
} | |
} |
Copilot uses AI. Check for mistakes.
Closes #36
Description
This pull request introduces a new Coder module for
pgAdmin
. This module allows users to easily add a pgAdmin web interface to their workspaces for managing PostgreSQL databases.pgAdmin
module under theAJ0070
namespace.main.tf
file to define the Coder app and script resources.run.sh
script to handle the installation and launch of pgAdmin.README.md
with usage instructions and prerequisites.main.test.ts
to ensure the module loads correctly.Type of Change
Module Information
Path:
registry/AJ0070/modules/pgadmin
New version:
v1.0.0
Breaking change: [ ] Yes [x] No
Testing & Validation
bun test
)bun run fmt
)/claim #36