Skip to content

Instantly share code, notes, and snippets.

View naviat's full-sized avatar
🪲

Harry Dam naviat

🪲
View GitHub Profile
@naviat
naviat / index.js
Created August 16, 2018 04:17 — forked from jeka-kiselyov/index.js
CloudWatch to AWS Lambda to Slack Channel Alerts and Charts. Posts CloudWatch Alerts via SNS topic via Lambda function to Slack channel. And draws charts for CPUUtilization metrics(both for EC2 abd RDS).
////// Save as index.js and upload it to Lambda as zip archive with node_modules directory. After:
////// npm install aws-cloudwatch-chart
////// npm install request
////// no need to upload aws-sdk module
////// Don't forget to change API keys here.
////// License: MIT
////// Docs:
@naviat
naviat / ainstall.sh
Created August 16, 2018 04:17 — forked from jeka-kiselyov/ainstall.sh
Haproxy 1.6 node server balancer on Ubuntu, works on aws
sudo add-apt-repository ppa:vbernat/haproxy-1.6
sudo apt-get update
sudo apt-get install haproxy
# restart service
sudo service haproxy restart
# configuration file
sudo nano /etc/haproxy/haproxy.cfg
@naviat
naviat / backup.php
Created August 16, 2018 04:18 — forked from jeka-kiselyov/backup.php
Backup wordpress installation and blog database to pbworks workspace
<?php
//// usage - php backup.php domain
$network = 'network';
$workspace = 'workspace';
$apikey = '...........';
$tmp_path = sys_get_temp_dir(); //// should be writable
define( 'ABSPATH', dirname(__FILE__) . '/' );
//// create empty wp-settings.php file (wp config tries to find it)
@naviat
naviat / Ansible Let's Encrypt Nginx setup
Created October 16, 2018 08:57 — forked from mattiaslundberg/Ansible Let's Encrypt Nginx setup
Let's Encrypt Nginx setup with Ansible
Ansible playbook to setup HTTPS using Let's encrypt on nginx.
The Ansible playbook installs everything needed to serve static files from a nginx server over HTTPS.
The server pass A rating on [SSL Labs](https://www.ssllabs.com/).
To use:
1. Install [Ansible](https://www.ansible.com/)
2. Setup an Ubuntu 16.04 server accessible over ssh
3. Create `/etc/ansible/hosts` according to template below and change example.com to your domain
4. Copy the rest of the files to an empty directory (`playbook.yml` in the root of that folder and the rest in the `templates` subfolder)
@naviat
naviat / awc-ecs-access-to-aws-efs.md
Created November 12, 2018 04:47 — forked from arbabnazar/awc-ecs-access-to-aws-efs.md
Step-by-step Instructions to Setup an AWS ECS Cluster

Configuring AWS ECS to have access to AWS EFS

If you would like to persist data from your ECS containers, i.e. hosting databases like MySQL or MongoDB with Docker, you need to ensure that you can mount the data directory of the database in the container to volume that's not going to dissappear when your container or worse yet, the EC2 instance that hosts your containers, is restarted or scaled up or down for any reason.

Don't know how to create your own AWS ECS Cluster? Go here!

New Cluster

Sadly the EC2 provisioning process doesn't allow you to configure EFS during the initial config. After your create your cluster, follow the guide below.

New Task Definition for Web App

If you're using an Alpine-based Node server like duluca/minimal-node-web-server follow this guide:

@naviat
naviat / awc-ecs-access-to-aws-efs.md
Created November 12, 2018 04:47 — forked from duluca/awc-ecs-access-to-aws-efs.md
Step-by-step Instructions to Setup an AWS ECS Cluster

Configuring AWS ECS to have access to AWS EFS

If you would like to persist data from your ECS containers, i.e. hosting databases like MySQL or MongoDB with Docker, you need to ensure that you can mount the data directory of the database in the container to volume that's not going to dissappear when your container or worse yet, the EC2 instance that hosts your containers, is restarted or scaled up or down for any reason.

Don't know how to create your own AWS ECS Cluster? Go here!

New Cluster

Sadly the EC2 provisioning process doesn't allow you to configure EFS during the initial config. After your create your cluster, follow the guide below.

New Task Definition for Web App

If you're using an Alpine-based Node server like duluca/minimal-node-web-server follow this guide:

@naviat
naviat / install-node-js.sh
Created November 29, 2018 03:44 — forked from ankurk91/install-node-js.sh
Install node-js, npm and yarn on Ubuntu/Mac using nvm
#!/bin/sh
# Install node and npm via nvm - https://github.com/creationix/nvm
# Run this script like - bash script-name.sh
# Define versions
INSTALL_NODE_VER=10
INSTALL_NVM_VER=0.33.11
@naviat
naviat / nginxproxy.md
Created December 9, 2018 16:18 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@naviat
naviat / letsencrypt_2018.md
Created December 12, 2018 03:47 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@naviat
naviat / letsencrypt_2018.md
Created December 12, 2018 03:47 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files: