Skip to content

Instantly share code, notes, and snippets.

View dangtrinhnt's full-sized avatar
😎
Busy changing the world

Trinh Nguyen dangtrinhnt

😎
Busy changing the world
View GitHub Profile
@dangtrinhnt
dangtrinhnt / renew_cert.sh
Last active March 22, 2018 15:26
Renew standalone let's encrypt cert shell script
#! /bin/bash
## Because this is a standalone letsencrypt cert
## We have to stop nginx before doing renewal
CERT_IS_VALID=$(/usr/bin/ssl-cert-check -c /etc/letsencrypt/live/mydomain.com/fullchain.pem)
VALID_STR="Valid"
if [[ "$CERT_IS_VALID" =~ "$VALID_STR" ]];
then
echo "Cert is valid"
else
@dangtrinhnt
dangtrinhnt / openwrt_qos.yaml
Created February 6, 2018 13:45
Deploy QoS VNF with OpenWRT
tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
description: OpenWRT with QoS services
metadata:
template_name: OpenWRT
topology_template:
node_templates:
VDU1:
@dangtrinhnt
dangtrinhnt / dhcp_dns_openwrt_tacker.yml
Created February 1, 2018 15:39
Deploye OpenWRT as DHCP and DNS service on OpenStack Tacker
tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
description: OpenWRT with services
metadata:
template_name: OpenWRT
topology_template:
node_templates:
VDU1:
@dangtrinhnt
dangtrinhnt / nat_vnf_openwrt_tacker.yml
Created February 1, 2018 14:42
NAT VNF for Tacker using OpenWRT
tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
description: OpenWRT with services
metadata:
template_name: OpenWRT
topology_template:
node_templates:
VDU1:
[Unit]
Description=Start odoo 11 docker instance with postgres
[Service]
Environment=
WorkingDirectory=/odoo
ExecStart=/usr/bin/docker-compose up
Restart=always
[Install]
@dangtrinhnt
dangtrinhnt / docker-compose.yml
Created December 21, 2017 02:51
Docker compose file for odoo 11
version: '2'
services:
web:
image: odoo:11.0
depends_on:
- myodoo
ports:
- "8069:8069"
environment:
- HOST=myodoo
@dangtrinhnt
dangtrinhnt / push_local_to_dockerhub.sh
Last active October 19, 2017 10:52
Push all local registry's images to DockerHub
#! /bin/bash
#
# This will push all the images from a local registry to DockerHub. For example:
# local_registry_domain/branch/image_name:my-tag -> docker_hub_username/image_name:my-tag
#
dh_username=''
dh_passwd=''
local_repo=''
local_branch=''
@dangtrinhnt
dangtrinhnt / pull_all_from_private_docker_registry.sh
Created October 14, 2017 06:29
Pull all images from a private docker registry
#! /bin/bash
username=''
passwd=''
docker_registry_url=''
tag=''
docker login -u $username -p $passwd $docker_registry_url
curl "https://$username:$passwd@$docker_registry_url/v2/_catalog" | jq -c '.[][]' | while read images; do
for i in $images
do
img=$(echo $i | tr -d '"')
@dangtrinhnt
dangtrinhnt / edx-datastores.yml
Created August 17, 2017 16:06
Ansible playbook to install datastores on a remote server
---
# put this in /var/tmp/configuration/playbooks/
# Install datastore srver
#
# installs
- name: Configure instance(s)
hosts: datastores
become: True
gather_facts: True
@dangtrinhnt
dangtrinhnt / install_datastore.sh
Created August 17, 2017 16:03
Open edX's remote datastore installation
#!/bin/bash
##
## Sanity check
##
if [[ `lsb_release -rs` != "16.04" ]]; then
echo "This script is only known to work on Ubuntu 16.04, exiting...";
exit;
fi