This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//addresses of available kafka brokers | |
brokers := []string{'localhost:9201'} | |
//setup relevant config info | |
config := sarama.NewConfig() | |
config.Producer.Partitioner = sarama.NewRandomPartitioner | |
config.Producer.RequiredAcks = sarama.WaitForAll | |
producer, err := sarama.NewSyncProducer(brokers, config) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
topic := "kafka-topic-for-the-message" //e.g create-user-topic | |
partition := -1 //Partition to produce to | |
msg := "actual information to save on kafka" //e.g {"name":"John Doe", "email":"[email protected]"} | |
message := &sarama.ProducerMessage{ | |
Topic: topic, | |
Partition: partition, | |
Value: sarama.StringEncoder(msg), | |
} | |
partition, offset, err := producer.SendMessage(message) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//addresses of available kafka brokers | |
brokers := []string{'localhost:9201'} | |
consumer, err := sarama.NewConsumer(brokers, nil) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
topic := "topic-to-subscribe-to" //e.g. user-created-topic | |
partitionList := consumer.Partitions(topic) //get all partitions | |
messages := make(chan *sarama.ConsumerMessage, 256) | |
initialOffset := sarama.OffsetOldest //offset to start reading message from | |
for _, partition := range partitionList { | |
pc, _ := consumer.ConsumePartition(topic, partition, initialOffset) | |
go func(pc sarama.PartitionConsumer) { | |
for message := range pc.Messages() { | |
messages <- message //or call a function that writes to disk | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
applications: | |
- path: . | |
memory: 256M | |
instances: 1 | |
domain: eu-gb.mybluemix.net | |
name: bluemix-blog | |
host: bluemix-blog | |
disk_quota: 1024M | |
command: rake db:migrate && bin/rails server -p $PORT -e $RAILS_ENV | |
services: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "http/client" | |
require "./simple-auth/*" | |
module Simple::Auth | |
macro default_layout_view_for(view) | |
render "src/views/#{{{view}}}.ecr", "src/views/layouts/default.ecr" | |
end | |
get "/" do | |
default_layout_view_for "index" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: extensions/v1beta1 | |
kind: Ingress | |
metadata: | |
name: simple-auth-ingress | |
spec: | |
backend: | |
serviceName: default-http-backend | |
servicePort: 80 | |
rules: | |
- host: simple-auth.me |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: extensions/v1beta1 | |
kind: Ingress | |
metadata: | |
name: ingress-tutorial | |
annotations: | |
nginx.ingress.kubernetes.io/rewrite-target: / | |
spec: | |
backend: | |
serviceName: default-http-backend | |
servicePort: 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '2' | |
services: | |
feature_tests: | |
image: project/image:ci | |
container_name: features_tests | |
command: bash -c "service postgresql start; sleep 1m; xvfb-run -a rspec spec/features" | |
controller_tests: | |
image: project/image:ci | |
container_name: controller_tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
machine: | |
pre: | |
- curl -sSL https://s3.amazonaws.com/circle-downloads/install-circleci-docker.sh | bash -s -- 1.10.0 | |
services: | |
- docker | |
dependencies: | |
override: | |
- sudo pip install --upgrade docker-compose | |
- docker build --rm=false -t project/image:ci . | |
database: |
OlderNewer