MOVED
https://gist.github.com/superseb/c363247c879e96c982495daea1125276
data "template_file" "main" { | |
template = <<EOF | |
set -e | |
WORKDIR=/tmp/${uuid()} | |
mkdir -p "$WORKDIR" | |
cd "$WORKDIR" | |
curl -f "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip" | |
unzip awscli-bundle.zip | |
./awscli-bundle/install -i "$WORKDIR"/aws |
kind: Ingress | |
apiVersion: extensions/v1beta1 | |
metadata: | |
name: redirect-ingress | |
annotations: | |
ingress.kubernetes.io/configuration-snippet: | | |
if ($host ~ ^(.+)\.somedomain\.io$) { | |
return 301 https://$1.domain.io$request_uri; | |
} | |
spec: |
global | |
#debug | |
chroot /var/lib/haproxy | |
user haproxy | |
group haproxy | |
pidfile /var/run/haproxy.pid | |
# Default SSL material locations | |
ca-base /etc/ssl/certs | |
crt-base /etc/ssl/private |
// change your piwik server host | |
// change YOUR_SITE_ID with your site id | |
<amp-pixel src="https://piwik.example.org/piwik.php?idsite=YOUR_SITE_ID&rec=1&action_name=TITLE&urlref=DOCUMENT_REFERRER&url=CANONICAL_URL&rand=RANDOM"></amp-pixel> |
The MySQL slow query log is a difficult format to extract information from. After looking at various examples with mixed results, I realized that it's much easier to configure MySQL to write the slow query log to a table in CSV format!
From the MySQL documentation:
By default, the log tables use the CSV storage engine that writes data in comma-separated values format. For users who have access to the .CSV files that contain log table data, the files are easy to import into other programs such as spreadsheets that can process CSV input.
Note: don't forget to open up permissions on your slow query log CSV file so logstash can read it!
# enable slow query log
location ~* ^/s3/(.*) { | |
set $bucket '<REPLACE WITH YOUR S3 BUCKET NAME>'; | |
set $aws_access '<REPLACE WITH YOUR AWS ACCESS KEY>'; | |
set $aws_secret '<REPLACE WITH YOUR AWS SECRET KEY>'; | |
set $url_full "$1"; | |
set_by_lua $now "return ngx.cookie_time(ngx.time())"; | |
set $string_to_sign "$request_method\n\n\n\nx-amz-date:${now}\n/$bucket/$url_full"; | |
set_hmac_sha1 $aws_signature $aws_secret $string_to_sign; | |
set_encode_base64 $aws_signature $aws_signature; |
Includes:
--environment=production
)#Configure ssh key autologin: | |
ssh-copy-id -i ~/.ssh/id_rsa root@192.168.1.1 | |
uci set system.@system[0].hostname=gate | |
uci add_list sshd.@openssh[0].Port=2222 | |
uci add firewall rule | |
uci set firewall.@rule[-1].name=ssh | |
uci set firewall.@rule[-1].src=wan | |
uci set firewall.@rule[-1].target=ACCEPT |
mkdir /data | |
mkfs.ext4 -L data /dev/mmcblk0p1 | |
uci add fstab mount | |
uci set fstab.@mount[-1].device=/dev/mmcblk0p1 | |
uci set fstab.@mount[-1].target=/data | |
uci set fstab.@mount[-1].fstype=ext4 | |
uci set fstab.@mount[-1].options=rw,sync,noatime,nodiratime | |
uci set fstab.@mount[-1].enabled=1 |