Config Git Secret for MageAI

149 Views Asked by At

I'm currently follow this course on youtube about a data engineering project: https://www.youtube.com/watch?v=WpQECq5Hx9g&t=505s&ab_channel=DarshilParmar

On the Google Clould VM, I already installed MageAI, but couldn't start the project:

(myvenv) cuongnguyen3900@instance-20240216-113340:~$ mage start uber-de-project
WARNING:traitlets:Message signing is disabled.  This is insecure and not recommended!
WARNING:traitlets:Message signing is disabled.  This is insecure and not recommended!
INFO:mage_ai.server.scheduler_manager:Start scheduler.
INFO:mage_ai.server.active_kernel:Switch active kernel: KernelName.PYTHON3
INFO:alembic.runtime.migration:Context impl SQLiteImpl.
INFO:alembic.runtime.migration:Will assume non-transactional DDL.
INFO:mage_ai.orchestration.pipeline_scheduler_original:Active pipeline runs: []
0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
Checking port 6789...
INFO:mage_ai.server.server:Mage is running at http://localhost:6789 and serving project /home/cuongnguyen3900/uber-de-project
WARNING: Could not find secret value for secret mage_git_ssh_public_key_b64.
WARNING: Could not find secret value for secret mage_git_ssh_private_key_b64.
ERROR:mage_ai.server.server:Failed to set up git repo
Traceback (most recent call last):
  File "/home/cuongnguyen3900/myvenv/lib/python3.11/site-packages/mage_ai/server/server.py", line 550, in main
    sync = GitSync(sync_config, setup_repo=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cuongnguyen3900/myvenv/lib/python3.11/site-packages/mage_ai/data_preparation/sync/git_sync.py", line 32, in __init__
    self.git_manager = Git(git_config=sync_config, setup_repo=setup_repo)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cuongnguyen3900/myvenv/lib/python3.11/site-packages/mage_ai/data_preparation/git/__init__.py", line 81, in __init__
    self.__create_ssh_keys(overwrite=True)
  File "/home/cuongnguyen3900/myvenv/lib/python3.11/site-packages/mage_ai/data_preparation/git/__init__.py", line 754, in __create_ssh_keys
    if not url.startswith('ssh://'):
           ^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'startswith'
INFO:mage_ai.server.server:Initializing block cache.
INFO:mage_ai.server.server:Initializing pipeline cache.
INFO:mage_ai.server.server:Initializing tag cache.
INFO:mage_ai.server.server:Initializing block action object cache.
[WARNING] SSH tunnel failed to create and connect: No module named 'sshtunnel'
0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.

I already tried generating a new ssh key pair, and could echo them like this:

echo $mage_git_ssh_public_key_b64
echo $mage_git_ssh_private_key_b64

but I still encounter the same error as posted above.

Could you please help?

2

There are 2 best solutions below

2
KrepaFR On

Ok I have the solution brother! I was facing the same issue when deploying in GCP.

I was sad it doesnt work in GCP so I deployed it locally. And what I noticed is that we get the same error message you posted but the app is working !

So I thought it must be something else that is causing the app to not work. And when deployed on ComputeEngine in GCP, I compared all the WARNING and ERRORS messages. The only error message that was different from the local deployment is

INFO:tornado.general:Malformed HTTP message from 92.XX.XX.XX: no colon in header line.

I checked online and this has to do with https://"ip":"port" only. When I tried http://"ip":"port" it works now (the ip is the public IP of your ComputeEngine app and the port should be 6789 for mageai)

I am not sure of the reason why https doesnt work and http works. Have a nice day :D

0
Sakin Deborah On

I also had the same error, solved it by configuring a firewall rule in the instance to allow my ip to access it and tcp protocol for port 6789 for the mage.ai tool. This should fix it and you'll be able to access the ui using the public ip of your instance:6789