File tree 7 files changed +106
-0
lines changed
7 files changed +106
-0
lines changed Original file line number Diff line number Diff line change 9
9
kubernetes /
10
10
scripts /
11
11
docker-compose.yml
12
+ logs /
13
+ supervisor-logs /
14
+ zulip-data /
15
+
Original file line number Diff line number Diff line change 3
3
# tools/build-release-tarball to generate a production release tarball
4
4
# from the provided Git ref.
5
5
FROM ubuntu:24.04 AS base
6
+ # Install required packages
7
+ RUN apt-get update && apt-get install -y \
8
+ logrotate \
9
+ cron \
10
+ && rm -rf /var/lib/apt/lists/*
11
+
12
+ # Copy logrotate configuration
13
+ COPY zulip-docker /etc/logrotate.d/zulip-docker
14
+ RUN chmod 644 /etc/logrotate.d/zulip-docker
15
+
16
+ # Set up log directories with proper permissions
17
+ RUN mkdir -p /var/log/zulip /var/log/supervisor \
18
+ && chown -R zulip:zulip /var/log/zulip \
19
+ && chmod 755 /var/log/zulip
6
20
7
21
# Set up working locales and upgrade the base image
8
22
ENV LANG="C.UTF-8"
Original file line number Diff line number Diff line change @@ -97,7 +97,14 @@ services:
97
97
# comma-separated set of IP addresses to trust here.
98
98
# LOADBALANCER_IPS: "",
99
99
volumes :
100
+ - ./logs:/var/log/zulip:rw
101
+ - ./supervisor-logs:/var/log/supervisor:rw
100
102
- " zulip:/data:rw"
103
+ depends_on :
104
+ - database
105
+ - memcached
106
+ - rabbitmq
107
+ - redis
101
108
ulimits :
102
109
nofile :
103
110
soft : 1000000
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
+ set -e
2
3
3
4
if [ " $DEBUG " = " true" ] || [ " $DEBUG " = " True" ]; then
4
5
set -x
5
6
set -o functrace
6
7
fi
7
8
set -e
8
9
shopt -s extglob
10
+ # === ADD NEW LOG ROTATION CODE RIGHT HERE ===
11
+ echo " Setting up log rotation..."
12
+ service cron start
13
+ touch /var/lib/logrotate/status
14
+
15
+ echo " Creating log directories..."
16
+ mkdir -p /var/log/zulip /var/log/supervisor
17
+
18
+ echo " Setting correct permissions..."
19
+ chown -R zulip:zulip /var/log/zulip
20
+ chmod 755 /var/log/zulip
21
+ # === END OF NEW LOG ROTATION CODE ===
9
22
10
23
# DB aka Database
11
24
DB_HOST=" ${DB_HOST:- 127.0.0.1} "
Original file line number Diff line number Diff line change
1
+ docker exec -it zulip bash -c 'cat > /etc/logrotate.d/zulip-docker' << 'EOF'
2
+ /var/log/zulip/*.log {
3
+ daily
4
+ rotate 7
5
+ compress
6
+ delaycompress
7
+ notifempty
8
+ missingok
9
+ create 644 zulip zulip
10
+ sharedscripts
11
+ postrotate
12
+ supervisorctl reopen-logs
13
+ endscript
14
+ }
15
+
16
+ /var/log/supervisor/*.log {
17
+ daily
18
+ rotate 7
19
+ compress
20
+ delaycompress
21
+ notifempty
22
+ missingok
23
+ create 644 root root
24
+ sharedscripts
25
+ postrotate
26
+ supervisorctl reopen-logs
27
+ endscript
28
+ }
29
+ EOF
Original file line number Diff line number Diff line change
1
+ /var/log/zulip/server.log
2
+ /var/log/zulip/workers.log
3
+ /var/log/zulip/errors.log
4
+ {
5
+ rotate 7
6
+ daily
7
+ missingok
8
+ compress
9
+ delaycompress
10
+ notifempty
11
+ create 644 zulip zulip
12
+ sharedscripts
13
+ postrotate
14
+ /usr/bin/supervisorctl reopen-logs
15
+ endscript
16
+ }
Original file line number Diff line number Diff line change
1
+ [supervisord]
2
+ nodaemon=true
3
+ logfile=/var/log/supervisor/supervisord.log
4
+ logfile_maxbytes=50MB
5
+ logfile_backups=10
6
+ loglevel=info
7
+
8
+ [program:zulip]
9
+ command=/usr/local/bin/zulip start
10
+ stdout_logfile=/var/log/zulip/server.log
11
+ stdout_logfile_maxbytes=50MB
12
+ stdout_logfile_backups=10
13
+ redirect_stderr=true
14
+ autostart=true
15
+ autorestart=true
16
+ priority=10
17
+ startsecs=10
18
+ startretries=3
19
+
20
+ [program:cron]
21
+ command=/usr/sbin/cron -f
22
+ autostart=true
23
+ autorestart=true
You can’t perform that action at this time.
0 commit comments