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

Unable to create CHT docker helper instance of older version #9676

Closed
sugat009 opened this issue Nov 29, 2024 · 2 comments
Closed

Unable to create CHT docker helper instance of older version #9676

sugat009 opened this issue Nov 29, 2024 · 2 comments
Labels
Type: Bug Fix something that isn't working as intended

Comments

@sugat009
Copy link
Member

Describe the bug
I am unable to create a docked helper instance with an older version of CHT. The latest version of CHT at the time of reporting this bug is 4.15.0 which is the only version that gets chosen to be created even though I specify the exact version of CHT.

To Reproduce
Steps to reproduce the behavior:

  1. Download cht-docker-helper.sh instance using:
curl -s -o cht-docker-compose.sh https://raw.githubusercontent.com/medic/cht-core/master/scripts/docker-helper-4.x/cht-docker-compose.sh
  1. Run the shell script
  2. When the script asks you if you want to run the latest version then input n
  3. Choose any version other than 4.15.0
  4. After the creation of the docker containers check the containers version using docker ps or through the web UI in the upgrades section from the panel.

Expected behavior
I should be able to create docker helper instances with older CHT versions.

Logs

❯ ./cht-docker-compose.sh                                                                                                                                                                       ─╯

Would you like to initialize a new project [y/N]?y
grep: warning: stray \ before :
grep: warning: stray \ before :

Do you want to run the latest CHT Core version (4.15.0) [Y/n]? n
grep: warning: stray \ before :
grep: warning: stray \ before :

Which version to you want to run? (ctrl + c to quit)
 1) 128-move-navbar-to-bottom						      93) 9327-spacing-aligments-feedback
 2) 130-top-bar								      94) 9327-tab-nav-aligment
 3) 159-e2e-tests-move-navbar-to-botton-mobile				      95) 9327-tab-nav-feedback
 4) 160-e2e-tests-top-bar						      96) 9327-update-nav
 5) 160-e2e-tests-top-bar-take-3					      97) 9327-upgrade
 6) 161-e2e-tests-display-tab-nav-on-left-side-desktop			      98) 9383-clean-up-scripts-dependencies
 7) 162-e2e-test-new-nav-sidebar-menu					      99) 9389-fix-person-type-param
 8) 163-re-enable-skipped-tests						     100) 9395-move-dependency
 9) 163-reenable-upgrade-tests						     101) 9397-prototype-for-documenting-ui-state-contacts-page-list-view-access
