Skip to content

Instantly share code, notes, and snippets.

@uorat
uorat / nginx-websocket-proxy.conf
Last active February 11, 2023 16:04
Nginx Reverse Proxy for WebSocket
upstream websocket {
server localhost:3000;
}
server {
listen 80;
server_name localhost;
access_log /var/log/nginx/websocket.access.log main;
@uorat
uorat / haproxy.aurora.endpoints.cfg
Created December 1, 2017 05:50
HAProxy configuration file with Aurora endpoints
global
log 127.0.0.1 local2
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 4096
user haproxy
group haproxy
daemon
stats socket /var/lib/haproxy/stats user root group root level admin
@uorat
uorat / haproxy.cfg
Created May 29, 2016 08:33
HAProxy configuration sample with resolvers options
global
log 127.0.0.1 local2
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 4096
user haproxy
group haproxy
daemon
stats socket /var/lib/haproxy/stats
@uorat
uorat / ansible_nginx.yml
Created September 17, 2016 08:13
Ansible Playbook for installing Nginx
---
########################################
## Ansible Playbook for installing Nginx
########################################
- name: check registered the repository of nginx-release
shell: rpm -qa | grep nginx-release
register: result
ignore_errors: True
# 1. 継続利用する Node Endpoint read1 - 3 の weight を 1 にする
ansible -m 'shell' -i production haproxy -s -a'echo "set weight mysql/reader1 1" | sudo socat stdio /var/lib/haproxy/stats'
ansible -m 'shell' -i production haproxy -s -a'echo "set weight mysql/reader2 1" | sudo socat stdio /var/lib/haproxy/stats'
ansible -m 'shell' -i production haproxy -s -a'echo "set weight mysql/reader3 1" | sudo socat stdio /var/lib/haproxy/stats'
# 2. Reader Endpoint 経由でクエリが流れないように Reader Endpoint の weight を 0 にする
ansible -m 'shell' -i production haproxy -s -a'echo "set weight mysql/reader 0" | sudo socat stdio /var/lib/haproxy/stats'
@uorat
uorat / hello-apex-inspect-path-main.py
Created August 31, 2017 05:29
hello-apex/functions/python-sample/main.py
from __future__ import print_function
import sys
import os
import logging
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def handle(event, context):
logger.info("$ENV: " + str(os.environ))
@uorat
uorat / hello-apex-pip-site-package-functions.json
Created August 31, 2017 05:26
hello-apex/functions/helloworld-python/functions.json
{
"runtime": "python3.6",
"hooks": {
"build": "pip install -r requirements.txt -t ./site-packages"
},
"environment": {
"PYTHONPATH": "/var/runtime:/var/task/site-packages"
}
}
@uorat
uorat / hello-apex-pip-requirements.txt
Last active August 31, 2017 05:24
hello-apex/functions/helloworld-python/requirements.txt
requests==2.18.2
@uorat
uorat / hello-apex-pip-function.json
Created August 31, 2017 05:22
hello-apex/functions/helloworld-python/functions.json
{
"runtime": "python3.6",
"hooks": {
"build": "pip install -r requirements.txt -t ."
}
}
@uorat
uorat / hello-apex-golang-sample-function.json
Last active August 31, 2017 05:20
hello-apex/functions/golang-sample/function.json
{
"hooks": {
"build": "GOOS=linux GOARCH=amd64 go build -o main main.go",
"clean": "rm -f main"
}
}