Skip to content

Instantly share code, notes, and snippets.

View AhmedELShafaie's full-sized avatar
🎯
Focusing

Ahmed AhmedELShafaie

🎯
Focusing
View GitHub Profile
@AhmedELShafaie
AhmedELShafaie / cloud-init.yaml
Created May 29, 2022 07:06 — forked from vtrifonov-esfiddle/cloud-init.yaml
cloud-init config for ubuntu host with docker & docker-compose
#cloud-config
groups:
- docker
users:
- default
# the docker service account
- name: docker-service
groups: docker
package_upgrade: true
packages:
image: creatiwww/docker-compose:latest
services:
- docker:dind
variables:
STAGE_SERVER_IP: 10.10.10.1
PROD_SERVER_IP: 10.10.10.2
STAGE_SERVER_USER: gitlab
PROD_SERVER_USER: gitlab
# Read more about setting it up
# https://medium.com/@ljmocic/deploying-react-application-to-aws-s3-using-github-actions-85addacaeace
on:
push:
tags:
- '*'
jobs:
build:
@AhmedELShafaie
AhmedELShafaie / bucket.json
Created May 19, 2021 01:07 — forked from AwsGeek/bucket.json
Setting up a Static Website on S3
{
"Version":"2012-10-17",
"Statement":[{
"Sid":"PublicReadForGetBucketObjects",
"Effect":"Allow",
"Principal": "*",
"Action":["s3:GetObject"],
"Resource":["arn:aws:s3:::www.aws-today.com/*"]
}]
}
Recording Rule Example 1
================================
# Aggregating up requests per second that has a path label:
- record: instance_path:requests:rate5m
expr: rate(requests_total{job="myjob"}[5m])
- record: path:requests:rate5m
expr: sum without (instance)(instance_path:requests:rate5m{job="myjob"})
Recording Rule Example 2
@AhmedELShafaie
AhmedELShafaie / wordpress_com_nginx_proxy_to_subpath.md
Created October 20, 2020 23:49 — forked from bzamecnik/wordpress_com_nginx_proxy_to_subpath.md
Nginx proxy for Wordpress.com on custom domain with subpath.
@AhmedELShafaie
AhmedELShafaie / main.yaml
Created October 4, 2020 12:12 — forked from kbariotis/main.yaml
Ansible playbook for deploying a Node.js app to DigitalOcean
- name: DO
hosts: localhost
vars:
project_name: "PUT A NAME FOR YOUR PROJECT HERE"
do_token: "PUT YOUR DIGITAL OCEAN API KEY HERE ==> https://cloud.digitalocean.com/settings/api/tokens"
repository: "PUT YOUR REPOSITORY URL HERE"
tasks:
- name: LOCAL | Generate SSH key
shell: ssh-keygen -b 2048 -t rsa -f ~/.ssh/{{project_name}} -q -N ""
@AhmedELShafaie
AhmedELShafaie / deploy_CI.sh
Created September 28, 2020 14:51 — forked from strund3r/deploy_CI.sh
Deploy script for CI/CD (Docker 4 AWS)
#!/bin/bash
set -eo pipefail
############################ VARIABLES ############################
# ssh key's location #
ssh_key="/home/circleci/example/example.pem" #
# docker-compose for metrics #
metrics="/home/circleci/example/<metrics-docker-compose>.yml" #
# sleep time #
@AhmedELShafaie
AhmedELShafaie / example.com
Created July 27, 2020 20:41 — forked from 1hakr/example.com
Supercharge your NGIX config
proxy_cache_path /tmp/cacheapi levels=1:2 keys_zone=microcacheapi:100m max_size=1g inactive=1d use_temp_path=off;
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name example.com;
location /api/ {
# Rate Limiting
limit_req zone=reqlimit burst=20; # Max burst of request
@AhmedELShafaie
AhmedELShafaie / nginx-tuning.md
Created July 27, 2020 20:23 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.