Skip to content

Commit

Permalink
Docker: make memcache configurable, Update Baseimage to v0.10 (#54)
Browse files Browse the repository at this point in the history
* memcache.conf support in memcache.sh startup script added
* example memcache.conf file added (it differs a little bit from the original one from the debian package: -d and logfile is not supported for architecture reasons)
* Update to phusion/baseimage:0.10.0 docker base image
  • Loading branch information
tux1337 authored and pkittenis committed Oct 8, 2018
1 parent b989bd0 commit ea4a746
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 2 deletions.
3 changes: 2 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM phusion/baseimage:0.9.19
FROM phusion/baseimage:0.10.0

EXPOSE 80

Expand Down Expand Up @@ -41,6 +41,7 @@ RUN chmod +x /etc/my_init.d/dockerhost.sh
# Memcached service
RUN mkdir /etc/service/memcached
ADD memcached.sh /etc/service/memcached/run
ADD memcached.conf /etc/memcached.conf

# Install in virtualenv
RUN virtualenv /srv/graphite-env
Expand Down
46 changes: 46 additions & 0 deletions docker/memcached.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# memcached config file
#
# You can insert into this config file all options of memcached. Please
# refer the manpage.
# It will be appended to the memcached command on startup of the container

# Be verbose
# -v

# Be even more verbose (print client commands as well)
# -vv

# Start with a cap of 64 megs of memory. It's reasonable, and the daemon default
# Note that the daemon will grow to this size, but does not start out holding this much
# memory
-m 64

# Default connection port is 11211
-p 11211

# Run the daemon as root. The start-memcached will default to running as root if no
# -u command is present in this config file
-u memcache

# Specify which IP address to listen on. The default is to listen on all IP addresses
# This parameter is one of the only security measures that memcached has, so make sure
# it's listening on a firewalled interface.
-l 127.0.0.1

# Limit the number of simultaneous incoming connections. The daemon default is 1024
# -c 1024

# Lock down all paged memory. Consult with the README and homepage before you do this
# -k

# Return error when memory is exhausted (rather than removing items)
# -M

# Maximize core file limit
# -r

# Override the default size of each slab page. Default is 1mb. Default is 1m, minimum
# is 1k, max is 128m. Adjusting this value changes the item size limit. Beware that
# this also increases the number of slabs (use -v to view), and the overal memory usage
# of memcached.
-I 1m
6 changes: 5 additions & 1 deletion docker/memcached.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/bin/sh
# `/sbin/setuser memcache` runs the given command as the user `memcache`.
# If you omit that part, the command will be run as root.
exec /sbin/setuser memcache /usr/bin/memcached >>/var/log/memcached.log 2>&1

#read conf file
options=$(cat /etc/memcached.conf | grep -v '#' | grep -v '^$' | tr '\n' ' ')

exec /usr/bin/memcached $options >>/var/log/memcached.log 2>&1

0 comments on commit ea4a746

Please sign in to comment.