add bench docker

This commit is contained in:
Jun Kurihara 2022-06-28 07:36:18 -04:00
commit a6912e72bd
No known key found for this signature in database
GPG key ID: 48ADFD173ED22B03
3 changed files with 61 additions and 1 deletions

4
docker-bin/entrypoint.sh Normal file
View file

@ -0,0 +1,4 @@
#!/usr/bin/env bash
LOG_FILE=/var/log/rpxy/rpxy.log
/run.sh 2>&1 | tee $LOG_FILE

56
docker-bin/run.sh Normal file
View file

@ -0,0 +1,56 @@
#!/usr/bin/env bash
LOG_FILE=/var/log/rpxy/rpxy.log
CONFIG_FILE=/etc/rpxy.toml
LOG_SIZE=10M
LOG_NUM=10
# logrotate
if [ $LOGROTATE_NUM ]; then
LOG_NUM=${LOGROTATE_NUM}
fi
if [ $LOGROTATE_SIZE ]; then
LOG_SIZE=${LOGROTATE_SIZE}
fi
cat > /etc/logrotate.conf << EOF
# see "man logrotate" for details
# rotate log files weekly
weekly
# use the adm group by default, since this is the owning group
# of /var/log/syslog.
su root adm
# keep 4 weeks worth of backlogs
rotate 4
# create new (empty) log files after rotating old ones
create
# use date as a suffix of the rotated file
#dateext
# uncomment this if you want your log files compressed
#compress
# packages drop log rotation information into this directory
include /etc/logrotate.d
# system-specific logs may be also be configured here.
EOF
cat > /etc/logrotate.d/rpxy << EOF
${LOG_FILE} {
dateext
daily
missingok
rotate ${LOG_NUM}
notifempty
compress
delaycompress
dateformat -%Y-%m-%d-%s
size ${LOG_SIZE}
copytruncate
}
EOF
cp -p /etc/cron.daily/logrotate /etc/cron.hourly/
service cron start
echo "Start rpxy"
RUST_LOG=info /opt/rpxy/sbin/rpxy --config ${CONFIG_FILE}