Skip to content

Instantly share code, notes, and snippets.

View stefanorg's full-sized avatar

Stefano stefanorg

View GitHub Profile
@stefanorg
stefanorg / aws-ecs-deploy-permissions.md
Created July 14, 2019 10:24 — forked from duluca/aws-ecs-deploy-permissions.md
npm scripts for AWS ECS (Blue-Green Deployment)

AWS ECS Deploy Permissions

In order to be able to deploy using the scripts provided by npm scripts for AWS ECS make sure your user is part of an IAM Group that has the following inline policy applied to it.

Note: This may not be complete.

{
    "Version": "2012-10-17",
    "Statement": [
@stefanorg
stefanorg / wildfly-9.0.2.Final-standalone-full-ha.cli
Created June 21, 2019 07:17 — forked from cheinema/wildfly-9.0.2.Final-standalone-full-ha.cli
WildFly CLI scripts to build the default configurations
embed-server --server-config=custom-full-ha.xml --empty-config --remove-existing
# Extensions first
batch
/extension=org.jboss.as.clustering.infinispan:add
/extension=org.jboss.as.clustering.jgroups:add
/extension=org.jboss.as.connector:add
/extension=org.jboss.as.deployment-scanner:add
/extension=org.jboss.as.ee:add
/extension=org.jboss.as.ejb3:add
/extension=org.jboss.as.jaxrs:add
@stefanorg
stefanorg / S3-Static-Sites.md
Created May 5, 2019 13:35 — forked from bradwestfall/S3-Static-Sites.md
Use S3 and CloudFront to host Static Single Page Apps (SPAs) with HTTPs and www-redirects. Also covers deployments.

S3 Static Sites

What this will cover

  • Host a static website at S3
  • Redirect www.website.com to website.com
  • Website can be an SPA (requiring all requests to return index.html)
  • Free AWS SSL certs
  • Deployment with CDN invalidation

Resources

@stefanorg
stefanorg / network-stack.ts
Created April 28, 2019 05:45 — forked from jewelsjacobs/network-stack.ts
CDK VPC Subnets with CIDR Addresses
import cdk = require('@aws-cdk/cdk');
import ec2 = require('@aws-cdk/aws-ec2');
import { SubnetType } from '@aws-cdk/aws-ec2';
const region = 'us-east';
const azA = `${region}-1a`;
const azB = `${region}-1b`;
const azC = `${region}-1c`;
const availabilityZones = [azA, azB, azC];
const publicCidrs = ['10.1.192.0/24', '10.1.194.0/24', '10.1.196.0/24']
@stefanorg
stefanorg / api.js
Created March 12, 2019 06:07 — forked from giacomocerquone/api.js
Api service
const makeCancelable = promise => {
let hasCanceled = false;
const wrappedPromise = new Promise((resolve, reject) => {
promise.then(
val => (hasCanceled ? reject(Error('Request canceled')) : resolve(val)),
error =>
hasCanceled ? reject(Error('Request canceled')) : reject(error),
);
});
@stefanorg
stefanorg / .gitlab-ci.yml
Created October 10, 2018 15:17 — forked from jlis/.gitlab-ci.yml
AWS ECS and ECR deployment via Docker and Gitlab CI
image: docker:latest
variables:
REPOSITORY_URL: <AWS ACCOUNT ID>.dkr.ecr.eu-central-1.amazonaws.com/<ECS REPOSITORY NAME>
REGION: eu-central-1
TASK_DEFINTION_NAME: <TASK DEFINITION NAME>
CLUSTER_NAME: <CLUSTER NAME>
SERVICE_NAME: <SERVICE NAME>
services:
@stefanorg
stefanorg / ResponseTimeLogger.java
Created September 29, 2017 20:46 — forked from erard22/ResponseTimeLogger.java
An interceptor logging the response time and additional information of a REST call to a Resteasy resource
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Context;
import javax.ws.rs.ext.Provider;
import org.jboss.resteasy.annotations.interception.ServerInterceptor;
import org.jboss.resteasy.core.ResourceMethod;
import org.jboss.resteasy.core.ServerResponse;
import org.jboss.resteasy.spi.Failure;
import org.jboss.resteasy.spi.HttpRequest;
@stefanorg
stefanorg / INSTALL.rst
Created January 17, 2017 06:56 — forked from jensens/INSTALL.rst
sentry setup with docker-compose

In order to run this image do: docker-compose up -d to get all up. On first run DB initialization and initial user setup is done like so:

First start a bash in the container: docker-compose exec sentry /bin/bash. Then, inside bash, do sentry upgrade wait until it asks you for an inital user. When finished exit the bash.

When in doubt check with docker-compose ps if all went fine.

@stefanorg
stefanorg / letsencrypt-example.com.sh
Created January 10, 2017 09:38
letsencrypt cert auto renewal example
***************************************
* /usr/bin/letsencrypt-example.com.sh *
* rif: https://community.letsencrypt.org/t/multiple-domains-webroot-paths-using-webroot-plugin/7982/5
***************************************
# Settings
DOMAIN=example.com
TIMESTAMP=$(date +"%F %T")
# Execute