update permissions

This commit is contained in:
minhng92 2024-10-30 13:06:24 +07:00
parent 135c5cedab
commit 0b7438f2e0

31
run.sh
View File

@ -2,18 +2,35 @@
DESTINATION=$1 DESTINATION=$1
PORT=$2 PORT=$2
CHAT=$3 CHAT=$3
# clone Odoo directory
# Clone Odoo directory
git clone --depth=1 https://github.com/minhng92/odoo-18-docker-compose $DESTINATION git clone --depth=1 https://github.com/minhng92/odoo-18-docker-compose $DESTINATION
rm -rf $DESTINATION/.git rm -rf $DESTINATION/.git
# set permission
# Create PostgreSQL directory
mkdir -p $DESTINATION/postgresql mkdir -p $DESTINATION/postgresql
sudo chmod -R 777 $DESTINATION
# config # Change ownership to current user and set restrictive permissions for security
if grep -qF "fs.inotify.max_user_watches" /etc/sysctl.conf; then echo $(grep -F "fs.inotify.max_user_watches" /etc/sysctl.conf); else echo "fs.inotify.max_user_watches = 524288" | sudo tee -a /etc/sysctl.conf; fi sudo chown -R $USER:$USER $DESTINATION
sudo chmod -R 700 $DESTINATION # Only the user has access
# System configuration
if grep -qF "fs.inotify.max_user_watches" /etc/sysctl.conf; then
echo $(grep -F "fs.inotify.max_user_watches" /etc/sysctl.conf)
else
echo "fs.inotify.max_user_watches = 524288" | sudo tee -a /etc/sysctl.conf
fi
sudo sysctl -p sudo sysctl -p
# Set ports in docker-compose.yml
sed -i 's/10018/'$PORT'/g' $DESTINATION/docker-compose.yml sed -i 's/10018/'$PORT'/g' $DESTINATION/docker-compose.yml
sed -i 's/20018/'$CHAT'/g' $DESTINATION/docker-compose.yml sed -i 's/20018/'$CHAT'/g' $DESTINATION/docker-compose.yml
# run Odoo
# Set file and directory permissions after installation
find $DESTINATION -type f -exec chmod 644 {} \;
find $DESTINATION -type d -exec chmod 755 {} \;
# Run Odoo
docker-compose -f $DESTINATION/docker-compose.yml up -d docker-compose -f $DESTINATION/docker-compose.yml up -d
echo 'Started Odoo @ http://localhost:'$PORT' | Master Password: minhng.info | Live chat port: '$CHAT echo "Odoo started at http://localhost:$PORT | Master Password: minhng.info | Live chat port: $CHAT"