Skip to content

Instantly share code, notes, and snippets.

@brygom
brygom / centos.install.boost.md
Created June 11, 2018 15:46 — forked from 1duo/centos.install.boost.md
Install Boost library from source on CentOS 7.
wget https://cfhcable.dl.sourceforge.net/project/boost/boost/1.54.0/boost_1_54_0.tar.gz
wget https://phoenixnap.dl.sourceforge.net/project/boost/boost/1.58.0/boost_1_58_0.tar.gz
wget https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.gz
wget https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.tar.gz
  • Unzip
@brygom
brygom / haproxy.cfg.tmpl
Last active November 11, 2018 20:19
haproxy template
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
daemon
maxconn 100
@brygom
brygom / pg-1.yml
Last active November 5, 2018 21:21
Patroni postgresql node 1
scope: my-ha-cluster
name: pg-1
restapi:
listen: 0.0.0.0:8008
connect_address: 127.0.0.1:8008
etcd:
host: 127.0.0.1:2379
@brygom
brygom / pg-2.yml
Last active November 8, 2018 18:41
scope: my-ha-cluster
name: pg-2
restapi:
listen: 0.0.0.0:8008
connect_address: 127.0.0.1:8008
etcd:
host: 127.0.0.1:2379
@brygom
brygom / haproxy.toml
Last active November 11, 2018 20:14
teplate for haproxy
[template]
src = "haproxy.cfg.tmpl"
dest = "/etc/haproxy/haproxy.cfg"
keys = [
"/service",
]
reload_cmd = "echo restarting && service haproxy restart"
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# Where and how to store data.
storage:
dbPath: /var/lib/mongodb
journal:
enabled: true
#! /bin/sh
mongo -u mongo-admin -p admin --authenticationDatabase admin <<EOF
rs.initiate()
rs.add('mong_a:27017')
rs.add('mong_b:27017')
quit()
exit
#! /bin/sh
mongo <<EOF
rs.initiate()
{{range $service := ls "/mongo"}}
rs.add('{{.}}:27017')
{{end}}
quit()
exit
[template]
src = "mongo.tmpl"
dest = "/home/ubuntu/mongo_rep.sh"
keys = [
"/mongo",
]
reload_cmd = "echo update mongodb && sh /home/ubuntu/mongo_rep.sh"
@brygom
brygom / mongo-docker.bash
Created December 8, 2018 04:41 — forked from davideicardi/mongo-docker.bash
Running mongodb inside a docker container (with mongodb authentication)
# Create a container from the mongo image,
# run is as a daemon (-d), expose the port 27017 (-p),
# set it to auto start (--restart)
# and with mongo authentication (--auth)
# Image used is https://hub.docker.com/_/mongo/
docker pull mongo
docker run --name YOURCONTAINERNAME --restart=always -d -p 27017:27017 mongo mongod --auth
# Using the mongo "localhost exception" (https://docs.mongodb.org/v3.0/core/security-users/#localhost-exception)
# add a root user