Skip to content

Instantly share code, notes, and snippets.

@citizenrich
Last active January 9, 2018 13:49
Show Gist options
  • Select an option

  • Save citizenrich/b5396dd0cc7bd2958a7e152428b3e730 to your computer and use it in GitHub Desktop.

Select an option

Save citizenrich/b5396dd0cc7bd2958a7e152428b3e730 to your computer and use it in GitHub Desktop.
fresh manual install oim
#!/bin/bash
set -ex
# centos
# for remote install on fresh hosts:
# sudo yum -y install openssh openssh-server openssh-clients openssl-libs
# systemctl restart sshd.service
# ip address
# requirements are a JRE, PHP, Git, wget, unzip. php-xml is an addtl req for CentOS.
# sudo yum install -y git wget unzip java-1.7.0-openjdk php php-xml
# unblock port 8984
# sudo firewall-cmd --permanent --add-port=8984/tcp
# sudo firewall-cmd --reload
# proceed as normal
cd $HOME
wget http://files.basex.org/releases/8.5.3/BaseX853.zip
unzip BaseX853.zip
mkdir ~/openinfoman
cp -R basex/* openinfoman/
cp basex/.basexhome openinfoman/
BASEX=$HOME/openinfoman/bin/basex
mkdir openinfoman/repo-src
git clone https://github.com/openhie/openinfoman openinfomangh
cp openinfomangh/repo/* openinfoman/repo-src/
cp -R openinfomangh/resources openinfoman/
cp ~/openinfomangh/webapp/*xqm ~/openinfoman/webapp
mkdir -p ~/openinfoman/webapp/static
cp -R ~/openinfomangh/webapp/static/* ~/openinfoman/webapp/static
$BASEX -Vc "CREATE DATABASE provider_directory"
printf "module namespace csd_webconf = 'https://github.com/openhie/openinfoman/csd_webconf';
declare variable \$csd_webconf:db := 'provider_directory';
declare variable \$csd_webconf:baseurl := '';
declare variable \$csd_webconf:remote_services := ();
" > $HOME/openinfoman/repo-src/generated_openinfoman_webconfig.xqm
$BASEX -Vc "REPO INSTALL http://files.basex.org/modules/expath/functx-1.0.xar"
cd $HOME/openinfoman/repo-src
mv csd_webapp_config.xqm csd_webapp_config.xqm.orig
REPOS=("generated_openinfoman_webconfig.xqm" "csd_webapp_ui.xqm" "csd_base_library.xqm" "csd_base_library_updating.xqm" "csd_base_stored_queries.xqm" "csd_document_manager.xqm" "csd_load_sample_directories.xqm" "csd_query_updated_services.xqm" "csd_poll_service_directories.xqm" "csd_local_services_cache.xqm" "csd_merge_cached_services.xqm" "csr_processor.xqm" "svs_load_shared_value_sets.xqm" "async_fake.xqm")
for REPO in ${REPOS[@]}
do
INST="REPO INSTALL $REPO"
$BASEX -Vc "${INST}"
done
$BASEX -Vc "RUN $HOME/openinfoman/resources/scripts/init_db.xq"
cd $HOME/openinfoman
SFS=resources/stored*definitions/*xml
for SF in ${SFS[@]}
do
resources/scripts/install_stored_function.php $SF
# if [[ $? != 0 ]]; then exit 1; fi
done
SVS=$HOME/openinfoman/resources/shared_value_sets/*
for SV in ${SVS[@]}
do
basex -q"import module namespace svs_lsvs = 'https://github.com/openhie/openinfoman/svs_lsvs';' (svs_lsvs:load($SV))'"
done
# openinfoman-csv
cd $HOME
git clone https://github.com/openhie/openinfoman-csv
cd ~/openinfoman-csv/repo
$BASEX -Vc "REPO INSTALL openinfoman_csv_adapter.xqm"
# this may not be needed
cp ~/openinfoman-csv/webapp/*xqm ~/openinfoman/webapp
# openinfoman-rapidpro
cd $HOME
git clone https://github.com/openhie/openinfoman-rapidpro
SFS=$HOME/openinfoman-rapidpro/resources/stored*definitions/*xml
cd $HOME/openinfoman
for SF in ${SFS[@]}
do
resources/scripts/install_stored_function.php $SF
# if [[ $? != 0 ]]; then exit 1; fi
done
cp ~/openinfoman-rapidpro/webapp/openinfoman_rapidpro_bindings.xqm ~/openinfoman/webapp
# openinfoman-ilr
cd $HOME
git clone https://github.com/openhie/openinfoman-ilr
SFS=$HOME/openinfoman-ilr/resources/stored*definitions/*xml
cd $HOME/openinfoman
for SF in ${SFS[@]}
do
resources/scripts/install_stored_function.php $SF
# if [[ $? != 0 ]]; then exit 1; fi
done
# openinfoman-hwr
cd $HOME
git clone https://github.com/openhie/openinfoman-hwr
SFS=$HOME/openinfoman-hwr/resources/stored*definitions/*xml
cd $HOME/openinfoman
for SF in ${SFS[@]}
do
resources/scripts/install_stored_function.php $SF
# if [[ $? != 0 ]]; then exit 1; fi
done
# openinfoman-dhis
cd $HOME
git clone https://github.com/openhie/openinfoman-dhis
cp openinfoman-dhis/repo/* openinfoman/repo-src/
cd $HOME/openinfoman/repo-src
declare -a arr=("dxf2csd.xqm" "dxf_1_0.xqm" "util.xqm");\
for i in "${arr[@]}"; do $BASEX -Vc "repo install $i"; done
SFS=$HOME/openinfoman-dhis/resources/stored*definitions/*xml
cd $HOME/openinfoman
for SF in ${SFS[@]}
do
resources/scripts/install_stored_function.php $SF
# if [[ $? != 0 ]]; then exit 1; fi
done
cp ~/openinfoman-dhis/webapp/openinfoman_dhis2_bindings.xqm ~/openinfoman/webapp
cp -R ~/openinfoman-dhis/resources/service_directories/* ~/openinfoman/resources/service_directories/
cd ~/openinfoman/bin && ./basexhttp &
#!/bin/bash
set -ex
# centos
# for remote install on fresh hosts:
# sudo yum -y install openssh openssh-server openssh-clients openssl-libs
# systemctl restart sshd.service
# ip address
# requirements are a JRE, PHP, Git, wget, unzip. php-xml is an addtl req for CentOS.
# sudo yum install -y git wget unzip java-1.7.0-openjdk php php-xml
# unblock port 8984
# sudo firewall-cmd --permanent --add-port=8984/tcp
# sudo firewall-cmd --reload
# cleanup from last install
cd $HOME
$HOME/openinfoman/basex/bin/basexhttp stop || true
rm -rf BaseX853* || true
rm -rf basex/ || true
# remove the cloned repos
rm -rf openinfomangh || true
rm -rf openinfoman-csv || true
rm -rf openinfoman-rapidpro || true
rm -rf openinfoman-ilr || true
rm -rf openinfoman-hwr || true
rm -rf openinfoman-dhis || true
BASEX=$HOME/openinfoman/bin/basex
# keep the data dir if it exists
set +e
$BASEX -Vc "list provider_directory" > /dev/null
if [ $? -eq 0 ]; then
echo "BaseX Database provider_directory exists\n"
else
echo "BaseX Database provider_directory does not exist\n"
$BASEX -Vc 'create database provider_directory'
fi
set -e
wget http://files.basex.org/releases/8.5.3/BaseX853.zip
unzip BaseX853.zip
mkdir -p ~/openinfoman
cp -R basex/* openinfoman/
cp basex/.basexhome openinfoman/
mkdir -p openinfoman/repo-src
git clone https://github.com/openhie/openinfoman openinfomangh
cp openinfomangh/repo/* openinfoman/repo-src/
cp -R openinfomangh/resources openinfoman/
cp ~/openinfomangh/webapp/*xqm ~/openinfoman/webapp
mkdir -p ~/openinfoman/webapp/static
cp -R ~/openinfomangh/webapp/static/* ~/openinfoman/webapp/static
printf "module namespace csd_webconf = 'https://github.com/openhie/openinfoman/csd_webconf';
declare variable \$csd_webconf:db := 'provider_directory';
declare variable \$csd_webconf:baseurl := '';
declare variable \$csd_webconf:remote_services := ();
" > $HOME/openinfoman/repo-src/generated_openinfoman_webconfig.xqm
$BASEX -Vc "REPO INSTALL http://files.basex.org/modules/expath/functx-1.0.xar"
cd $HOME/openinfoman/repo-src
mv csd_webapp_config.xqm csd_webapp_config.xqm.orig
REPOS=("generated_openinfoman_webconfig.xqm" "csd_webapp_ui.xqm" "csd_base_library.xqm" "csd_base_library_updating.xqm" "csd_base_stored_queries.xqm" "csd_document_manager.xqm" "csd_load_sample_directories.xqm" "csd_query_updated_services.xqm" "csd_poll_service_directories.xqm" "csd_local_services_cache.xqm" "csd_merge_cached_services.xqm" "csr_processor.xqm" "svs_load_shared_value_sets.xqm" "async_fake.xqm")
for REPO in ${REPOS[@]}
do
INST="REPO INSTALL $REPO"
$BASEX -Vc "${INST}"
done
$BASEX -Vc "RUN $HOME/openinfoman/resources/scripts/init_db.xq"
cd $HOME/openinfoman
SFS=resources/stored*definitions/*xml
for SF in ${SFS[@]}
do
resources/scripts/install_stored_function.php $SF
done
SVS=$HOME/openinfoman/resources/shared_value_sets/*
for SV in ${SVS[@]}
do
basex -q"import module namespace svs_lsvs = 'https://github.com/openhie/openinfoman/svs_lsvs';' (svs_lsvs:load($SV))'"
done
# openinfoman-csv
cd $HOME
git clone https://github.com/openhie/openinfoman-csv
cd ~/openinfoman-csv/repo
$BASEX -Vc "REPO INSTALL openinfoman_csv_adapter.xqm"
# this may not be needed
cp ~/openinfoman-csv/webapp/*xqm ~/openinfoman/webapp
# openinfoman-rapidpro
cd $HOME
git clone https://github.com/openhie/openinfoman-rapidpro
SFS=$HOME/openinfoman-rapidpro/resources/stored*definitions/*xml
cd $HOME/openinfoman
for SF in ${SFS[@]}
do
resources/scripts/install_stored_function.php $SF
done
cp ~/openinfoman-rapidpro/webapp/openinfoman_rapidpro_bindings.xqm ~/openinfoman/webapp
# openinfoman-ilr
cd $HOME
git clone https://github.com/openhie/openinfoman-ilr
SFS=$HOME/openinfoman-ilr/resources/stored*definitions/*xml
cd $HOME/openinfoman
for SF in ${SFS[@]}
do
resources/scripts/install_stored_function.php $SF
done
# openinfoman-hwr
cd $HOME
git clone https://github.com/openhie/openinfoman-hwr
SFS=$HOME/openinfoman-hwr/resources/stored*definitions/*xml
cd $HOME/openinfoman
for SF in ${SFS[@]}
do
resources/scripts/install_stored_function.php $SF
done
# openinfoman-dhis
cd $HOME
git clone https://github.com/openhie/openinfoman-dhis
cp openinfoman-dhis/repo/* openinfoman/repo-src/
cd $HOME/openinfoman/repo-src
declare -a arr=("dxf2csd.xqm" "dxf_1_0.xqm" "util.xqm");\
for i in "${arr[@]}"; do $BASEX -Vc "repo install $i"; done
SFS=$HOME/openinfoman-dhis/resources/stored*definitions/*xml
cd $HOME/openinfoman
for SF in ${SFS[@]}
do
resources/scripts/install_stored_function.php $SF
done
cp ~/openinfoman-dhis/webapp/openinfoman_dhis2_bindings.xqm ~/openinfoman/webapp
cp -R ~/openinfoman-dhis/resources/service_directories/* ~/openinfoman/resources/service_directories/
cd ~/openinfoman/bin && ./basexhttp &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment