cat /etc/*release
sudo apt-get update -yqq
sudo apt-get install -yqq p7zip-full
# 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 |
* * * * * 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; |
# 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:
-
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.
-
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
# to generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
Simple collection of Groovy scripts to help me maintain some Jenkins systems.
See also https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+Script+Console
#!/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 | |
# |