Skip to content

Instantly share code, notes, and snippets.

View taufiqpsumarna's full-sized avatar
🏠
Work From Home

Taufiq Permana taufiqpsumarna

🏠
Work From Home
View GitHub Profile
@taufiqpsumarna
taufiqpsumarna / values.yml
Last active January 15, 2025 06:21
ArgoCD mattermost notification templates
# -- The notification template is used to generate the notification content
## For more information: https://argo-cd.readthedocs.io/en/stable/operator-manual/notifications/templates/
templates:
template.app-deployed: |
message: |
🚀 **{{.app.metadata.name}} : Deployment Successful**
Application: **{{.app.metadata.name}}**
Repository: **{{.app.spec.source.repoURL}}**
Revision: **{{.app.status.sync.revision}}**
Status: **Healthy**
@taufiqpsumarna
taufiqpsumarna / docker-build-push.sh
Created September 23, 2024 08:40
Bash script build docker image using Buildkit and Docker image cache speeding up build progress
#!/bin/bash
# Define Docker image tag
TAG=${DOCKER_REGISTRY}/${REPO_NAME}:${APP_VER:latest}
echo $TAG
# Enable Docker BuildKit
export DOCKER_BUILDKIT=1
# Pull Docker image cache
@taufiqpsumarna
taufiqpsumarna / env.sh
Last active September 23, 2024 09:31
Bash script for checking .env file and load it into current shell
#!/bin/bash
# Check if $ENV_FILE variable is set
if [ -z .env ]; then
echo "Error: ENV_FILE variable is not set. Please specify the path to the .env file."
exit 1
fi
# Check if the .env file exists
if [ ! -f .env ]; then
echo "Error: The specified .env file .env does not exist."
@taufiqpsumarna
taufiqpsumarna / .gitlab-ci.yaml
Created September 19, 2024 07:27
Infisical Gitlab CI/CD
---
🔐 infisical-get-secret:
image: taufiq14s/infisical-cli
rules:
- if: $CI_COMMIT_BRANCH == "main"
variables:
INFISICAL_ENVIRONMENT: prod
- if: $CI_COMMIT_BRANCH == "staging"
variables:
INFISICAL_ENVIRONMENT: staging
@taufiqpsumarna
taufiqpsumarna / Dockerfile
Created September 19, 2024 06:22
Lightweight Docker Image Java Apps
# Stage 1: Build the application
FROM maven:3.9-eclipse-temurin-17-alpine AS build
WORKDIR /build
COPY . .
RUN mvn package
#Stage 2: Create the final lightweight image
FROM eclipse-temurin:17-jre-alpine
WORKDIR /app
COPY --from=build /build/target/hello-world.jar .
@taufiqpsumarna
taufiqpsumarna / how_to_restore_key.pem_ec2_instance.md
Last active September 5, 2024 04:26
Restore deleted default AWS EC2 Instance key.pem

A quick note how to add a key from myKey.pem file to authorized keys on Linux.

The permissions for ~/.ssh/ folder should be 700. Permissions for authorized_keys file and myKey.pem are to be 600.

1.Generate a public key first (usually from AWS EC2 key)

ssh-keygen -y -f AnalyticsSharedKeyPair.pem > AnalyticsSharedKeyPair.pub

2.Add a new public key to authorized_keys:

@taufiqpsumarna
taufiqpsumarna / config.alloy
Last active August 14, 2024 06:19
Grafana Alloy Self Hosted Configuration File
prometheus.exporter.self "integrations_alloy" { }
discovery.relabel "integrations_alloy" {
targets = prometheus.exporter.self.integrations_alloy.targets
rule {
target_label = "instance"
replacement = constants.hostname
}
@taufiqpsumarna
taufiqpsumarna / loki.conf
Created August 13, 2024 05:12
nginx reverse proxy for loki HTTP Basic Auth
server {
listen 80;
server_name <YOUR_DOMAIN_NAME>;
#Basic Auth
auth_basic "loki auth";
auth_basic_user_file /etc/nginx/.htpasswd_loki;
location / {
proxy_read_timeout 1800s;
@taufiqpsumarna
taufiqpsumarna / prometheus.conf
Created August 13, 2024 05:11
nginx reverse proxy for prometheus HTTP Basic Auth
server {
listen 80;
server_name <YOUR_DOMAIN_NAME>;
auth_basic "prometheus auth";
auth_basic_user_file /etc/nginx/.htpasswd_prometheus;
location / {
proxy_read_timeout 1800s;
proxy_connect_timeout 1600s;
@taufiqpsumarna
taufiqpsumarna / CodebuildPolicy.json
Created June 10, 2024 08:10
AWS CodeBuild Build Docker Image, push to AWS ECR and deploy to AWS ECS
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ecr:GetDownloadUrlForLayer",
"ecr:BatchGetImage",
"ecr:BatchCheckLayerAvailability",
"ecr:PutImage",