10) 163-tati-test							     102) 9398-clean-up-config-dependencies
11) 179-update-docs-for-apdex-testing					     103) 9406-disable-unsupported-language
12) 182-hamburger-icon							     104) 9416-inline-pupil
13) 4.0.0								     105) 9425-create-contact
14) 4.0.1								     106) 9428-db-monitoring-data
15) 4.1.0								     107) 9429-all-reports-in-contact-summary
16) 4.10.0								     108) 9431-always-aggregate
17) 4.1.0-FR-supervisor-chw-create-beta.1				     109) 9431-for-4.13.x
18) 4.1.0-FR-supervisor-chw-create-beta.4				     110) 9433-fix-users-contact-update
19) 4.1.1								     111) 9443-offline-user-e2e-test-coverage-for-tasks
20) 4.11.0								     112) 9446-haporxy-test
21) 4.11.x								     113) 9467-update-rapidpro
22) 4.11.x-500-reports-to-contact-summary				     114) 9471-ui-nav-image-test-contact-user-management
23) 4.11.x-9394-targets							     115) 9471-ui-nav-visual-test-contact-user-management
24) 4.1.2								     116) 9475-update-version
25) 4.12.0								     117) 9489-offline-search-telemetry
26) 4.12.0-FR-freetext-lite						     118) 9514-close-sidebar
27) 4.12.0-FR-freetext-lite-jkuester					     119) 9516-e2e-training-cards
28) 4.13.0								     120) 9519-update-version
29) 4.13.0-beta.3							     121) 9527-fix-privacy-policy-error
30) 4.13.0-beta.4							     122) 9543-flaky-e2e-test-incorrect-locale
31) 4.13.x								     123) 9544-offline-freetext
32) 4.14.0								     124) 9551-update-rules-engine-telemetry
33) 4.14.0-beta.1							     125) 9552-backport-4.13
34) 4.14.0-beta.2							     126) 9552-for-4.13.x
35) 4.14.x								     127) 9552-interval-turnover
36) 4.15.0								     128) 9552-missing-aggregate
37) 4.15.0-beta.1							     129) 9561-fix-cht-form-logs
38) 4.2.0								     130) 9571-update-version
39) 4.2.1								     131) 9577-clean-up-and-organize-page-object-files
40) 4.2.2								     132) 9585-sentinel-start-stop
41) 4.2.3								     133) 9586-implement-freetext-search-in-cht-datasource
42) 4.2.4								     134) 9594-remaining-e2e-test-for-tasks
43) 4.3.0								     135) 9604-fix-integer-validation
44) 4.3.1								     136) 9604-fix-integer-validation-4.14.x
45) 4.3.2								     137) 9612-dont-debouce-twice
46) 4.4.0								     138) 9612-force-tasks-loading
47) 4.4.1								     139) 9614-bump-helmchart
48) 4.4.1-FR-barcode-beta.1						     140) 9618-api-should-start-wiht-broken-forms
49) 4.4.1-FR-enketo-7-beta.1						     141) 9622-fix-flaky-telemetry-test
50) 4.4.1-FR-enketo-7-beta.2						     142) 9624-cleanup-api-build
51) 4.4.1-FR-enketo-7-with-async-compute-beta.1				     143) 9636-node-22
52) 4.4.1-FR-enketo-7-with-async-compute-beta.2				     144) 9642-purging-without-changes-2
53) 4.4.2								     145) add-funding-json-doc
54) 4.5.0								     146) all-view-updates
55) 4.5.1								     147) apdex-automation-tests
56) 4.5.2								     148) bump-up-version
57) 4.6.0								     149) bump-version-4-11
58) 4.6.0-alpha.1							     150) check-ci-status
59) 4.7.1								     151) cht-deploy-publish
60) 4.7.2								     152) cht-deploy-troubleshooting-and-helm-chart-update
61) 4.8.0								     153) datasource-bind
62) 4.8.1								     154) dependabot-npm-and-yarn-compression-1.7.5
63) 4.9.0								     155) dependabot-npm-and-yarn-elliptic-6.6.0
64) 7375-service-worker-auto-update					     156) docker-helper-curl-tls-move
65) 8119-training-card							     157) e2e-send-message-refactor
66) 8181-remove-old-design						     158) e2e-test-old-nav
67) 8216-propagate-req-uuid-to-haproxy					     159) e2e-test-old-nav-mobile
68) 8225-update-relevant-patch						     160) e2e-training-cards-mobile
69) 8437-useUnknownInCatchVariables					     161) extend-content-full-width
70) 8664-bug-fix							     162) feature-flag-hide-old-nav
71) 8664-fix								     163) fix-display-wide-screens
72) 8698-clean-up-and-organize-about-admin-analytics-folder		     164) fix-training-cards-title
73) 8700-clean-up-and-organize-folders					     165) garethbowen-patch-2
74) 8704-clean-up-and-organize-reports-folder				     166) long-content-training-cards
75) 8705-clean-up-and-organize-folders					     167) master
76) 8781-helper3x-new-compose						     168) move-nav-feedback
77) 8806-combining-validation-rules					     169) ne-translations-201-800
78) 8947-outbound-push-cron-config-bug					     170) new-nav-sidebar-menu
79) 9169-integration-testing						     171) remove-compose-version-string-9476
80) 9193-api-endpoints-for-getting-contacts-by-type			     172) remove-obsolete-package-lock
81) 9269-last-three-months-targets					     173) revert-9494
82) 9286-dont-timeout							     174) tati-test
83) 9291-align-icon							     175) tati-test-adding-ugly-if
84) 9293-research-freetext-views					     176) test-fetch-local-ip-certs
85) 9293-research-freetext-views-jkuester				     177) training-cards-once-a-day
86) 9293-research-freetext-views-jkuester-type				     178) training-page
87) 9293-test-report-query-params					     179) update-e2e-sync
88) 9303-upgrade-to-couchdb-34x						     180) update-release-templates
89) 9327-demo-update-nav						     181) updating-check-list
90) 9327-desktop-tabs-nav						     182) upgrade-angular-in-webapp
91) 9327-snackbar-and-modal						     183) upgrade-tests-after-new-nav-release
92) 9327-snackbar-positioning
#? 4.6.0

How do you want to name the project? upgrade_test_v2

Downloading compose files ...grep: warning: stray \ before :
grep: warning: stray \ before :
 done 

homedir: /home/sugat009/.medic/cht-docker/upgrade_test_v2-dir
[+] Running 2/2
 ✔ Network upgrade_test_v2-cht-net                      Created                                                                                                                               0.1s 
 ✔ Container upgrade_test_v2-dir-cht-upgrade-service-1  Started                                                                                                                               0.5s 
