Skip to content

Commit

Permalink
chore: change ATS traffic.out folder to /var/log/trafficserver (#122)
Browse files Browse the repository at this point in the history
* chore: change ATS traffic.out folder to /var/log/trafficserver

* chore: add license
  • Loading branch information
ntheanh201 authored Apr 15, 2024
1 parent 4237b79 commit 22530c0
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
1 change: 1 addition & 0 deletions traffic_server/_tsb/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ RUN pip3 install --user Sphinx
COPY run.sh /run.sh
COPY trafficserver.spec /rpmbuilddir/SPECS/trafficserver.spec
COPY traffic_server_jemalloc /rpmbuilddir/SOURCES/traffic_server_jemalloc
COPY trafficserver.env /rpmbuilddir/SOURCES/trafficserver.env
RUN /usr/sbin/useradd -u 176 -r ats -s /sbin/nologin -d /
CMD if [[ ${RHEL_VERSION%%.*} -ge 8 ]]; then \
os_toolset=gcc-toolset-11; \
Expand Down
3 changes: 1 addition & 2 deletions traffic_server/_tsb/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ ED
) || die "Failed to patch plugins makefile to include astats."

# Patch trafficserver systemd service
# This includes changing output redirection to traffic.out and adding udev-settle to wait for disks
(sed -i 's/ExecStart=@exp_bindir@\/traffic_manager \$TM_DAEMON_ARGS/ExecStart=@exp_bindir@\/traffic_manager --bind_stdout @exp_logdir@\/traffic.out --bind_stderr @exp_logdir@\/traffic.out \$TM_DAEMON_ARGS/g' /rpmbuilddir/SOURCES/src/rc/trafficserver.service.in)
# This includes adding udev-settle to wait for disks
(sed -i 's/After=syslog.target network.target/Wants=systemd-udev-settle.service \nAfter=syslog.target network.target systemd-udev-settle.service/g' /rpmbuilddir/SOURCES/src/rc/trafficserver.service.in)
rpmbuild -bb ${rpmbuild_openssl} --define "_topdir /rpmbuilddir" /rpmbuilddir/SPECS/trafficserver.spec || die "Failed to build rpm."
21 changes: 21 additions & 0 deletions traffic_server/_tsb/trafficserver.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# SPDX-License-Identifier: Apache-2.0

STDOUTLOG=/var/log/trafficserver/traffic.out
STDERRLOG=/var/log/trafficserver/traffic.out
5 changes: 5 additions & 0 deletions traffic_server/_tsb/trafficserver.spec
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Apache Traffic Server with Apache Traffic Control modifications and environment
%setup -c -T
cp -far %{src}/. .
cp -far %{src}/../traffic_server_jemalloc ..
cp -far %{src}/../trafficserver.env ..
autoreconf -vfi

%build
Expand All @@ -74,8 +75,11 @@ make DESTDIR=$RPM_BUILD_ROOT install

mkdir -p $RPM_BUILD_ROOT/opt/trafficserver/etc/trafficserver/snapshots
mkdir -p $RPM_BUILD_ROOT/usr/lib/systemd/system
mkdir -p $RPM_BUILD_ROOT/etc/sysconfig
cp rc/trafficserver.service $RPM_BUILD_ROOT/usr/lib/systemd/system/
cp ../traffic_server_jemalloc $RPM_BUILD_ROOT/opt/trafficserver/bin/
touch $RPM_BUILD_ROOT/etc/sysconfig/trafficserver
cp ../trafficserver.env $RPM_BUILD_ROOT/etc/sysconfig/trafficserver
mkdir -p $RPM_BUILD_ROOT/var/log/trafficserver

%if %{?_with_openssl_included:1}%{!?_with_openssl_included:0}
Expand Down Expand Up @@ -117,6 +121,7 @@ fi
%license LICENSE
%defattr(-,root,root)
%attr(644,-,-) /usr/lib/systemd/system/trafficserver.service
%attr(644,-,-) /etc/sysconfig/trafficserver
%dir /opt/trafficserver
%if %{?_with_openssl_included:1}%{!?_with_openssl_included:0}
/opt/trafficserver/openssl
Expand Down

0 comments on commit 22530c0

Please sign in to comment.