Versions Compared

Key

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

...

  1. Checkout  opensrp-server and compile opensrp war file i.e. OpenSRP Server Build step 6.
    1. Change MySQL and CouchDB database credentials in opensrp.properties file
    2. Change MySQL credentials in quartz.properties
    3. Change ActiveMQ configuration in activemq.properties if applicable
  2. Checkout opensrp docker builds and navigate to the root folder.
  3. Create a webapps folder and copy the compiled war file to the new directory.

    No Format
    mkdir webapps
    
    cp <opensrp-server>/opensrp-web/target/*.war webapps


  4. Build the container

    No Format
    docker build -t onaio/opensrp .


  5. Run the container

    No Format
    docker run -d --name='opensrp' -e POSTGRES_MAIN_PASSWORD='mainpassword' -e OPENSRP_TABLESPACE_ROOT='/opt/postresql' \ 
    -e POSTGRES_OPENSRP_DATABASE='opensrp' -e POSTGRES_OPENSRP_USER='opensrp_admin' -e POSTGRES_OPENSRP_PASSWORD='admin' \
    -e MYSQL_ROOT_PASSWORD='mypassword' -e MYSQL_MOTECH_DATABASE='motechquartz' \
    -e MYSQL_OPENMRS_USER='openmrs' -e MYSQL_OPENMRS_PASSWORD='openmrs' -e MYSQL_OPENMRS_DATABASE='openmrs' \
    -e COUCHDB_USER='rootuser' -e COUCHDB_PASSWORD='adminpass' \
    -p 5432:5432 -p 3306:3306 -p 5984:5984 -p 5985:5985 -p 8161:8161 -p 61616:61616 -p 9090:8080 onaio/opensrp

    The docker run command given starts a container named 'opensrp' with the following variables and ports

    Variables https://docs.docker.com/engine/reference/run/#/env-environment-variables

    ENVDescription
    POSTGRES_MAIN_PASSWORD
    password for postgres user
    OPENSRP_TABLESPACE_ROOT
    postgres root folder where table spaces will be created 
    POSTGRES_OPENSRP_DATABASE
    opensrp database bame
    POSTGRES_OPENSRP_USER
    opensrp database user name
    POSTGRES_OPENSRP_PASSWORD
    opensrp database password
    MYSQL_ROOT_PASSWORD
    password for mysql root user
    MYSQL_MOTECH_DATABASE
    motech database name
    MYSQL_OPENMRS_USER
    openmrs database user name
    MYSQL_OPENMRS_PASSWORD
    openmrs database password
    MYSQL_OPENMRS_DATABASE
    openmrs database name
    COUCHDB_USER 
    couchdb root/system user name [Optional]
    COUCHDB_PASSWORD 
    couchdb root/system password [Optional]

    Ports https://docs.docker.com/engine/reference/run/#/expose-incoming-ports

    ServiceHost PortContainer Port
    postgresql54325432
    mysql33063306
    couchdb59845984
    couchdb-lucene59855985
    activemq81618161
    activemq6161661616
    tomcat790908080

    NB: Host ports can be changed i.e. if mysql is already installed in port 3306, host port 3306 can be changed to 3307.


  6. Check the logs

    No Format
    docker logs -f opensrp
    

    -f option follows log output.

    No errors/exceptions should be displayed in the logs if the container has started successfully.


  7. Copy opensrp war to the container's webapps folder

    No Format
    docker cp webapps/opensrp.war opensrp:/opt/tomcat/webapps


  8. Test the services

    ServiceLinkCredentials
    OpenSRPhttp://localhost:9090/opensrp
    OpenMRShttp://localhost:9090/openmrsadmin/Admin123
    CouchDBhttp://localhost:5984rootuser/adminpass
    CouchDB Lucenehttp://localhost:5984
    ActiveMQhttp://localhost:8161
    MySQLhttp://localhost:3306root/mypassword


...