helpers icon indicating copy to clipboard operation
helpers copied to clipboard

Sudo password requested running invoke on Linux locally

Open sonniki opened this issue 9 months ago • 12 comments

As reported by @samarth9008 in https://github.com/causify-ai/helpers/pull/385#pullrequestreview-2695820910:

After setting up our dev env locally on a Linux laptop, any invoke like i docker_bash at some point asks for sudo password:

(client_venv.helpers) sorrentum@samarthkp:~/src/helpers1$ i docker_bash
18:27:03 - INFO  hdbg.py init_logger:1018                               > cmd='/home/sorrentum/src/venv/client_venv.helpers/bin/invoke docker_bash'
# docker_bash: base_image='', stage='dev', version='', use_entrypoint=True, as_user=True, generate_docker_compose_file=True, container_dir_name='.', skip_pull=False
18:27:03 - WARN  hserver.py _raise_invalid_host:342                     Don't recognize host: host_os_name=Linux, am_host_os_name=None
18:27:03 - WARN  hserver.py _raise_invalid_host:342                     Don't recognize host: host_os_name=Linux, am_host_os_name=None
18:27:03 - WARN  hserver.py _raise_invalid_host:342                     Don't recognize host: host_os_name=Linux, am_host_os_name=None
# docker_pull: stage='dev', version=None, skip_pull=False
# docker_login: target_registry='aws_ecr.ck'
18:27:03 - WARN  lib_tasks_docker.py docker_login:402                   Skipping logging in for Kaizenflow
18:27:03 - INFO  lib_tasks_docker.py _docker_pull:230                   image='causify/helpers:dev'
docker pull causify/helpers:dev
dev: Pulling from causify/helpers
Digest: sha256:43ac049013f992d7efc4a8196bfa15dc0b3f7559e52848adf825c3c7b5c84ca3
Status: Image is up to date for causify/helpers:dev
docker.io/causify/helpers:dev
IMAGE=causify/helpers:dev \
        docker compose \
        --file /home/sorrentum/src/helpers1/devops/compose/docker-compose.yml \
        --env-file devops/env/default.env \
        run \
        --rm \
        --name sorrentum.helpers.app.helpers1.20250318_142703 \
        --user $(id -u):$(id -g) \
        app \
        bash 
WARN[0000] The "CSFY_FORCE_TEST_FAIL" variable is not set. Defaulting to a blank string. 
WARN[0000] The "CSFY_AWS_ACCESS_KEY_ID" variable is not set. Defaulting to a blank string. 
WARN[0000] The "CSFY_AWS_DEFAULT_REGION" variable is not set. Defaulting to a blank string. 
WARN[0000] The "CSFY_AWS_SECRET_ACCESS_KEY" variable is not set. Defaulting to a blank string. 
WARN[0000] The "CSFY_AWS_SESSION_TOKEN" variable is not set. Defaulting to a blank string. 
WARN[0000] The "CSFY_TELEGRAM_TOKEN" variable is not set. Defaulting to a blank string. 
WARN[0000] The "OPENAI_API_KEY" variable is not set. Defaulting to a blank string. 
[+] Building 0.0s (0/0)                                                                                                                                                                                    
[+] Building 0.0s (0/0)                                                                                                                                                                                    
##> devops/docker_run/entrypoint.sh
UID=1000
GID=1000
CSFY_USE_HELPERS_AS_NESTED_MODULE=0
CSFY_HOST_GIT_ROOT_PATH=/home/sorrentum/src/helpers1
CSFY_GIT_ROOT_PATH=/app
CSFY_HELPERS_ROOT_PATH=/app
> source /app/dev_scripts_helpers/thin_client/thin_client_utils.sh ...
AM_CONTAINER_VERSION='1.2.0'
CSFY_USE_HELPERS_AS_NESTED_MODULE=0
##> devops/docker_run/docker_setenv.sh
> source /app/dev_scripts_helpers/thin_client/thin_client_utils.sh ...
# activate_docker_venv()
# set_path()
PATH=.:./.git:./config_root:./.mypy_cache:./linters:./import_check:./docs:./.github:./helpers:./papers:./.ipynb_checkpoints:./dev_scripts_helpers:./devops::/app:/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# set_pythonpath()
PYTHONPATH=/app:
# Configure env
WARNING: /var/run/docker.sock doesn't exist
# set_up_docker_git()
git --version: git version 2.43.0
/app
# invoke print_env
14:27:15 - INFO  hdbg.py init_logger:1018                               > cmd='/venv/bin/invoke print_env'
14:27:15 - WARN  hserver.py _raise_invalid_host:342                     Don't recognize host: host_os_name=Linux, am_host_os_name=None
14:27:15 - WARN  hserver.py _raise_invalid_host:342                     Don't recognize host: host_os_name=Linux, am_host_os_name=None
[sudo] password for ubuntu: 

Pressing Ctrl-C resolves the issue and lets the user in the container/starts the jupyter server, etc. This doesn't appear with Linter (i lint) at all.

We want to figure out where this is coming from and disable so that the user isn't prompted for the password at all.

FYI @gpsaggese

sonniki avatar Mar 18 '25 18:03 sonniki

@sardaukar i believe when editing the compose file, new entries are added into the coolify-db if they are missing or changed, but the old ones are not removed.

this leaves you with these 'phantom' entries, for services. these can be deleted in the ui, but databases cannot be deleted this way, you need to do it manually inside the coolify-db til this issue is fixed.

djsisson avatar Mar 15 '25 13:03 djsisson

This will be fixed in the upcoming version.

andrasbacsai avatar Apr 14 '25 10:04 andrasbacsai

Duplicate of #4248?

KaelWD avatar Apr 24 '25 08:04 KaelWD