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
import * as admin from "firebase-admin"; | |
import * as functions from "firebase-functions"; | |
import * as fs from "fs"; | |
import sharp from "sharp"; | |
export const resizeImage = functions.storage | |
.object() | |
.onFinalize(async (object) => { | |
const bucket = admin.storage().bucket(object.bucket); | |
const filePath = object.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
import json | |
from nameko.web.handlers import http | |
from nameko_grpc.dependency_provider import GrpcProxy | |
from products.products_pb2 import GetProduct | |
from products.products_pb2_grpc import productsStub | |
class ClientService: |
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
syntax = "proto3"; | |
package products; | |
service products { | |
rpc get_product(GetProduct) returns (Product); | |
} | |
message Product { | |
int32 id = 1; |
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
from nameko_grpc.entrypoint import Grpc | |
from products import dependencies | |
from products.products_pb2 import Product | |
from products.products_pb2_grpc import productsStub | |
grpc = Grpc.implementing(productsStub) | |
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 { events, Job } = require('brigadier'); | |
const kubernetes = require('@kubernetes/client-node'); | |
const process = require('process'); | |
const yaml = require('js-yaml'); | |
const fetch = require('node-fetch'); | |
const k8sClient = kubernetes.Config.defaultClient(); | |
const BRIGADE_NAMESPACE = 'brigade'; | |
const PROJECT_NAME = 'products'; |
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 kubernetes = require('@kubernetes/client-node'); | |
const yaml = require('js-yaml'); | |
const ulid = require('ulid'); | |
const crypto = require('crypto'); | |
const k8sClient = kubernetes.Config.defaultClient(); | |
const BRIGADE_NAMESPACE = 'brigade'; | |
const GITHUB_API_URL = 'https://api.github.com/repos'; | |
const deployProjects = async (environmentName) => { |
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 { Job, Group } = require('brigadier'); | |
const deployDependencies = async (namespace) => { | |
const postgresql = new Job('postgresql', 'jakubborys/ditc-brigade-worker:latest'); | |
postgresql.storage.enabled = false; | |
postgresql.imageForcePull = true; | |
postgresql.tasks = [ | |
'cd /src', | |
`helm upgrade ${namespace}-postgresql charts/postgresql \ | |
--install --namespace=${namespace} \ |
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 kubernetes = require('@kubernetes/client-node'); | |
const yaml = require('js-yaml'); | |
const k8sClient = kubernetes.Config.defaultClient(); | |
const BRIGADE_NAMESPACE = 'brigade'; | |
const createEnvironmentConfigMap = async (name, projects) => { | |
const configMap = new kubernetes.V1ConfigMap(); | |
const metadata = new kubernetes.V1ObjectMeta(); | |
metadata.name = `environment-config-${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
const kubernetes = require('@kubernetes/client-node'); | |
const k8sClient = kubernetes.Config.defaultClient(); | |
const createNamespace = async (namespaceName) => { | |
const existingNamespace = await k8sClient.listNamespace( | |
true, '', `metadata.name=${namespaceName}`, | |
); | |
if (existingNamespace.body.items.length) { | |
console.log(`Namespace "${namespaceName}" already exists`); | |
return; |
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
install: | |
pip install -r requirements.txt | |
run_client: | |
nameko run services:ClientService --config config_client.yaml | |
run_server: | |
nameko run services:ServerService --config config_server.yaml | |
run: |
NewerOlder