Skip to content

Instantly share code, notes, and snippets.

View mayorova's full-sized avatar

Daria Mayorova mayorova

  • Red Hat
  • Barcelona
View GitHub Profile
@mayorova
mayorova / README.md
Last active June 14, 2018 10:59
Deploy 3scale AMP on Amazon EC2

Deploy 3scale AMP on Amazon EC2

This is an easy way to deploy a simple 3scale AMP setup using oc cluster up. Note: This should only be used for development and testing, do not ever use it in production environments.

You will need:

  • a running instance with 8GB RAM minimum (recommended 16GB) and RHEL
@mayorova
mayorova / README.md
Created August 10, 2017 14:44
Mutual SSL in NGINX

Securing traffic to upstream servers with client certificates

Info: https://www.nginx.com/resources/admin-guide/nginx-https-upstreams/

Creating and Signing Your Certs

Source: http://nategood.com/client-side-certificate-authentication-in-ngi

This is SSL, so you'll need an cert-key pair for you/the server, the api users/the client and a CA pair. You will be the CA in this case (usually a role played by VeriSign, thawte, GoDaddy, etc.), signing your client's certs. There are plenty of tutorials out there on creating and signing certificates, so I'll leave the details on this to someone else and just quickly show a sample here to give a complete tutorial. NOTE: This is just a quick sample of creating certs and not intended for production.

@mayorova
mayorova / README.md
Last active October 14, 2019 07:48
Mutual SSL with APIcast

Mutual SSL with APIcast

This document describes the steps to enable mutual SSL in APIcast. The instructions are provided for Docker and OpenShift.

Note: this approach will only work in APIcast v3.1.0-rc1 and later.

Prerequisites

  • client certificates
  • API backend that accepts client certificates
@mayorova
mayorova / host.t
Last active April 13, 2018 12:42
Host header in OpenResty
use Test::Nginx::Socket::Lua 'no_plan';
run_tests();
__DATA__
=== TEST 1: failing test
--- config
resolver 1.1.1.1;
location = /t {
@mayorova
mayorova / 3322071.md
Created April 17, 2018 09:59
3scale billing on application plan change

The behavior depends on several factors:

  • the mode of Billing: Prepaid or Postpaid
  • when the plan change is made

Prepaid billing

1. If the application plan is changed on the same day as is it was created, and so it has never been invoiced before, the fixed costs for the old plan are included to the invoice, and are discounted with a 'Refund' line item. The fixed costs for the old plan are also added to the invoice.

Example.

@mayorova
mayorova / README.md
Last active June 20, 2018 14:52
Running apisonator locally

Here are the steps to get apisonator (opensource project for 3scale backend) run locally, which can be useful for testing.

The image can be either built manually from the GitHub source, or there is an image available on quay.io.

The attached file starts redis, backend worker and backend listener.

In theory it could be possible to start APIcast with the same docker-compose file, but there is some issue with the resolver - it doesn't pick up the services hostnames that docker-compose resolves normally (i.e. I couldn't use http://listener:3000 from APIcast). So, I am starting APIcast locally.

Steps:

@mayorova
mayorova / install.sh
Last active February 19, 2019 13:20
Install APIcast v3.2.0 on RHEL 7.5
# Switch to root
sudo -i
# Install dependencies
yum install -y yum-utils gcc git
# Enable OpenResty repo (see RHEL section at https://openresty.org/en/linux-packages.html)
yum-config-manager --add-repo https://openresty.org/package/rhel/openresty.repo
# Enable EPEL packages (needed for LuaRocks)
@mayorova
mayorova / log
Created June 13, 2018 15:19
make busted log
$ make busted
lua_modules/bin/rover exec bin/busted
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●◌●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●◌●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
527 successes / 0 failures / 25 errors / 2 pending : 14.675192 seconds
Pending → spec/policy/rate_limit/redis_shdict_spec.lua @ 33
Redis Shared Dictionary incr without default
Pending → spec/resty/http_ng_spec.lua @ 35
http_ng options method works with default options
@mayorova
mayorova / Diagnostic steps.md
Last active May 31, 2021 16:56
How to configure reCAPTCHA in 3scale on-premises

The error logs in the system-developer container on the system-app pod show the following error:

ActionView::Template::Error (No site key specified.):
@mayorova
mayorova / Dockerfile
Last active July 31, 2021 02:50
Run APIcast native on Centos 7
FROM centos:7
# Install dependencies
RUN yum install -y yum-utils gcc git
# Enable OpenResty repo (see RHEL section at https://openresty.org/en/linux-packages.html)
RUN yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo
# Enable EPEL packages (needed for LuaRocks)
RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm