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
const server = require('express')(); | |
const axios = require('axios'); | |
const createClient = require('../client'); | |
// very same thing as in databaseService.js | |
const serviceDefinition = { | |
name: 'anyService', | |
ipv4: '127.0.0.1', | |
port: 3001 | |
}; |
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
const server = require('express')(); | |
const axios = require('axios'); | |
const createClient = require('../client'); | |
// very same thing as in databaseService.js | |
const serviceDefinition = { | |
name: 'anyService', | |
ipv4: '127.0.0.1', | |
port: 3001 | |
}; |
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
const REGISTRY_PROTO_PATH = `${__dirname}/protos/registry.proto`; | |
// I personally prefer the promise syntax over | |
// the callback syntax | |
// nonetheless the functionality won't change at all if you go with callbacks | |
// but to actually turn the callback signature of those clients function into a promise based one | |
// we need a utility that is baked into node natively | |
// promisify | |
const { promisify } = require('util'); | |
const grpc = require('grpc'); |
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
// we create an express instance | |
// and we pull in the the function to create an gRPC client we defined before | |
const server = require('express')(); | |
const createClient = require('../client'); | |
// well.. this is on our localmachine | |
// hence we know for sure where what location this process has. | |
// in production you'd want to come up w/ something more flexible | |
const serviceDefinition = { | |
name: 'databaseService', |
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
// we need to tell the compiler which version we're using | |
syntax = "proto3"; | |
package registry; | |
// here we define the service and methods we're going to use later on | |
// to do the registration process | |
service Registry { | |
rpc Register (Registration) returns (RegisterResponse); | |
rpc Unregister (Registration) returns (RegisterResponse); |
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
// let's create a variable for the path of the .proto file | |
const REGISTRY_PROTO_PATH = `${__dirname}/protos/registry.proto`; | |
// import grpc and the loader | |
const grpc = require('grpc'); | |
const protoLoader = require('@grpc/proto-loader'); | |
// here we actually load the proto content | |
const packageDefinition = protoLoader.loadSync(REGISTRY_PROTO_PATH); | |
// and then we create the definition of it | |
// so that we can go ahead and use it | |
const { registry: registryProto } = grpc.loadPackageDefinition(packageDefinition); |
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
{ | |
"AWSEBDockerrunVersion": 2, | |
"containerDefinitions": [ | |
{ | |
"name": "nginx", | |
"image": "nginx", | |
"essential": true, | |
"memory": 128, | |
"portMappings": [ | |
{ |
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
# eb application # | |
resource "aws_elastic_beanstalk_application" "streaming_test" { | |
name = "streaming_test" | |
description = "This is the streaming test application" | |
} | |
# eb environment # | |
resource "aws_elastic_beanstalk_environment" "streaming_test_env" { | |
name = "streaming-test-env" | |
application = aws_elastic_beanstalk_application.streaming_test.name |
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
### BEGIN .ebextensions/logs.config | |
files: | |
"/etc/awslogs/config/stdout.conf": | |
mode: "000755" | |
owner: root | |
group: root | |
content: | | |
[docker-stdout] | |
log_group_name=/aws/elasticbeanstalk/StreamingTest-env/docker-stdout | |
log_stream_name={instance_id} |
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
#!/usr/bin/env bash | |
# This fetches the AWS CLI | |
# inflates it | |
# and sets location to the path | |
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" | |
unzip awscliv2.zip | |
sudo ./aws/install | |
# set the credentials to the default AWS CLI configuration file |
OlderNewer