Skip to content

Instantly share code, notes, and snippets.

@taweechai-scg
taweechai-scg / elasticsearch-snapshot-restore-s3.md
Created June 28, 2024 03:36 — forked from ruanbekker/elasticsearch-snapshot-restore-s3.md
Elasticsearch Snapshot and Restore Guide on S3

Snapshot and Restore with Elasticsearch:

This is a quick guide on how to make snapshots to s3 and how to restore from them on Elasticsearch

View Snapshots:

$ curl -XGET 'https://search-domain-name.eu-west-1.es.amazonaws.com/_cat/snapshots/index-backups?v&s=id'
id                                      status start_epoch start_time end_epoch  end_time duration indices successful_shards failed_shards total_shards
ruan-test-2018-05                      SUCCESS 1527253459  06:04:19   1527253460 06:04:20       1s       1                 5             0            5
@taweechai-scg
taweechai-scg / docker-compose-backup.sh
Created August 25, 2022 12:11 — forked from pirate/docker-compose-backup.sh
Backup a docker-compose project, including all images, named and unnamed volumes, container filesystems, config, logs, and databases.
#!/usr/bin/env bash
### Bash Environment Setup
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
# https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
# set -o xtrace
set -o errexit
set -o errtrace
set -o nounset
set -o pipefail
@taweechai-scg
taweechai-scg / php-pools.md
Created February 4, 2022 04:57 — forked from holmberd/php-pools.md
Adjusting child processes for PHP-FPM (Nginx)

Adjusting child processes for PHP-FPM (Nginx)

When setting these options consider the following:

  • How long is your average request?
  • What is the maximum number of simultaneous visitors the site(s) get?
  • How much memory on average does each child process consume?

Determine if the max_children limit has been reached.

  • sudo grep max_children /var/log/php?.?-fpm.log.1 /var/log/php?.?-fpm.log
@taweechai-scg
taweechai-scg / docker_output.py
Created December 28, 2021 17:11 — forked from oseme-techguy/docker_output.py
Docker Python logger output to stdout
import logging
from sys import stdout
# Define logger
logger = logging.getLogger('mylogger')
logger.setLevel(logging.DEBUG) # set logger level
logFormatter = logging.Formatter\
("%(name)-12s %(asctime)s %(levelname)-8s %(filename)s:%(funcName)s %(message)s")
consoleHandler = logging.StreamHandler(stdout) #set streamhandler to stdout
@taweechai-scg
taweechai-scg / libsodium.md
Created November 10, 2021 02:10 — forked from dgoguerra/libsodium.md
Install libsodium in PHP 7
@taweechai-scg
taweechai-scg / config.env
Created August 17, 2021 12:33 — forked from ZachtimusPrime/config.env
AWS MSK Cluster Rolling Reboot
# fake credentials file role name, replace with your own
DEV_AWS_PROFILE="dev.role"
DEV_AWS_REGION="us-east-1"
# fake broker hostnames, fill this out for your cluster
DEV_CLUSTER=("b-1.kafka-cluster.123.123.kafka.us-east-1.amazonaws.com" "b-2.kafka-cluster.123.123.kafka.us-east-1.amazonaws.com")
# fake cluster arn, fill this out for your cluster
DEV_CLUSTER_ARN="arn:aws:kafka:us-east-1:123:cluster/kafka-cluster-dev/123-123-123-123-123-123"
UAT_AWS_PROFILE="uat.role"
UAT_AWS_REGION="us-east-1"
UAT_CLUSTER=()
@taweechai-scg
taweechai-scg / install-docker.md
Created August 6, 2021 09:36 — forked from npearce/install-docker.md
Amazon Linux 2 - install docker & docker-compose using 'sudo amazon-linux-extras' command

UPDATE (March 2020, thanks @ic): I don't know the exact AMI version but yum install docker now works on the latest Amazon Linux 2. The instructions below may still be relevant depending on the vintage AMI you are using.

Amazon changed the install in Linux 2. One no-longer using 'yum' See: https://aws.amazon.com/amazon-linux-2/release-notes/

Docker CE Install

sudo amazon-linux-extras install docker
sudo service docker start