Logrotate on etc/odoo-server.log (#13)

* logrotate

* chmod +x entrypoint.sh
This commit is contained in:
Minh Nguyen 2025-04-18 22:26:43 +07:00 committed by GitHub
parent c7579c53b1
commit 0511e21c4c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 22 additions and 1 deletions

View File

@ -29,7 +29,7 @@ services:
volumes: volumes:
#- /etc/timezone:/etc/timezone:ro #- /etc/timezone:/etc/timezone:ro
#- /etc/localtime:/etc/localtime:ro #- /etc/localtime:/etc/localtime:ro
# - ./entrypoint.sh:/entrypoint.sh # if you want to install additional Python packages, uncomment this line! - ./entrypoint.sh:/entrypoint.sh
- ./addons:/mnt/extra-addons - ./addons:/mnt/extra-addons
- ./etc:/etc/odoo - ./etc:/etc/odoo
restart: always # run as a service restart: always # run as a service

11
entrypoint.sh Normal file → Executable file
View File

@ -15,6 +15,17 @@ pip3 install -r /etc/odoo/requirements.txt
# sed -i 's|raise werkzeug.exceptions.BadRequest(msg)|self.jsonrequest = {}|g' /usr/lib/python3/dist-packages/odoo/http.py # sed -i 's|raise werkzeug.exceptions.BadRequest(msg)|self.jsonrequest = {}|g' /usr/lib/python3/dist-packages/odoo/http.py
# Install logrotate if not already installed
if ! dpkg -l | grep -q logrotate; then
apt-get update && apt-get install -y logrotate
fi
# Copy logrotate config
cp /etc/odoo/logrotate /etc/logrotate.d/odoo
# Start cron daemon (required for logrotate)
cron
DB_ARGS=() DB_ARGS=()
function check_config() { function check_config() {
param="$1" param="$1"

8
etc/logrotate Normal file
View File

@ -0,0 +1,8 @@
/etc/odoo/*.log {
rotate 3
daily
nocompress
missingok
notifempty
copytruncate
}

2
run.sh
View File

@ -43,6 +43,8 @@ fi
find $DESTINATION -type f -exec chmod 644 {} \; find $DESTINATION -type f -exec chmod 644 {} \;
find $DESTINATION -type d -exec chmod 755 {} \; find $DESTINATION -type d -exec chmod 755 {} \;
chmod +x $DESTINATION/entrypoint.sh
# Run Odoo # Run Odoo
docker-compose -f $DESTINATION/docker-compose.yml up -d docker-compose -f $DESTINATION/docker-compose.yml up -d