Skip to content

Commit

Permalink
Merge pull request #159 from marsante/update-&-fix-bash-docker-vagrant
Browse files Browse the repository at this point in the history
Update & fix bash docker vagrant
  • Loading branch information
MedShake authored Aug 4, 2024
2 parents dd81d7d + d65d6ef commit d6980ef
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Vagrant.configure("2") do |config|
config.vm.box = "generic/debian11"
config.vm.box = "debian/bookworm64va"
config.vm.define "msehr"
config.vm.hostname = "msehr.local"
config.vm.network "private_network", ip: "192.168.56.4"
Expand Down
9 changes: 4 additions & 5 deletions installer/debian-bash-installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -219,17 +219,16 @@ msehrInstall() {
mkdir -p "$msehrPath"/public_html
version=$(echo "$vRelease" | cut -f2 -d "v")
mv -f /tmp/MedShakeEHR-base-"$version"/* "$msehrPath"

echo "$msehrPath
" > "$msehrPath"/public_html/MEDSHAKEEHRPATH
chown www-data:www-data -R "$msehrPath"
chmod 755 "$msehrPath" "$msehrPath"/public_html

cd "$msehrPath" || exit
su www-data -s/bin/bash -c 'composer install --no-interaction --no-cache -o'
cd "$msehrPath"/public_html || exit
su www-data -s/bin/bash -c 'composer install --no-interaction --no-cache -o'
echo "$msehrPath
" > "$msehrPath"/public_html/MEDSHAKEEHRPATH
su www-data -s/bin/bash -c "php $msehrPath/public_html/install.php -N -s localhost -d $msehrDbName -u $mysqlUser -p $mysqlUserPswd -r https -D $msehrDom"
su www-data -s/bin/bash -c "php $msehrPath/public_html/install.php -N -s localhost -d $msehrDbName -u $mysqlUser -p $mysqlUserPswd -r https -D $msehrDom -o localhost"

selectRemoveInstallFiles
}
Expand Down Expand Up @@ -285,7 +284,7 @@ msehrDom=msehr.local
msehrDbName=medshakeehr
selectVersion=1
selectRemove=1
msehrDep="apache2 composer curl ghostscript git imagemagick mariadb-server ntp pdftk-java php php-bcmath php-curl php-gd php-imagick php-imap php-intl php-mysql php-soap php-xml php-yaml php-zip"
msehrDep="apache2 composer curl ghostscript git imagemagick mariadb-server ntp pdftk-java php php-bcmath php-curl php-gd php-gnupg php-imagick php-imap php-intl php-mysql php-soap php-xml php-yaml php-zip"
extraDicom="orthanc"

clear
Expand Down
15 changes: 15 additions & 0 deletions tools/docker/msehr.upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,21 @@
$moveCommand = "cp -r -f $extractDir/* /var/www/html/";
exec($moveCommand);

// Set www-data if script executed by root
if (posix_getuid() === 0) { // Check if the user is root
// Get the UID of the www-data user
$uid = posix_getpwnam('www-data')['uid'];
$gid = posix_getgrnam('www-data')['gid'];

// Set the correct ownership for the files and subdirectories
$dirIterator = new RecursiveDirectoryIterator('/var/www/html/');
$iterator = new RecursiveIteratorIterator($dirIterator);
foreach ($iterator as $fileInfo) {
chown($fileInfo->getPathname(), $uid);
chgrp($fileInfo->getPathname(), $gid);
}
}

// Print a success message
echo "La copie c'est bien déroulée, connectez vous à votre compte administrateur pour appliquer la mise à jour.\n";

Expand Down

0 comments on commit d6980ef

Please sign in to comment.