Skip to content

Commit

Permalink
Update to version 3.1.0, add memcached
Browse files Browse the repository at this point in the history
  • Loading branch information
fiorix committed Mar 15, 2016
1 parent 067c196 commit 0be4ae8
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cmd/freegeoip/ansible-playbook/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ Following is a TODO list for people willing to use this playbook:
Then run:

```bash
ansible-playbook -u root ./freegeoip.yml
ansible-playbook -u $user ./freegeoip.yml
```
8 changes: 6 additions & 2 deletions cmd/freegeoip/ansible-playbook/freegeoip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
roles:
- nodeexporter
- freegeoip
- memcached
- redis
vars:
nodeexporter_url: http://github.com/prometheus/node_exporter/releases/download/0.11.0/node_exporter-0.11.0.linux-amd64.tar.gz
freegeoip_url: https://github.com/fiorix/freegeoip/releases/download/v3.0.10/freegeoip-3.0.10-linux-amd64.tar.gz
freegeoip_url: https://github.com/fiorix/freegeoip/releases/download/v3.1.0/freegeoip-3.1.0-linux-amd64.tar.gz
freegeoip_params:
- -http=:80
- -https=:443
Expand All @@ -18,10 +19,13 @@
- -internal-server=:8888
- -silent
- -public=/opt/freegeoip/public
- -quota-backend=memcache
- -quota-max=10000
- -quota-interval=1h
- -redis={% for host in groups['freegeoip'] %}{{ hostvars[host]['private_ip'] }}:6379{% if not loop.last %},{% endif %}{% endfor %}
- -redis-timeout=1s
- -redis-timeout=10s
- -memcache={% for host in groups['freegeoip'] %}{{ hostvars[host]['private_ip'] }}:11211{% if not loop.last %},{% endif %}{% endfor %}
- -memcache-timeout=10s

- hosts: monitor
roles:
Expand Down
4 changes: 0 additions & 4 deletions cmd/freegeoip/ansible-playbook/roles/base/tasks/iptables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,3 @@
mode=0644
notify:
- reload-iptables

- debug: trigger reload-iptables
notify: reload-iptables
changed_when: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Run memcached as a daemon. This command is implied, and is not needed for the
# daemon to run. See the README.Debian that comes with this package for more
# information.
-d

# Log memcached's output to /var/log/memcached
logfile /var/log/memcached.log

# 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 2048

# Default connection port is 11211
-p 11211

# Run the daemon as root. The start-memcached will default to running as root if no

This comment has been minimized.

Copy link
@znomuz
# -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 0.0.0.0

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

# 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- name: restart memcached
service: name=memcached state=restarted
14 changes: 14 additions & 0 deletions cmd/freegeoip/ansible-playbook/roles/memcached/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
- name: Install memcached
apt: name=memcached state=installed

- name: Write custom memcached.conf
copy: src=memcached.conf
dest=/etc/memcached.conf
owner=root
group=root
mode=0644
notify:
- restart memcached

- name: Make sure memcached is running
service: name=memcached state=running

0 comments on commit 0be4ae8

Please sign in to comment.