Start existing project with docker helper which wasn't created using docker helper

Hello, I need a some support here…,
Firstly, when I was exploring docker helper v4.x I was able to install it and create a new project with it.
But every time i run ./cht-docker-compose.sh command, I only will be able to start a new project or an existing cht-project that i created by using docker-helper, so my question is what if I have an existing project that I didn’t create by using docker helper just followed local setup or
I have a project that is already in production but it wasn’t created using docker helper and now I want to run it locally using docker helper, what are the steps?

Secondly, after creating a new project (e.g cht_dev_app), cht_dev_app.env is created, which can be used to start,stop and even destroy that project.
And also there other files that are created in ~/medic/cht-docker/files in my home directory e.g:

smhuli@HPx:~/.medic/cht-docker/cht_dev_app-dir$ ls
compose  couch  upgrade-service.yml

How do I get access to the source code and configure the app? Like this:

Because all I see is cht_dev_app.env file and ~/.medic/cht-docker/cht_dev_app-dir folder which contains compose, couch and upgrade-service.yml files

Lastly, when starting a new project the environment variables are always the same, How do I update them when creating that new project?

smhuli@HPx:~/Documents/CHT-Projects$ ./cht-docker-compose.sh 

Would you like to initialize a new project [y/N]? y

Do you want to run the latest CHT Core version (4.5.1) [Y/n]? y

How do you want to name the project? test_100
./cht-docker-compose.sh: line 24: [: CHT_COMPOSE_PROJECT_NAME=app-devl COUCHDB_SECRET=foo DOCKER_CONFIG_PATH=${PWD} COUCHDB_DATA=${PWD}/couchd CHT_COMPOSE_PATH=${PWD} COUCHDB_USER=medic COUCHDB_PASSWORD=password : integer expression expected
./cht-docker-compose.sh: line 29: [: CHT_COMPOSE_PROJECT_NAME=app-devl COUCHDB_SECRET=foo DOCKER_CONFIG_PATH=${PWD} COUCHDB_DATA=${PWD}/couchd CHT_COMPOSE_PATH=${PWD} COUCHDB_USER=medic COUCHDB_PASSWORD=password : integer expression expected


1 Like

what if I have an existing project that I didn’t create by using docker helper just followed local setup or I have a project that is already in production but it wasn’t created using docker helper and now I want to run it locally using docker helper, what are the steps?

This is not a supported feature of Docker Helper. That said, what you’re effectively talking about is backing up one CHT instance and restoring it to another. This could be done by following our backup docs which, in turn, reference CouchDB docs.

Otherwise, Docker Helper does not do anything special behind calling docker compose - it’s perfectly acceptable and safe to keep these preexisting instances where they are!

Secondly, after creating a new project (e.g cht_dev_app), cht_dev_app.env is created ---- [SNIP] ---- How do I get access to the source code and configure the app?

This is done via the CHT Conf utility (cht at the command line). You can read more about this here, but after installing cht via npm, the basic steps would be:

  1. deploy a docker helper instance, get a login, password and URL:
     https://192-168-0-118.local-ip.medicmobile.org:10445/ (CHT)
     Login: medic
     Password: password
    
  2. have an app config directory locally, for example this one. cd into that directory: cd ./cht-core/config/default
  3. push your config with the cht command, specifying URL, login and password:
    cht --url=https://medic:password@192-168-68-26.local-ip.medicmobile.org:10469
    

Note that this command will take the longest. If you working on a specific form (eg pregnancy.xlsx - you can specify to convert and upload JUST that form which will save a lot of time:

cht --url=https://medic:password@192-168-68-26.local-ip.medicmobile.org:10469 convert-contact-forms upload-contact-forms -- pregnancy

Lastly, when starting a new project the environment variables are always the same, How do I update them when creating that new project?

Can you specify which environment variables you would like to update? Also, can you let me know what you hope to achieve by editing the variables?

If you’re talking about docker compose variables in the .env file, they’re in ./cht-core/scriopt/docker-helper-4.x/*.env. However, for the most part you should not edit these unless you have good reason.

2 Likes

Thank you @mrjones , through your explanation and the references you provided now I have a clear picture of how it works!.