$ cat test.tmpl
Hi ${USER}, this is a ${ENVIRONMENT} environment
USER=ruan ENVIRONMENT=test envsubst '${USER},${ENVIRONMENT}' < test.tmpl
Hi ruan, this is a test environment
version: "3.7" | |
services: | |
# https://docs.gitea.io/en-us/install-with-docker/ | |
gitea: | |
image: gitea/gitea:1.12.4 | |
# https://hub.docker.com/r/gitea/gitea/tags | |
container_name: gitea | |
environment: | |
- APP_NAME=Gitea |
$ cat test.tmpl
Hi ${USER}, this is a ${ENVIRONMENT} environment
USER=ruan ENVIRONMENT=test envsubst '${USER},${ENVIRONMENT}' < test.tmpl
Hi ruan, this is a test environment
<!DOCTYPE html> | |
<html lang="en-us"> | |
<head> | |
<meta charset="utf-8"> | |
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous"> | |
<script src="https://code.jquery.com/jquery-3.1.1.min.js" crossorigin="anonymous"></script> | |
<title>Sample Page</title> | |
</head> | |
<body> | |
<div class="container-fluid"> |
This is a workaround that works for my use-case when log content are not present withing a minute, using AWS Lambda and AWS CloudWatch Events
Setup:
Userdata:
$ cat userdata.txt
#!/bin/bash
CLUSTER_NAME="aws-qa-ecs"
ENVIRONMENT_NAME="qa"
INSTANCE_LIFECYCLE="spot"
MY_HOSTNAME="$(curl -s http://169.254.169.254/latest/meta-data/local-hostname)"
INSTANCE_ID="$(curl -s http://instance-data/latest/meta-data/instance-id)"
#!/bin/bash | |
AWS_ACCOUNT="dev" | |
CLUSTER_NAME="aws-qa-ecs" | |
ENVIRONMENT_NAME="qa" | |
NODE_EXPORTER_VERSION="1.0.1" | |
NODE_EXPORTER_USER="node_exporter" | |
MY_HOSTNAME="$(curl -s http://169.254.169.254/latest/meta-data/local-hostname)" | |
INSTANCE_ID="$(curl -s http://instance-data/latest/meta-data/instance-id)" | |
INSTANCE_LIFECYCLE="$(curl -s http://169.254.169.254/latest/meta-data/instance-life-cycle)" | |
REGION="$(curl -s http://instance-data/latest/meta-data/placement/availability-zone | rev | cut -c 2- | rev)" |
OnDemand:
$ curl -s https://raw.githubusercontent.com/powdahound/ec2instances.info/master/www/instances.json | jq -r '.[] | select(.instance_type == "t2.micro") | .pricing."eu-west-1".linux.ondemand'
0.0126
Spot:
Provision a VM with Multipass:
$ multipass shell
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.4 LTS
Release: 18.04
Codename: bionic
Update and install cpu-checker to see if we can use hardware virtualization:
$ apt update && apt upgrade -y
$ apt install cpu-checker -y
Test with kvm-ok:
SSH2 format will look like this:
---- BEGIN SSH2 PUBLIC KEY ----
Comment: "rsa-key-20201005"
AAAA
....
abcdef==
---- END SSH2 PUBLIC KEY ----