Skip to content

Instantly share code, notes, and snippets.

View MeixnerTobias's full-sized avatar
🎯
Focusing

Tobias Meixner MeixnerTobias

🎯
Focusing
View GitHub Profile
type Query {
myEvents: [Event] @auth(role:"event.owner")
searchEvents: [Event] @myElasticCluster(index:"allEvents")
upcomingEvents: [Event] @dynamoDB(index:"upcoming")
pastEvents: [Event] @cacheControl(maxAge: 60000) @myLongTermStorage(index:"past")
# Other fields, etc
}
input EventInput {
name: String!
coverImage: Upload @s3(bucketName:"events")
type Query {
upcomingEvents: [Event]
pastEvents: [Event]
# Other fields, etc
}
input EventInput {
name: String!
}
type Mutation {
createEvent(input:EventInput!): Event
@MeixnerTobias
MeixnerTobias / index.ts
Created June 30, 2018 10:52
DynamoDBCache for Apollo Server 2
import { KeyValueCache } from 'apollo-server-caching';
// TODO add option for DAX here
// import AmazonDaxClient = require('aws-sdk/clients/dax');
import DynamoDB = require('aws-sdk/clients/dynamodb');
import { ServiceConfigurationOptions } from 'aws-sdk/lib/service';
export class DynamoDBCache implements KeyValueCache {
readonly client;
readonly tableOptions;
@MeixnerTobias
MeixnerTobias / handler.js
Created June 23, 2018 06:01
AWS Lambda handler for serverless-apollo-datasource-redis
import 'babel-polyfill';
const { ApolloServer, gql } = require('apollo-server-lambda');
const { RedisCache } = require('apollo-server-redis');
const { RESTDataSource } = require('apollo-datasource-rest');
const AWSXRay = require('aws-xray-sdk');
const AWS = AWSXRay.captureAWS(require('aws-sdk'));
class NYTIMESAPI extends RESTDataSource {
baseURL = ' https://api.nytimes.com/svc/search/v2/articlesearch.json';
@MeixnerTobias
MeixnerTobias / serverless.yml
Created June 23, 2018 05:58
Serverless config for serverless-apollo-datasource-redis
service: serverless-apollo-datasource-redis
frameworkVersion: ">=1.21.0 <2.0.0"
provider:
profile: ${opt:stage}
name: aws
runtime: nodejs8.10
stage: ${opt:stage}
region: ${opt:region}
@MeixnerTobias
MeixnerTobias / gist:b1bd8f0dc0f6284b3cea28966b22782e
Created June 27, 2017 07:58
Dump local dynamodb tables start with staging
python dynamodump.py -m backup -r local -s "staging*" --host localhost --port 8000 --dumpPath tablebackups --schemaOnly
@MeixnerTobias
MeixnerTobias / config.toml
Created August 14, 2016 19:05
Gitlab Runner Configuration - ~/.gitlab-runner/config.toml
concurrent = 1
check_interval = 0
[[runners]]
name = "Fun with EB CI sample in EC2"
url = "https://gitlab.com/ci"
token = "XXXXXXXXXXXXXX"
executor = "docker"
[runners.docker]
tls_verify = false
@MeixnerTobias
MeixnerTobias / apachesetup.config
Created August 14, 2016 18:54
Apache customization for EC2 provisioning in Elastic Beanstalk .ebextensions\apachesetup.config
files:
"/etc/httpd/conf.d/apache_custom_values.conf" :
mode: "000644"
owner: root
group: root
content: |
LoadModule rewrite_module modules/mod_rewrite.so
@MeixnerTobias
MeixnerTobias / config.yml
Created August 14, 2016 18:53
Elastic Beanstalk Configuration .elasticbeanstalk\config.yml
branch-defaults:
master:
environment: funwitheb-production
global:
application_name: funwitheb
default_ec2_keyname: funwitheb-ci
default_platform: 64bit Amazon Linux 2016.03 v2.1.5 running PHP 7.0
default_region: ap-southeast-1
profile: eb-cli
sc: git
@MeixnerTobias
MeixnerTobias / install-gitlab-runner.sh
Created August 14, 2016 18:52
Install Gitlab Runner
curl -sSL https://get.docker.com/ | sh
sudo usermod -aG docker ec2-user
curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-ci-multi-runner/script.rpm.sh | sudo bash
sudo yum install gitlab-ci-multi-runner
gitlab-ci-multi-runner register