Skip to content

Commit

Permalink
Merge pull request #15 from seatable/fix-logrotate
Browse files Browse the repository at this point in the history
fix log rotate
  • Loading branch information
freeplant authored Dec 2, 2021
2 parents 72422a1 + 580020c commit 3eb6050
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 6 deletions.
3 changes: 3 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ COPY scripts/my-ubuntu-source.list /etc/apt/sources.list
## Dev related libs
RUN apt-get update --fix-missing

# Time zone
RUN export DEBIAN_FRONTEND=noninteractive && apt-get install -y tzdata

# Nginx
RUN apt-get install -y nginx

Expand Down
1 change: 1 addition & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ services:
environment:
- SEATABLE_THUMBNAIL_SERVER_HOSTNAME=thumbnail.seatable.cn
- SEATABLE_THUMBNAIL_SERVER_LETSENCRYPT=True
- TIME_ZONE=Asia/Shanghai
depends_on:
- redis
networks:
Expand Down
12 changes: 12 additions & 0 deletions docker/scripts/01_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

set -e

# time zone
if [[ $TIME_ZONE != "" ]]; then
time_zone=/usr/share/zoneinfo/$TIME_ZONE
if [[ ! -e $time_zone ]]; then
echo "invalid time zone"
exit 1
else
ln -snf $time_zone /etc/localtime
echo "$TIME_ZONE" > /etc/timezone
fi
fi

# check folder
if [[ ! -e /shared ]]; then
echo 'do not find /shared path'
Expand Down
8 changes: 6 additions & 2 deletions docker/scripts/enterpoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,12 @@ fi


# logrotate
chmod 0644 /scripts/logrotate-conf/logrotate-cron
/usr/bin/crontab /scripts/logrotate-conf/logrotate-cron
if [[ -f /var/spool/cron/crontabs/root ]]; then
cat /scripts/logrotate-conf/logrotate-cron >> /var/spool/cron/crontabs/root
else
chmod 0644 /scripts/logrotate-conf/logrotate-cron
/usr/bin/crontab /scripts/logrotate-conf/logrotate-cron
fi


# autorun
Expand Down
4 changes: 4 additions & 0 deletions docker/scripts/logrotate-conf/seatable-thumbnail
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
create 644 root root
sharedscripts
postrotate
if [ -f /opt/seatable-thumbnail/pids/seafile.pid ]; then
kill -USR1 `cat /opt/seatable-thumbnail/pids/seafile.pid`
fi

/scripts/logrotate-conf/seatable-thumbnail-restart.sh
endscript
}
4 changes: 0 additions & 4 deletions docker/scripts/logrotate-conf/seatable-thumbnail-restart.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash

function stop_server() {
pkill -9 -f seaf-server
pkill -9 -f uvicorn
pkill -9 -f multiprocessing
}
Expand All @@ -25,9 +24,6 @@ function start_server() {

set_env

seaf-server -F /opt/seatable-thumbnail/conf -c /opt/seatable-thumbnail/ccnet -d /opt/seatable-thumbnail/seafile-data -l /opt/seatable-thumbnail/logs/seafile.log -L /opt/seatable-thumbnail -P /opt/seatable-thumbnail/pids/seafile.pid - &
sleep 0.2

cd /opt/seatable-thumbnail/seatable-thumbnail-server/
/usr/local/bin/uvicorn main:app --host 127.0.0.1 --port 8088 --workers 4 --access-log --proxy-headers &>> /opt/seatable-thumbnail/logs/seatable-thumbnail.log &
sleep 0.2
Expand Down

0 comments on commit 3eb6050

Please sign in to comment.