Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View kafecho's full-sized avatar

Guillaume Belrose kafecho

View GitHub Profile
@kafecho
kafecho / setup.yml
Created January 19, 2016 05:51
Ansible steps to setup the CouchDB 2.x cluster after CouchDB 2.xhas been installed
# The steps below are not necessary if an admin account as been created and port and bind address are already configured
# I already do this via Ansible
#- name: enable the cluster
# uri: HEADER_Content-Type="application/json" user=admin password=password force_basic_auth=yes method=POST url=http://127.0.0.1:5984/_cluster_setup body='{"action":"enable_cluster"}'
# when: inventory_hostname == "{{ groups.couches[0] }}"
# tags: enable_cluster
# ignore_errors: yes
# Register all the nodes that are part of the couches inventory group.
# Registration is done from the 1st node in that group.
@kafecho
kafecho / couchdb
Created January 14, 2016 20:20
Example sysv script to run CouchDB 2.0 on CentOS 6.7. Tested by compiling CouchDB 2.0 from the Github sources. Created with pleaserun with some slight modifications.
#!/bin/sh
# Init script for couchdb
# Maintained by
# Generated by pleaserun.
# Implemented based on LSB Core 3.1:
# * Sections: 20.2, 20.3
#
### BEGIN INIT INFO
# Provides: couchdb
# Required-Start: $remote_fs $syslog
[ansible]
name=Ansible
baseurl=http://{{ deployment_node_ip }}/rpms
enabled=1
gpgcheck=0
---
- name: install HAProxy
shell: yum install -y haproxy --disablerepo=* --enablerepo=ansible
- name: customize HAProxy to serve HTTP traffic to the designated downstream servers
template: src=haproxy.cfg.j2 dest=/etc/haproxy/haproxy.cfg owner=haproxy group=haproxy
notify: restart_haproxy
- name: ensure HAProxy is started and enabled at boot time
service: name=haproxy state=started enabled=yes
---
- name: cache the rpms required to install HAProxy
shell: repotrack -p {{ rpms_root }} haproxy
@kafecho
kafecho / mse.scala
Last active August 29, 2015 14:14
1st attempt at a ScalaJS / Media Source Extensions demo
/**
* Work in progress....
* Let's try to port Eric Bidelman's demo (http://html5-demos.appspot.com/static/media-source.html) to ScalaJS.
* This is mostly a learning exercise.
* Only tested on Google Chrome (on OS X Yosemite).
*/
package tutorial.webapp
import scala.scalajs.js.JSApp
@kafecho
kafecho / installcouchdb.ps1
Created January 8, 2015 07:46
Prototype Ansible playbook to install CouchDB and Silverlight on Windows nodes.
$p = Start-Process -FilePath "C:\Users\Guillaume\couchdb.exe" -ArgumentList "/VerySilent /CLOSEAPPLICATIONS /Log=C:\couchdb.txt" -Wait -PassThru
$p.WaitForExit()
if ($p.ExitCode -ne 0) {
throw "failed"
}
@kafecho
kafecho / local.ini
Created January 5, 2015 10:18
local.ini to customise the installation of CouchDB on a Windows server via Ansible.
[httpd]
bind_address = 0.0.0.0
@kafecho
kafecho / SdpParser.scala
Created September 5, 2014 16:47
Initial work on Scala parser combinators for reading sdp (session description protocol) files.
package org.kafecho.learning.parser
import scala.util.parsing.combinator.RegexParsers
import java.net.URI
sealed trait SdpValue
sealed trait Username
case class UserLogin(login: String) extends Username
case object UserIdsNotSupported extends Username
@kafecho
kafecho / gist:2ba793c53f1c0cb15eca
Created July 8, 2014 17:50
Ansible playbook to install CouchDB from source on CentOS 6.5
---
- hosts: cd-servers
gather_facts: no
sudo: true
user: deploy
tasks:
- name: Install Couchdb dependencies
yum: name={{ item }} state=installed
with_items:
- autoconf