Skip to content

Instantly share code, notes, and snippets.

View muresan's full-sized avatar

Catalin Muresan muresan

  • Broadwing
  • Scotland
View GitHub Profile
@muresan
muresan / iam-policy.tf
Last active November 1, 2017 14:21
Use metadataproxy in docker swarm.
resource "aws_iam_policy" "iam-getrole" {
name = "iam-getrole"
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "iam:GetRole",
"Resource": "*"
# ENSURE:
# - 2x EFS are created, one regular one maxio (maximum flexibility)
# - Ensure the security groups attached to the EFSs are allowing NFS access
# - Ensure that nfs-utils / nfs-common is installed on the machines
# - Test prior that you can mount the filesystems using the commands from the EFS UI
# grab docker version for plugin install reasons
DOCKER_VERSION=`docker version -f "{{ .Server.Version }}"`
# create an EFS General Purpose
EFS_ID_REGULAR=fs-00000001
version: '3.3'
services:
kafka1:
image: confluentinc/cp-kafka
environment:
- KAFKA_BROKER_ID=1
- KAFKA_ZOOKEEPER_CONNECT=zookeeper1:2181
- KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://localhost:9092
deploy:
rancher:
services_include:
ubuntu-console: true
services:
iptables:
image: busybox
net: host
uts: host
pid: host
ipc: host
version: '3.1'
services:
helloworld:
image: muresan/node-helloworld:${TAG:-1.0}
deploy:
labels:
traefik.port: "3000"
traefik.protocol: "http"
traefik.backend.loadbalancer.sticky: "true"
@muresan
muresan / raw_stuff
Last active September 11, 2017 15:59
raw in go and jinja2 templates
SYSLOG_TAG: '{{ `{{ index .Container.Config.Labels "com.docker.swarm.service.name" }}` }}'
shell: docker node ls --format {% raw %} '{{.ID}} {{.Status}}' {% endraw %} | grep Down | sed 's/.Down$//' | xargs --no-run-if-empty docker node rm
#!/bin/sh
jq -R -s '{"value":.}'
@muresan
muresan / es-notmine.yml
Last active March 9, 2019 20:46
ES stack, more an example to YAML anchors
version: '3.2'
services:
elasticsearch1: &elasticsearch
image: cbb/elasticsearch:5.5.0
environment: &environment
ES_JAVA_OPTS: '-Xms256m -Xmx256m'
cluster.name: es-cluster
node.name: es1
network.bind_host: 0.0.0.0
discovery.zen.minimum_master_nodes: 2
# System default settings live in /usr/lib/sysctl.d/00-system.conf.
# To override those settings, enter new settings here, or in an /etc/sysctl.d/<name>.conf file
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
# Increase size of file handles and inode cache
fs.file-max = 2097152
# Do less swapping
vm.swappiness = 10
SWARM_SERVICE_ID: "{{.Service.ID}}"
SWARM_SERVICE_NAME: "{{.Service.Name}}"
SWARM_SERVICE_LABELS: "{{.Service.Labels}}"
SWARM_NODE_ID: "{{.Node.ID}}"
SWARM_TASK_ID: "{{.Task.ID}}"
SWARM_TASK_NAME: "{{.Task.Name}}"
SWARM_TASK_SLOT: "{{.Task.Slot}}"
replicas: 3
SWARM_NODE_ID='t3ybd0tf3p7ycpscp4wuuaktk'