Skip to content

Commit

Permalink
Merge pull request #27 from Comcast/feature/env-config
Browse files Browse the repository at this point in the history
Move the system configuration to be controlled by an environment vari…
  • Loading branch information
schmidtw authored Nov 8, 2017
2 parents 3365212 + 4741194 commit 46e9a6e
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
37 changes: 35 additions & 2 deletions etc/init.d/talaria
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,44 @@
# Source function library
. /etc/rc.d/init.d/functions

# Source the optional environment setup file
if [ -f /etc/talaria/talaria.env ]; then
. /etc/talaria/talaria.env
fi

RETVAL=0
DAEMON_COREFILE_LIMIT=unlimited

# Set limits here in addition to limits.conf
ulimit -n 750000
#-------------------------------------------------------------------------------
if [ -n "$ULIMIT_OPEN_FILES" ]; then
sysctl -w fs.file-max=$ULIMIT_OPEN_FILES > /dev/null
RETVAL=$?
[ $RETVAL -ne 0 ] && echo "fs.file-max=$ULIMIT_OPEN_FILES failed" && exit $RETVAL

sysctl -w fs.nr_open=$ULIMIT_OPEN_FILES > /dev/null
RETVAL=$?
[ $RETVAL -ne 0 ] && echo "fs.nr_open=$ULIMIT_OPEN_FILES failed" && exit $RETVAL

ulimit -n $ULIMIT_OPEN_FILES > /dev/null
RETVAL=$?
[ $RETVAL -ne 0 ] && echo "ulimit -n $ULIMIT_OPEN_FILES failed" && exit $RETVAL
fi
if [ -n "$NET_IPV4_TCP_MEM" ]; then
sysctl -w net.ipv4.tcp_mem=$NET_IPV4_TCP_MEM > /dev/null
RETVAL=$?
[ $RETVAL -ne 0 ] && echo "net.ipv4.tcp_mem=$NET_IPV4_TCP_MEM failed" && exit $RETVAL
fi
if [ -n "$NET_CORE_SOMAXCONN" ]; then
sysctl -w net.core.somaxconn=$NET_CORE_SOMAXCONN > /dev/null
RETVAL=$?
[ $RETVAL -ne 0 ] && echo "net.core.somaxconn=$NET_CORE_SOMAXCONN failed" && exit $RETVAL
fi
if [ -n "$NET_IPV4_TCP_MAX_SYN_BACKLOG" ]; then
sysctl -w net.ipv4.tcp_max_syn_backlog=$NET_IPV4_TCP_MAX_SYN_BACKLOG > /dev/null
RETVAL=$?
[ $RETVAL -ne 0 ] && echo "net.ipv4.tcp_max_syn_backlog=$NET_IPV4_TCP_MAX_SYN_BACKLOG failed" && exit $RETVAL
fi
#-------------------------------------------------------------------------------

start() {
echo -n $"Starting talaria: "
Expand Down
5 changes: 5 additions & 0 deletions etc/talaria/talaria.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#ULIMIT_OPEN_FILES=75000
#NET_CORE_SOMAXCONN=1000
#NET_IPV4_TCP_MAX_SYN_BACKLOG=1000
#NET_IPV4_TCP_MEM="100000000 100000000 100000000"
DAEMON_COREFILE_LIMIT=unlimited
2 changes: 2 additions & 0 deletions talaria.spec
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ popd

# Install Configuration
%{__install} -d %{buildroot}%{_sysconfdir}/%{name}
%{__install} -p etc/%{name}/%{name}.env.example %{buildroot}%{_sysconfdir}/%{name}/%{name}.env.example
%{__install} -p etc/%{name}/%{name}.json %{buildroot}%{_sysconfdir}/%{name}/%{name}.json
%{__install} -p etc/%{name}/supervisord.conf %{buildroot}%{_sysconfdir}/%{name}/supervisord.conf

Expand All @@ -61,6 +62,7 @@ popd

# Configuration
%dir %{_sysconfdir}/%{name}
%config %attr(644, talaria, talaria) %{_sysconfdir}/%{name}/%{name}.env.example
%config %attr(644, talaria, talaria) %{_sysconfdir}/%{name}/%{name}.json
%config %attr(644, talaria, talaria) %{_sysconfdir}/%{name}/supervisord.conf

Expand Down

0 comments on commit 46e9a6e

Please sign in to comment.