Skip to content

Instantly share code, notes, and snippets.

@anton-mesnyankin
anton-mesnyankin / Dockerfile
Created April 18, 2020 20:33 — forked from leomelzer/Dockerfile
Install private NPM dependencies using git+ssh on Now. Based on https://zeit.co/blog/build-env to work around missing support for git+ssh dependencies in now@2 (https://github.com/zeit/now-builders/issues/49)
# This is a multi-stage build to not spill the contents of the deploy_key
FROM mhart/alpine-node:10 as base
# We need git and openssh to resolve `git+ssh` links in package.json
RUN apk update \
&& apk add git openssh
WORKDIR /usr/src
COPY package*.json ./
# Parallelly download all aws-lambda functions
# Assumes you have ran `aws configure` and have output-mode as "text"
# Works with "aws-cli/1.16.72 Python/3.6.7 Linux/4.15.0-42-generic botocore/1.12.62"
download_code () {
local OUTPUT=$1
aws lambda get-function --function-name $OUTPUT --query 'Code.Location' | xargs wget -O ./lambda_functions/$OUTPUT.zip
}
mkdir -p lambda_functions
@anton-mesnyankin
anton-mesnyankin / ec2cw.sh
Created June 15, 2019 13:53 — forked from thiagomgo/ec2cw.sh
Cron to put load average values into Cloud Watch
* * * * * root /bin/aws --region <REGION> cloudwatch put-metric-data --namespace="<NAMESPACE>" --metric-name "CPULoad" --value $(cat /proc/loadavg | awk '{print $1}') --dimensions AutoScalingWebGroup="ASG-NAME" > /tmp/cpuload-lastrun.log 2>&1;
@anton-mesnyankin
anton-mesnyankin / Install_7zip_on_Linux.md
Created March 16, 2019 07:41 — forked from P7h/Install_7zip_on_Linux.md
7zip install on Linux -- Ubuntu and Fedora or CentOS / RHEL

Steps to install 7zip on Linux » Ubuntu and Fedora or CentOS / RHEL

Ubuntu

cat /etc/*release
sudo apt-get update -yqq
sudo apt-get install -yqq p7zip-full
@anton-mesnyankin
anton-mesnyankin / install.sh
Created January 9, 2019 19:04 — forked from wdullaer/install.sh
Install Latest Docker and Docker-compose on Ubuntu
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
sudo true
# Install kernel extra's to enable docker aufs support
# sudo apt-get -y install linux-image-extra-$(uname -r)
# Add Docker PPA and install latest version
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
# sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
AWSTemplateFormatVersion: 2010-09-09
Description: 'Registers ecs tasks to a second target group'
Parameters:
ClusterArn:
Description: 'ANR of cluster the service resides in'
Type: String
ServiceName:
Description: 'Name of the service to register'
Type: String
ContainerName:

Unfortunately as of writing this (Oct 18, 2017) there is no built in integration for multiple target groups per AWS ECS service. Here are a few things you can try:

  1. If your application just serves port 80 (HTTP) & port 443 (HTTPS) then you should consider using the application load balancer and terminating SSL at the load balancer. This will allow your application to function using just port 80.

  2. If your application serves different ports that are backed by different components, perhaps speaking different protocols then you should consider splitting the application into multiple ECS services. This has the benefit of allowing the different components to independently scale

@anton-mesnyankin
anton-mesnyankin / nginx.conf
Created November 22, 2018 11:04 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@anton-mesnyankin
anton-mesnyankin / README.md
Created July 17, 2018 10:30 — forked from dnozay/_Jenkins+Script+Console.md
jenkins groovy scripts collection.
#!/bin/bash
#
# Copyright (c) 2016 Katsuya SAITO
# This software is released under the MIT License.
# http://opensource.org/licenses/mit-license.php
#
# @(#) softethervpn_letsencrypt_cert_autoupdate.sh ver.0.1.0 2016.02.20
#
# Usage: softethervpn_letsencrypt_cert_autoupdate.sh CommonName WEBROOT PASSWORD MAIL
#