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 / Jenkinsfile
Last active March 28, 2023 07:25
Code snippet sonarqube with jenkinsfile
pipeline {
stages {
// Sonarqube Analysis
// Abort pipeline if QualityGate fail timeout 10 minutes
stage('SonarQube Analysis 🔬') {
environment {
scannerHome = tool 'SonarQubeScanner' //Make sure to replace SonarScanner with the name you gave to your SonarQube Scanner tool in Jenkins
}
steps {
withSonarQubeEnv('sonarqube') {
@taufiqpsumarna
taufiqpsumarna / nginx.conf
Last active March 28, 2023 07:25
Setup Nginx Reverse Proxy
## Nginx Installation
sudo apt-get update
sudo apt-get install nginx
## Create nginx conf (/etc/nginx/sites-available/..)
### Config_option_2
server {
listen 80;
server_name example.com; #change app url
@taufiqpsumarna
taufiqpsumarna / gitlab-ci.yml
Last active July 6, 2022 03:43
Gitlab Simple CI/CD Deploy To SSH Serverr
image: ubuntu:latest
stages:
- deploy
deploy_prod:
stage: deploy
before_script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- mkdir -p ~/.ssh
- eval $(ssh-agent -s)
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
@taufiqpsumarna
taufiqpsumarna / certbot_nginx
Created July 7, 2022 09:42
Cerbot SSL Let's Encrypt nginx
### Install Certbot and it’s Nginx plugin with apt:
sudo apt install certbot python3-certbot-nginx
### To check, open the configuration file for your domain using nano or your favorite text editor:
sudo nano /etc/nginx/sites-available/example.com
### Obtaining an SSL Certificate
sudo certbot --nginx -d example.com -d www.example.com
This runs certbot with the --nginx plugin, using -d to specify the domain names we’d like the certificate to be valid for.
@taufiqpsumarna
taufiqpsumarna / migrate_s3_to_another_account
Last active July 8, 2022 06:28
This Gist Show How To Migrate S3 To Another Account
### Source Policy IAM
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:ListBucket",
"s3:GetObject"
],
@taufiqpsumarna
taufiqpsumarna / SSL-nginx-Docker.md
Created July 12, 2022 03:11 — forked from dahlsailrunner/SSL-nginx-Docker.md
SSL with Docker images using nginx as reverse proxy

Docker with SSL and an nginx reverse proxy

Running your ASP.NET Core (or other) application in Docker using SSL should not be an overwhelming task. These steps should do the trick.

Run the following steps from a Linux terminal (I used WSL or WSL2 on Windows from the Windows Terminal).

1. Create a conf file with information about the cert you'll be creating

It should look something like the content below; call it my-site.conf or something like that.

@taufiqpsumarna
taufiqpsumarna / gitlab-ci.yml
Created July 14, 2022 04:07
Simple example of CI to build a Docker container and push it to Amazon ECR
# Simple example of CI to build a Docker container and push it to Amazon ECR
variables:
DOCKER_REGISTRY: 000000000000.dkr.ecr.eu-west-1.amazonaws.com
AWS_DEFAULT_REGION: eu-west-1
APP_NAME: ecr_demo
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
publish:
@taufiqpsumarna
taufiqpsumarna / gitlab-ci.yml
Created July 14, 2022 06:38
GitLab CI CD Tutorial for Beginners [Crash Course] From TechWorld with Nana
variables:
IMAGE_NAME: nanajanashia/demo-app
IMAGE_TAG: python-app-1.0
stages:
- test
- build
- deploy
run_tests:
@taufiqpsumarna
taufiqpsumarna / Workflow.md
Last active August 29, 2022 09:25
Gitlab CI/CD Push To ECR and Deploy To Server Use Docker-Compose

CI / CD Flow

  1. Build
  2. Push To ECR
  3. Deploy To Staging Server With Docker Installed
  4. Deploy To Production Server With Docker Installed

Notes:

  1. You Must Setup Variable in Gitlab.
  • AWS_ACCESS_KEY_ID = AWS IAM ACCESS KEY
  • AWS_SECRET_ACCESS_KEY = AWS IAM SECRET KEY
@taufiqpsumarna
taufiqpsumarna / README.md
Last active August 29, 2022 09:24
MongoDB Dump