Skip to content

Instantly share code, notes, and snippets.

View YannMjl's full-sized avatar
💭
Learning is experience; everything else is just information!

Yann Mulonda YannMjl

💭
Learning is experience; everything else is just information!
View GitHub Profile
@YannMjl
YannMjl / upload_to_AWS_ECR.yml
Last active November 24, 2022 16:43
upload the app docker image to AWS ECR from GitHub Actions
# upload the app docker image to AWS ECR
push_to_AWS_ECR:
name: Deploy docker image to AWS ECR
runs-on: ubuntu-latest
# run this job only if the app build and test successfully
needs: [build_test]
steps:
- name: Checkout
@YannMjl
YannMjl / myAppexec.sh
Last active November 4, 2022 16:26
Run a nodejs app using PM2 from a script
! /bin/sh
# -----------------------------------------------------------------------*
# use this block when dveelopement your app locally on your laptop
# uncomment this section for local host testing only.
# Make surre to comment this out before pushing the code
# to your source code management repo
# export HOME=./
# node=$HOME
.
.
.
<!--
if you'd like to run Jenkins with a specific version of Java, specify a full path to java.exe.
The following value assumes that you have java in your PATH.
-->
<!--<executable>D:\OpenJDK\javapath\bin\java.exe</executable>-->
<executable>"C:\Program Files\Eclipse Adoptium\jdk-11.0.15.10-hotspot\bin\java.exe"</executable>
<!--
#!/bin/bash
now=$(date)
BACKUPS_DIR="/location where my backup log files are stored"
# create log file
touch $BACKUPS_DIR/backup_delete.log
echo "Date: $now" > $BACKUPS_DIR/backup_delete.log
# declare static Array of file names
file_names=('backup_*.tgz' 'backup_file2*.log' 'log_file*.log')
@YannMjl
YannMjl / terraform.yml
Created August 16, 2021 21:02
Github action job to automate provisioning on GCP with Terraform
# this workflow job is used to automate provision of servers and resources
# for Google Cloud Project with terraform
# author: Yann Mulonda
name: 'Terraform'
on:
push:
branches:
- terraform
@YannMjl
YannMjl / main.yml
Last active August 11, 2021 00:35
This is a snipet of GitHub action job to deploy a kubernetes deployment to GCP cluster
deploy_to_google_cloud:
name: Deploy to Google Cloud Platform
runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v2
# Setup gcloud CLI
- name: setup gcloud CLI
uses: google-github-actions/setup-gcloud@master
with:
@YannMjl
YannMjl / providers.tf
Last active August 10, 2021 19:29
this is a terraform provider template for Google Could project
# -------------------------------------------------------------*
# Configure the Google Cloud provider
# -------------------------------------------------------------*
# The provider “google” line indicates that you are using the
# Google Cloud Terraform provider. To prevent automatic upgrades
# to new major versions that may contain breaking changes,
# it is recommended to add version = "..." constraints to the
# corresponding provider blocks in configuration
provider "google" {
# version = "~> 3.77.0"
@YannMjl
YannMjl / main.tf
Created August 10, 2021 19:24
this a terraform template to create a kubernetes cluster and set up firewall on Google Cloud Platform
# -------------------------------------------------------------*
# Create and config Kubernetes cluster
# -------------------------------------------------------------*
# This will created the Kubernetes cluster and nodes in GCP
resource "google_container_cluster" "primary" {
name = "node-demo-k8s" # cluster name
location = "us-central1-c"
initial_node_count = 4 # number of node (VMs) for the cluster
# Google recommends custom service accounts that have cloud-platform
# scope and permissions granted via IAM Roles.
@YannMjl
YannMjl / main.yaml
Last active June 18, 2021 17:17
This is github actions that used to build docker image, deploy to docker hub and Heroku
# This is a basic workflow to help you get started with Actions
name: CI-CD
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
@YannMjl
YannMjl / deploy.yml
Last active August 10, 2021 21:12
This is the kubernetes deployment yaml file for nodejs demo app
# check out all Kubernetes commands here:
# https://kubernetes.io/docs/reference/kubectl/cheatsheet/
# -----------------------------------------------------------*
# implies the use of kubernetes 1.7
# use apps/v1beta2 for kubernetes 1.8
# -----------------------------------------------------------*
apiVersion: apps/v1
kind: Deployment
metadata:
name: nodej-demo-app