Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Checkout opensrp docker builds and navigate to the composed directory.
    Below is the list of build time args

    No Format
    #Build arguments
    ARG opensrp_server_tag
    
    #openmrs settings
    ARG openmrs_url="http:\/\/localhost:8080\/openmrs\/"
    ARG openmrs_username=admin
    ARG openmrs_password=Admin123
    
    #couchdb settings
    ARG couchdb_username
    ARG couchdb_password
    ARG couchdb_opensrp_db=opensrp
    ARG couchdb_form_db=opensrp-form
    ARG couchdb_atomfeed_db=atomfeed
    ARG couchdb_mcts_db=opensrp-mcts
    ARG couchdb_motech_db=motech-scheduletracking-api
    ARG couchdb_error_db=opensrp-errortrace
    #mysql settings
    ARG mysql_opensrp_user
    ARG mysql_opensrp_password
    ARG mysql_opensrp_database
    ARG mysql_openmrs_user
    ARG mysql_openmrs_password
    ARG mysql_openmrs_database
    ARG mysql_motech_database
    ARG mysql_reporting_database
    ARG mysql_anm_database
    ARG mysql_opensrp_jdbc="jdbc:mysql:\/\/mysql:3306\/${mysql_opensrp_database}?createDatabaseIfNotExist=true"
    ARG mysql_opensrp_jdbc_wo="jdbc:mysql:\/\/mysql:3306"
    ARG mysql_motech_jdbc="jdbc:mysql:\/\/mysql:3306\/${mysql_motech_database}"
    
    #redis settings
    ARG redis_password
    
    #postgres settings
    ARG postgres_opensrp_user
    ARG postgres_opensrp_password
    ARG postgres_opensrp_database
    ARG postgres_opensrp_jdbc="jdbc:postgresql:\/\/postgres:5432\/${postgres_opensrp_database}"
    
    ARG demo_data_tag


  2. Create .env file to store variables and credentials. For example, create a file with the following details..

    No Format
    #!/bin/sh
    POSTGRES_OPENSRP_TABLESPACE_DIR=/opt/postgresql
    POSTGRES_OPENSRP_DATABASE=opensrp
    POSTGRES_OPENSRP_USER=opensrp_admin
    POSTGRES_OPENSRP_PASSWORD=admin
    MYSQL_ROOT_PASSWORD=mypassword
    MYSQL_MOTECH_DATABASE=motechquartz
    MYSQL_REPORTING_DATABASE=report
    MYSQL_ANM_DATABASE=anm
    MYSQL_OPENMRS_USER=openmrs
    MYSQL_OPENMRS_PASSWORD=openmrs
    MYSQL_OPENMRS_DATABASE=openmrs
    MYSQL_OPENSRP_USER=opensrp
    MYSQL_OPENSRP_PASSWORD=opensrp
    MYSQL_OPENSRP_DATABASE=opensrp
    COUCHDB_USER=rootuser
    COUCHDB_PASSWORD=adminpass
    REDIS_PASSWORD=reallylongreallylongpassword
    OPENSRP_SERVER_TAG=opensrp_server_tag                                             

    These environment variables are used at runtime and also as build time arguments when building docker images for opensrp-composed and migrations containers.

    Note: You can add an optional DEMO_DATA_TAG environment variable so that the launched  containers contains demo(seed) data for a particular project. The value should be either zeir, tbreach or uganda-hpv. If the environment variable is set  openmrs database, opensrp database and images will be downloaded from S3 bucket. 


    Note: If you want to override a build argument with a default constant expose it in the args section of a service in the docker compose file. To expose a build argument called custom_build_arg that is populated from MY_ARG environment variable, see the below example

    No Format
    migrations:
          build:
            context: .
            dockerfile: ./Dockerfile
            args:
              - custom_build_arg=${MY_ARG}


  3. Run compose up

    No Format
    docker-compose up -d 

    Alternatively if you want to rebuild the containers use

    No Format
    docker-compose up --force-recreate --remove-orphans --build -d


  4. Link couchdb with lucene.
     Go to couchdb container

    No Format
    docker exec -it composed_couchdb_1 bash

    update /usr/local/etc/couchdb/local.ini i.e. append the following lines

    No Format
    nopaneltrue
    [couchdb]
    os_process_timeout=60000 ; increase the timeout from 5 seconds.
    
    [external]
    fti=/usr/bin/python /opt/couchdb-lucene/tools/couchdb-external-hook.py
    
    [httpd_db_handlers]
    _fti = {couch_httpd_external, handle_external_req, <<"fti">>}
    
    [httpd_global_handlers]
    _fti = {couch_httpd_proxy, handle_proxy_req, <<"http:\\couchdb-lucene:5985">>}

    NB: Checkout Cloudant Sync Security Configuration to configure couchdb security.

  5. Test the services

    ServiceLinkCredentials
    OpenSRP http://localhost:9090/opensrp
    OpenMRS http://localhost:90909091/openmrsadmin/Admin123


Some useful commands

...