This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Should be run as sudo | |
# Usage: add-new-website.sh domain -- script to set up a new site with SSL cert | |
# where: | |
# domain website domain without subdomains (ex: example.com) | |
if [ ! -z "$1" ] | |
then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file goes in /opt/bitnami/nginx/conf/server_blocks as mail.example.com.conf (make sure to replace the filename with your actual subdomain) | |
# This Nginx config file assumes we're runing a Bitnami image (thus the non-standard /opt/bitnami paths) | |
# FULL TUTORIAL to set up Listmonk on AWS Lightsail here: https://rameerez.com/free-mailchimp-alternative-email-marketing-service#listmonk-tutorial | |
server { | |
listen 443 ssl; | |
server_name mail.example.com; | |
server_tokens off; | |
ssl_certificate /opt/bitnami/letsencrypt/certificates/mail.example.com.crt; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "VisualEditor0", | |
"Effect": "Allow", | |
"Action": [ | |
"s3:PutObject", | |
"s3:GetObject", | |
"s3:PutBucketPublicAccessBlock", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This scrips takes a clean AWS Amazon Linux 2023 AMI and installs and configures | |
# everything needed to deploy a Rails app to it. The resulting state is a clean | |
# instance that can be used to build a base AMI for an EC2 ASG. | |
# --- AESTHETICS --- | |
# Define the color code for green for echo messages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This scripts performs the initial setup for an EC2 AMI that has | |
# been previously prepared to accept Rails apps. | |
# --- USER DATA SCRIPT STARTS --- | |
# Configure SSH key for the rails user (same as ubuntu, AWS configured key) | |
sudo mkdir /home/rails/.ssh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This scrips takes a clean Ubuntu Server 20.04 LTS AMI and installs and configures | |
# everything needed to deploy a Rails app to it. The resulting state is a clean | |
# instance that can be used to build a base AMI in AWS. | |
# --- AESTHETICS --- | |
# Define the color code for green for echo messages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Needed previous configuration: | |
# | |
# - In UptimeRobot, configure a new **Webhook** Alert Contact with this POST payload: | |
# ``` | |
# { | |
# "monitorID": "*monitorID*", | |
# "monitorURL": "*monitorURL*", | |
# "monitorFriendlyName": "*monitorFriendlyName*", | |
# "alertType": "*alertType*", | |
# "alertTypeFriendlyName": "*alertTypeFriendlyName*", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# You need to give the Lambda the following permissions. | |
# Head to the Lambda page, and under Configuration > Permissions > Resource-based policy statements add a new policy statement: | |
# - Select "AWS Service" | |
# - On "Service", choose "Other" | |
# - Statement ID: AlarmAction | |
# - Principal: lambda.alarms.cloudwatch.amazonaws.com | |
# - Source ARN: arn:aws:cloudwatch:us-east-1:YOUR_ACCOUNT_ID:alarm:* | |
# - Action: lambda:InvokeFunction | |
# | |
# The same result can be achieved with `aws-cli`: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Ensure the script is run as root | |
if [[ $EUID -ne 0 ]]; then | |
echo "This script must be run as root" | |
exit 1 | |
fi | |
# Define aesthetics | |
GREEN='\033[0;32m' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Ensure the script is run as root | |
if [ "$(id -u)" -ne 0 ]; then | |
echo -e "\e[31mERROR: This script must be run as root.\e[0m" | |
exit 1 | |
fi | |
# Define aesthetics | |
GREEN='\033[0;32m' |
OlderNewer