Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix log rotate #15

Merged
merged 2 commits into from
Dec 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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