Skip to content
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

Silent confirmation (-y) for bench install-app command #1560

Open
simwai opened this issue May 23, 2024 · 4 comments
Open

Silent confirmation (-y) for bench install-app command #1560

simwai opened this issue May 23, 2024 · 4 comments

Comments

@simwai
Copy link

simwai commented May 23, 2024

Issue: Feature Request

Is your feature request related to a problem? Please describe.
I'm always frustrated when I try to install ecommerce_integrations in the pwd.yml file of the frappe_docker repo and bench has no option for silent confirmation (-y) when I need to run these steps.

$ bench get-app ecommerce_integrations --branch main
$ bench --site sitename install-app ecommerce_integrations (Here, it is necessary to confirm manually multiple questions sometimes.)

Describe the solution you'd like
A parameter -y to confirm all questions which could appear on the bench install-app command

Describe alternatives you've considered
I tried out about 3 different variants to find a workaround, but gave up in the end.
I tried expect, yes | command and EOF, but it all didn't help me out.

@ankush
Copy link
Member

ankush commented May 23, 2024

Here, it is necessary to confirm manually multiple questions sometimes.

What questions? I can't find any in install_app function call.

If it was interactive https://frappecloud.com won't work too. It just issues simple install-app

https://github.com/frappe/agent/blob/2c926d8062d5867d8874f95e2f228f14974f8f4b/agent/site.py#L90-L93

@simwai
Copy link
Author

simwai commented May 23, 2024

I don't get exactly why you reference to frappecloud. The questions are like if I would like to override current installation.

@simwai
Copy link
Author

simwai commented May 23, 2024

Here you can see how a docker compose -f pwd.yml up fails, because of the question.

[+] Running 11/0
 ✔ Container frappe_docker-redis-cache-1   Running                                                                                              0.0s
 ✔ Container frappe_docker-scheduler-1     Running                                                                                              0.0s
 ✔ Container frappe_docker-redis-queue-1   Running                                                                                              0.0s
 ✔ Container frappe_docker-queue-short-1   Running                                                                                              0.0s
 ✔ Container frappe_docker-queue-long-1    Running                                                                                              0.0s
 ✔ Container frappe_docker-websocket-1     Running                                                                                              0.0s
 ✔ Container frappe_docker-configurator-1  Created                                                                                              0.0s
 ✔ Container frappe_docker-db-1            Running                                                                                              0.0s
 ✔ Container frappe_docker_frontend_1      Recreated                                                                                            0.0s
 ✔ Container frappe_docker_backend_1       Recreated                                                                                            0.0s
 ✔ Container frappe_docker-create-site-1   Created                                                                                              0.0s
Attaching to backend-1, configurator-1, create-site-1, db-1, frontend-1, queue-long-1, queue-short-1, redis-cache-1, redis-queue-1, scheduler-1, websocket-1
create-site-1   | wait-for-it: waiting 120 seconds for db:3306
db-1            | 2024-05-23 15:36:09 348 [Warning] Aborted connection 348 to db: 'unconnected' user: 'unauthenticated' host: '172.26.0.6' (This connection closed normally without authentication)
create-site-1   | wait-for-it: db:3306 is available after 0 seconds
create-site-1   | wait-for-it: waiting 120 seconds for redis-cache:6379
create-site-1   | wait-for-it: redis-cache:6379 is available after 0 seconds
create-site-1   | wait-for-it: waiting 120 seconds for redis-queue:6379
create-site-1   | wait-for-it: redis-queue:6379 is available after 0 seconds
create-site-1   | sites/common_site_config.json found
create-site-1   | Site frontend already exists
create-site-1   | Aborted!
backend-1       | [2024-05-23 15:36:11 +0000] [1] [INFO] Starting gunicorn 22.0.0
backend-1       | [2024-05-23 15:36:11 +0000] [1] [INFO] Listening at: http://0.0.0.0:8000 (1)
backend-1       | [2024-05-23 15:36:11 +0000] [1] [INFO] Using worker: gthread
backend-1       | [2024-05-23 15:36:11 +0000] [6] [INFO] Booting worker with pid: 6
backend-1       | [2024-05-23 15:36:11 +0000] [7] [INFO] Booting worker with pid: 7
create-site-1   | A directory for the application 'ecommerce_integrations' already exists. Do you want to continue and overwrite it? [y/N]: An error occurred while installing ecommerce_integrations: App ecommerce_integrations not in apps.txt
  create-site:
    image: frappe/erpnext:v15.25.0
    deploy:
      restart_policy:
        condition: none
    volumes:
      - sites:/home/frappe/frappe-bench/sites
      - logs:/home/frappe/frappe-bench/logs
    entrypoint:
      - bash
      - -c
    command:
      - >
        wait-for-it -t 120 db:3306;
        wait-for-it -t 120 redis-cache:6379;
        wait-for-it -t 120 redis-queue:6379;
        export start=`date +%s`;
        until [[ -n `grep -hs ^ sites/common_site_config.json | jq -r ".db_host // empty"` ]] && \
          [[ -n `grep -hs ^ sites/common_site_config.json | jq -r ".redis_cache // empty"` ]] && \
          [[ -n `grep -hs ^ sites/common_site_config.json | jq -r ".redis_queue // empty"` ]];
        do
          echo "Waiting for sites/common_site_config.json to be created";
          sleep 5;
          if (( `date +%s`-start > 120 )); then
            echo "could not find sites/common_site_config.json with required keys";
            exit 1
          fi
        done;
        echo "sites/common_site_config.json found";
        bench new-site --no-mariadb-socket --admin-password=admin --db-root-password=admin --install-app erpnext --set-default frontend || true;
        bench get-app ecommerce_integrations --branch main;
        bench --site frontend install-app ecommerce_integrations;

@simwai
Copy link
Author

simwai commented May 24, 2024

Heyo sry, I am not kinda sure if that happened on the install or the get-app command and I also discovered that I would need to add bench --site frontend migrate; command to the pwd.yml file. Would be awesome if this could be mentioned in the custom apps installation guide, because this is at the moment not very intuitive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants