• Skip to main content
  • Skip to primary sidebar

Code Inherit

Simple Programming Code Examples

dhis2

Import/Export Db from/to docker container Postgres

26th July 2023 by Site Admin Leave a Comment

How to take Postgres backup from container machine

/usr/bin/docker exec -it burkina-cluster-2363_db_1 pg_dump -h localhost -U dhis dhis2 | gzip> ~/dhis2_burkina_$(date “+%b_%d_%Y_%H_%M_%S”).pgsql.gz

get into container using exec command
docker exec -it burkina-cluster-2363_db_1 /bin/sh

take postgres database backup to current directory

pg_dump -h localhost -U dhis dhis2 | gzip> dhis2_burkina_09_Mar_2023.pgsql.gz
exit

copy postgres backup from container root to host machine
sudo docker cp burkina-cluster-2363_db_1:/dhis2_burkina_09_Mar_2023.pgsql.gz ~
OR
docker cp burkina-cluster-2363_db_1:/dhis2_burkina_09_Mar_2023.pgsql C:\Users\AnwarHossain\Downloads

sudo gzip dhis2_burkina_09_Mar_2023.pgsql

============================================
How to import Postgres backup from container machine

get into container using exec command
docker exec -it burkina-cluster-2363_db_1 /bin/sh

login to postgres dhis2 database
psql -h localhost -p 5432 -U dhis -W dhis2

SELECT ‘drop table if exists “‘ || tablename || ‘” cascade;’
FROM pg_tables
where schemaname = ‘public’;

drop all existing tables using above query output

exit from postgres
\q

copy postgres backup from host machine to container root
docker cp C:\Users\AnwarHossain\Downloads\dhis2_burkina_09_Mar_2023.pgsql burkina-cluster-2363_db_1:/
docker cp ~/dhis2_burkina_09_Mar_2023.pgsql burkina-cluster-2363_db_1:/

get into container using exec command
docker exec -it burkina-cluster-2363_db_1 /bin/sh

importing postgres backup to postgres container from current directory
psql -U dhis dhis2 < dhis2_burkina_09_Mar_2023.pgsql

docker restart burkina-cluster-2363_core_1

=================================================

docker stop $(docker ps -aq) // stop all container
docker container rm $(docker container ls -aq) // remove all containers
docker rmi $(docker images -q) // remove all images
docker volume prune // remove all stopped container volumes
docker network prune // remove all stopped container networks

docker system prune -a
– all stopped containers
– all networks not used by at least one container
– all images without at least one container associated to them
– all build cache

# Stop services only
docker-compose stop
# Stop and remove containers, networks..
docker-compose down
# Down and remove volumes
docker-compose down –volumes
# Down and remove images
docker-compose down –rmi <all|local>

Filed Under: dhis2

How to delete dhis2 Standard Apps from Docker Linux Container

26th July 2023 by Site Admin Leave a Comment

  1. docker exec -it burkina2-2363_core_1 /bin/sh
  2. cd /DHIS2_home/files/apps
  3. ls -l
  4. rm -rf dhis2-Burkina-NetSIGL-2-2.1

Filed Under: dhis2

Install dhis2 in ubuntu docker

8th February 2021 by Site Admin Leave a Comment

https://unix.stackexchange.com/questions/363048/unable-to-locate-package-docker-ce-on-a-64bit-ubuntu

https://developers.dhis2.org/guides/dhis2-docker

sudo apt-get update
sudo apt-get upgrade

sudo apt-get install gnupg curl

USER=anwar
sudo useradd -U -G sudo -b /home $USER
sudo passwd $USER

curl -sSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add –

VERSION=node_12.x
DISTRO=”$(lsb_release -s -c)”

echo “deb https://deb.nodesource.com/$VERSION $DISTRO main” | sudo tee /etc/apt/sources.list.d/nodesource.list
echo “deb-src https://deb.nodesource.com/$VERSION $DISTRO main” | sudo tee -a /etc/apt/sources.list.d/nodesource.list

sudo apt-get update
sudo apt-get install nodejs

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add –
echo “deb https://dl.yarnpkg.com/debian/ stable main” | sudo tee /etc/apt/sources.list.d/yarn.list

sudo apt-get update
sudo apt-get install yarn

sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
software-properties-common

sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –
sudo add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable”

sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io

sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker

sudo chown “$USER”:”$USER” /home/”$USER”/.docker -R
sudo chmod g+rwx “$HOME/.docker” -R

echo “{ \”data-root\”: \”/custom/docker/data/dir\”, \”exec-root\”: \”/custom/docker/dir\” }” | sudo tee /etc/docker/daemon.json

sudo systemctl start docker

sudo systemctl enable docker
sudo systemctl disable docker

sudo curl -L “https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)” -o /usr/local/bin/docker-compose

sudo chmod +x /usr/local/bin/docker-compose

====================================================================

yarn global add @dhis2/cli

d2 cluster up 2.35.0 –db-version 2.35 –port 8080

===================================================================

dhis2 re-installing processes:

d2 cluster list

d2 cluster down
d2 cluster down 2.35.0

docker ps -a

////docker rm ID_or_Name
docker rm 444d8248f221

docker images -a
docker rmi 298ec0e28760
docker rmi 5e6f392e99e5
docker rmi 62fb96702cf2
docker rmi 19d027b65340

d2 cluster up 2.35.0 –db-version 2.35 –port 8080

d2 cluster down 2.35.0

docker system prune -a
docker image prune
docker container prune
docker volume prune
docker network prune

d2 cluster up 2.35.0

Filed Under: dhis2

dhis2 all links

26th January 2021 by Site Admin Leave a Comment

Tracker Web API
https://docs.dhis2.org/2.35/en/developer/html/webapi_tracker_api.html

https://docs.dhis2.org/2.35/en/implementer/html/offline_data_entry.html

https://docs.dhis2.org/en/develop/using-the-api/dhis-core-version-master/tracker.html

How to Install a DHIS2 local instance
https://developers.dhis2.org/docs/guides/spin-up-local-instance/

DHIS2 App development guides
https://www.fiftythreetwenty.com/learn/dhis2/app-development-guides/

DHIS2 UI Components
https://ui.dhis2.nu

DHIS2 UI Components Demo
https://ui.dhis2.nu/demo

DHIS2 Application Runtime supported React Hooks
https://runtime.dhis2.nu/#/hooks/

DHIS2 Application Hub
https://apps.dhis2.org/

DHIS2 Web App Development Academy 2020 Samples
https://github.com/dhis2/academy-web-app-dev-2020

Bulk-Load GitHub React App source code
https://github.com/EyeSeeTea/Bulk-Load

Filed Under: dhis2

dhis2 application development steps

19th January 2021 by Site Admin Leave a Comment

https://www.fiftythreetwenty.com/learn/dhis2/app-development-guides/

https://ui.dhis2.nu

https://ui.dhis2.nu/demo

https://developers.dhis2.org/docs/guides/spin-up-local-instance/

https://github.com/dhis2/academy-web-app-dev-2020

https://developers.dhis2.org/guides/dhis2-docker

https://developers.dhis2.org/guides/quickstart-app-development

https://runtime.dhis2.nu/#/hooks/useDataQuery

https://github.com/EyeSeeTea/Bulk-Load

npm install --global yarn

yarn global add @dhis2/cli
 OR
npm install --global @dhis2/cli

d2 app scripts init <app-name>
Create a folder (dhis2_apps) and get into it and run the following command.
d2 app scripts init hellod2worldapp1

cd hellod2worldapp1
yarn start

for existing app, go to the folder and run
yarn install

http://localhost:3001
http://localhost:8085/dhis-web-settings/index.html#/access
 
CORS whitelist
http://*
 
Host: http://localhost:8085
User: admin
Pass: district
 
yarn build
Find the app here
D:\xampp7227\htdocs\dhis2_apps\MyD2App1\build\bundle\hellod2worldapp1.zip

Filed Under: dhis2, Uncategorised

Primary Sidebar

Recent Posts

  • Bijoy Converter
  • How to amend previous commit with current changes in git and github?
  • How to install PHP 8.1 alongside PHP 7.4 using HomeBrew in MacOs?
  • Create a shell script to switch 7.4 to 8.1 and vice versa
  • How to reflect PHP8.1 to Apache in MacOS?

Recent Comments

    Archives

    • October 2025
    • September 2024
    • January 2024
    • July 2023
    • October 2021
    • September 2021
    • February 2021
    • January 2021
    • October 2020
    • September 2020
    • August 2020
    • May 2020
    • March 2020
    • February 2020
    • January 2020
    • November 2019
    • May 2019

    Categories

    • Couchbase
    • Cron Job
    • dhis2
    • Linux, MySQL
    • MySQL
    • Oracle
    • Oracle Client
    • PHP
    • SSL
    • Subdomain
    • Uncategorised
    • Wordpress
    • WP
    • Zip

    Meta

    • Log in
    • Entries feed
    • Comments feed
    • WordPress.org

    Copyright © 2025 · Genesis Sample on Genesis Framework · WordPress · Log in