Starting project "upgrade_test_v2". First run takes a while. Will try for up to five minutes.......


 -------------------------------------------------------- 

  Success! "upgrade_test_v2" is set up:

    https://192-168-110-248.local-ip.medicmobile.org:10445/ (CHT)
    https://192-168-110-248.local-ip.medicmobile.org:10445/_utils/ (Fauxton)

    Login: medic
    Password: password

 -------------------------------------------------------- 

Start existing project
    ./cht-docker-compose.sh ENV-FILE.env

Stop and keep project:
    ./cht-docker-compose.sh ENV-FILE.env stop

Stop and destroy all project data:
    ./cht-docker-compose.sh ENV-FILE.env destroy

https://docs.communityhealthtoolkit.org/hosting/4.x/app-developer/


 Have a great day! 

❯ docker ps                                                                                                                                                                                     ─╯
CONTAINER ID   IMAGE                                                 COMMAND                   CREATED          STATUS          PORTS                                                                                    NAMES
b76753cfa001   public.ecr.aws/medic/cht-nginx:4.15.0                 "/docker-entrypoint.…"    13 seconds ago   Up 11 seconds   0.0.0.0:10082->80/tcp, [::]:10082->80/tcp, 0.0.0.0:10445->443/tcp, [::]:10445->443/tcp   upgrade_test_v2-nginx-1
ee91ab56755b   public.ecr.aws/medic/cht-sentinel:4.15.0              "/bin/bash /service/…"    13 seconds ago   Up 12 seconds                                                                                            upgrade_test_v2-sentinel-1
17f615792ec5   public.ecr.aws/medic/cht-api:4.15.0                   "/bin/bash /service/…"    13 seconds ago   Up 12 seconds   5988/tcp                                                                                 upgrade_test_v2-api-1
dfc93b236c3d   public.ecr.aws/medic/cht-haproxy:4.15.0               "/entrypoint.sh"          13 seconds ago   Up 13 seconds   5984/tcp                                                                                 upgrade_test_v2-haproxy-1
53e4e58d105b   public.ecr.aws/medic/cht-couchdb:4.15.0               "tini -- /docker-ent…"    13 seconds ago   Up 13 seconds   4369/tcp, 5984/tcp, 9100/tcp                                                             upgrade_test_v2-couchdb-1
c349670f821f   public.ecr.aws/medic/cht-haproxy-healthcheck:4.15.0   "/bin/sh -c \"/app/ch…"   13 seconds ago   Up 13 seconds                                                                                            upgrade_test_v2-healthcheck-1
4e5098bad7a4   public.ecr.aws/s5s3h4s7/cht-upgrade-service:latest    "node /app/src/index…"    14 seconds ago   Up 14 seconds                                                                                            upgrade_test_v2-dir-cht-upgrade-service-1

Screenshots
Image

Environment

  • Instance: Local
  • Browser: Firefox
  • Client platform: Linux
  • App: CHT docker helper
  • Version: N/A

Additional context

@sugat009 sugat009 added the Type: Bug Fix something that isn't working as intended label Nov 29, 2024
@mrjones-plip
Copy link
Contributor

The issue is that we don't properly check the user input on the prompt for which version you want to run. The request is for a number, not a version string. So for example, if you want to run version 4.6.0, you should enter 57:

Which version to you want to run? (ctrl + c to quit)

53) 4.4.2								     145) add-funding-json-doc
54) 4.5.0								     146) all-view-updates
55) 4.5.1								     147) apdex-automation-tests
56) 4.5.2								     148) bump-up-version
57) 4.6.0								     149) bump-version-4-11
58) 4.6.0-alpha.1							     150) check-ci-status
59) 4.7.1								     151) cht-deploy-publish

#? 4.6.0

I just tested and confirmed I can install a version of 4.6.0 by entering 57 when prompted. FYI - these numbers change as more versions are added and old branches are removed.

A good fix would be to have the bash script not allow the user to proceed until they enter a valid choice. Right now we're failing open and choosing latest instead of showing an error when they enter a string.

@sugat009
Copy link
Member Author

sugat009 commented Dec 3, 2024

ooof, thanks @mrjones-plip . I was able to run 4.6.0 using the version indexes on the left.
Additionally, let's change the prompt message a bit to something like:

Which version do you want to run? (Please enter the index number from the list on the left, not the actual value)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Fix something that isn't working as intended
Projects
None yet
Development

No branches or pull requests

2 participants